You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

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