~chqistian/charms/trusty/wordpress/trunk

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Marco Ceppi
  • Date: 2013-04-02 23:16:50 UTC
  • Revision ID: marco@ceppi.net-20130402231650-vc5uq2cyosxsgx72
Adjust shm_size based on available ram

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
source inc/common
6
6
 
7
 
## 
 
7
##
8
8
# This is where things can get a bit hectic. So this long blog is just to
9
9
# help preface what's going on here. When this hook fires it will always
10
10
# try to re-configure the entire unit. It's like a GOD hook, triggering
11
11
# or using data from every other hook with the exception of the install
12
12
# and upgrade-charm hooks.
13
13
#
14
 
# First, get a bunch of configuration values. The idea being this is should 
 
14
# First, get a bunch of configuration values. The idea being this is should
15
15
# be the only place that config-get is run as it's "unreliable" anywhere else
16
16
# Data should then either be passed to functions or written down - you know
17
17
# "YOU SHOULD ALWAYS LEAVE A NOTE!"
18
18
#
19
 
# From here, the web engine will either be updated or left alone. We always 
 
19
# From here, the web engine will either be updated or left alone. We always
20
20
# assume it's going to be nginx unless you specify apache. So if you put
21
21
# "lighttpd" or "i love apache" you're going to get nginx, so don't do that.
22
 
# Configuration files are re-written every time. This is to make sure that 
23
 
# any changes to long running units overtime are included. It may seem 
24
 
# expensive to keep re-writing the same files but in the end having all 
 
22
# Configuration files are re-written every time. This is to make sure that
 
23
# any changes to long running units overtime are included. It may seem
 
24
# expensive to keep re-writing the same files but in the end having all
25
25
# the units in a sane and identical state is worth it.
26
26
#
27
27
# Next, we do some small file moving around. Just for debug stuff.
28
28
#
29
 
# After that tuning levels are decided and executed. This is a bit more 
 
29
# After that tuning levels are decided and executed. This is a bit more
30
30
# involved than just running a function, check inc/common for that craziness
31
31
#
32
 
# After that, it's time to get any user-defined content! do_vcs does that 
 
32
# After that, it's time to get any user-defined content! do_vcs does that
33
33
# and a little more
34
34
#
35
35
# Caching stuff, basically "DO WE HAVE MEMCACHED, GOOD LETS DO CONFIG"
66
66
        a2enmod actions fastcgi alias proxy_balancer proxy_http headers
67
67
 
68
68
        install -o root -g root -m 0644 files/charm/apache/etc_apache2_conf-d_php5-fpm.conf /etc/apache2/conf.d/php5-fpm.conf
69
 
        
 
69
 
70
70
        juju-log "Installing Apache loadbal config..."
71
71
        install -o root -g root -m 0644 files/charm/apache/etc_apache2_sites-enabled_loadbalancer /etc/apache2/sites-available/loadbalancer
72
72
        sed -i -e "s/^  ServerName .*/  ServerName ${unit_address}/" /etc/apache2/sites-available/loadbalancer
73
73
        a2ensite loadbalancer
74
 
        
 
74
 
75
75
        juju-log "Installing Apache wordpress config..."
76
76
        install -o root -g root -m 0644 files/charm/apache/etc_apache2_sites-enabled_wordpress /etc/apache2/sites-available/wordpress
77
77
        a2ensite wordpress
78
 
        
 
78
 
79
79
        echo "apache2" > .web-engine
80
80
else
81
81
        if [ -f .web-engine ]; then