Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
amimoto での CodeDeply サンプル
#!/bin/bash
service nginx reload
service monit start
if [ -d /var/cache/myapp ]; then
rm -rf /var/cache/myapp
fi
version: 0.0
os: linux
files:
- source: /
destination: /var/cache/myapp
permissions:
- object: /var/cache/myapp
pattern: "**"
owner: ec2-user
group: www
mode: 644
type:
- file
- object: /var/cache/myapp
pattern: "**"
owner: ec2-user
group: www
mode: 755
type:
- directory
hooks:
BeforeInstall:
- location: deploy_scripts/before_install.sh
timeout: 60
runas: root
AfterInstall:
- location: deploy_scripts/source_sync.sh
timeout: 600
runas: ec2-user
- location: deploy_scripts/after_install.sh
timeout: 60
runas: root
#!/bin/bash
if [ -d /var/cache/myapp ]; then
rm -rf /var/cache/myapp
fi
service monit stop
#!/bin/bash
wp_path="/var/www/vhosts/$(curl -s http://169.254.169.254/latest/meta-data/instance-id)/"
wp="/usr/local/bin/wp --path=${wp_path}"
if [ ! -d ${wp_path} ]; then
mkdir -p ${wp_path}
fi
wp_version_current=`${wp} core version`
rsync -avz --delete \
--exclude *.yml \
--exclude .git/* \
--exclude local-config.php \
--exclude local-salt.php \
--exclude wp-content/cache \
--exclude wp-content/upgrade \
--exclude wp-content/uploads \
--exclude deploy_scripts \
/var/cache/myapp/ \
${wp_path}
wp_version_new=`${wp} core version`
if [ "${wp_version_current}" != "${wp_version_new}" ]; then
${wp} core update-db
fi
${wp} cache flush
#${wp} c3 flush all
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment