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.
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!"
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.
27
27
# Next, we do some small file moving around. Just for debug stuff.
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
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
35
35
# Caching stuff, basically "DO WE HAVE MEMCACHED, GOOD LETS DO CONFIG"
66
66
a2enmod actions fastcgi alias proxy_balancer proxy_http headers
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
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
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
79
79
echo "apache2" > .web-engine
81
81
if [ -f .web-engine ]; then