docker-mysql-stack/start_or_update.sh

15 lines
956 B
Bash
Raw Normal View History

#!/bin/bash
test -z $1 || HOST="_$1"
test -z $2 || INSTANCE="_$2"
test -f ~/secrets.tar.gz.enc || curl -o ~/secrets.tar.gz.enc "https://cloud.scimetis.net/s/${KEY}/download?path=%2F&files=secrets.tar.gz.enc"
openssl enc -aes-256-cbc -d -in ~/secrets.tar.gz.enc | tar -zxv --strip 2 secrets/docker-mysql-stack${HOST}${INSTANCE}/crontab secrets/docker-mysql-stack${HOST}${INSTANCE}/debian.cnf
sudo chown root. crontab debian.cnf
2019-08-19 09:45:26 +00:00
sudo chmod 644 crontab
# --force-recreate is used to recreate container when crontab file has changed
unset VERSION_MYSQL VERSION_CRON
VERSION_MYSQL=$(git ls-remote https://git.scimetis.net/yohan/docker-mysql.git| head -1 | cut -f 1|cut -c -10) \
VERSION_CRON=$(git ls-remote https://git.scimetis.net/yohan/docker-cron.git| head -1 | cut -f 1|cut -c -10) \
sudo -E bash -c 'docker-compose up -d --force-recreate'
2019-07-11 21:03:13 +00:00
# We cannot remove the secrets files or restarting the container would become impossible
#rm -f crontab debian.cnf