5
if [[ -d exec.d ]]; then
7
for f in exec.d/*/charm-pre-install; do
8
[[ -x "$f" ]] || continue
10
## bail out if anyone fails
11
juju-log -l ERROR "$f: returned exit_status=$? "
17
add-apt-repository ppa:charmers/charm-helpers
18
apt-get update && apt-get -y upgrade
20
apt-get -y install php5-memcache mysql-client pwgen php5 php5-fpm \
21
php-apc mailutils php-mail sysstat php5-mysql php5-mcrypt php5-memcache \
22
php5-curl rsync nfs-common git-core mktemp
26
juju-log "Making /mnt/tmp dir ..."
30
juju-log "Making /mnt/logs ..."
31
mkdir -p /mnt/logs/php-fpm
32
chmod -R 1777 /mnt/logs
34
## dont make this an actual ramdisk until later when size can be safely tested
35
## just using plain disk cache for now
36
juju-log "Making Ramdisk mount point and config ..."
37
mkdir -p /mnt/ramdisk/proxy-cache
38
mkdir -p /mnt/ramdisk/phpfpm-cache
39
chmod -R 1777 /mnt/ramdisk
41
juju-log "Installing PHP-FPM pool configs ..."
42
rm -f /etc/php5/fpm/pool.d/*
43
install -o root -g root -m 0644 files/charm/php/php5-fpm_pool.d_www.conf /etc/php5/fpm/pool.d/www.conf
44
rsync -az /var/lib/php5 /mnt/ && rm -rf /var/lib/php5 && ln -s /mnt/php5 /var/lib/
46
juju-log "Creating random secret key ..."
47
if [ ! -f .wp-secret ]; then
48
pwgen -s 10 1 > .wp-secret
51
juju-log "Installing wp-cli to make this charm's life a little easier ..."
52
git clone https://github.com/wp-cli/wp-cli.git /usr/src/wp-cli
53
# other hooks call hooks/install and don't expect the CWD to change so
54
# run this section in a subshell
57
# 20120926: v0.6.0 is confirmed working, so use it rather than alpha.
58
git reset --hard v0.6.0
59
git submodule update --init
63
juju-log "So, environment is setup. We'll wait for some hooks to fire off before we get all crazy"