|
@ -0,0 +1,47 @@ |
|
|
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
set -eux # -x for verbose logging to juju debug-log |
|
|
|
|
|
|
|
|
|
|
|
## 0k git remote options |
|
|
|
|
|
GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""} |
|
|
|
|
|
|
|
|
|
|
|
## 0k git remote path |
|
|
|
|
|
GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apt-get install -y --force-yes cron kal-scripts |
|
|
|
|
|
|
|
|
|
|
|
debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASSWORD" |
|
|
|
|
|
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASSWORD" |
|
|
|
|
|
apt-get install -y --force-yes mysql-server |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cat <<EOF > /etc/cron.d/mysqlbackup |
|
|
|
|
|
|
|
|
|
|
|
SHELL=/bin/sh |
|
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|
|
|
|
|
|
|
|
|
|
|
21 1,5,10,12,16,18,21,23 * * * root ansi_colors=no dayold=2 nbold=5 mysqldump_to_dir /var/backups |
|
|
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
|
## Install 0k-manage for all the pg_* tools |
|
|
|
|
|
## |
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
if ! [ -d "/opt/apps/0k-manage" ]; then |
|
|
|
|
|
cd /opt/apps && |
|
|
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-manage.git" && |
|
|
|
|
|
cd /opt/apps/0k-manage && |
|
|
|
|
|
git checkout 0k/prod/master |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
ln -sf /opt/apps/0k-manage/src/bin/* /usr/local/bin/ |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## should replace /etc/mysql/my.cnf bind-address by 0.0.0.0 |
|
|
|
|
|
|