github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/xenial/wordpress/hooks/install (about)

     1  #!/bin/bash
     2  
     3  set -xe
     4  
     5  if [[ -d exec.d ]]; then
     6      shopt -s nullglob
     7      for f in exec.d/*/charm-pre-install; do
     8      [[ -x "$f" ]] || continue
     9      ${SHELL} -c "$f"|| {
    10          ## bail out if anyone fails
    11          juju-log -l ERROR "$f: returned exit_status=$? "
    12          exit 1
    13      }
    14      done
    15  fi
    16  
    17  add-apt-repository ppa:charmers/charm-helpers
    18  apt-get update && apt-get -y upgrade
    19  
    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
    23  
    24  modprobe nfs || true
    25  
    26  juju-log "Making /mnt/tmp dir ..."
    27  mkdir -p /mnt/tmp
    28  chmod 1777 /mnt/tmp
    29  
    30  juju-log "Making /mnt/logs ..."
    31  mkdir -p /mnt/logs/php-fpm
    32  chmod -R 1777 /mnt/logs
    33  
    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
    40  
    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/
    45  
    46  juju-log "Creating random secret key ..."
    47  if [ ! -f .wp-secret ]; then
    48  	pwgen -s 10 1 > .wp-secret
    49  fi
    50  
    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
    55  (
    56  	cd /usr/src/wp-cli
    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
    60  	utils/dev-build
    61  )
    62  
    63  juju-log "So, environment is setup. We'll wait for some hooks to fire off before we get all crazy"