#!/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 if [ "$(lsb_release -c -s)" == "trusty" ]; then apt-get install -y --force-yes postgresql-9.3 else apt-get install -y --force-yes postgresql-9.1 fi cat < /etc/cron.d/pgbackup SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 32 1 * * * root ansi_colors=no dayold=2 nbold=5 pgdump_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/ ) ## XXXvlab: Shouldn't we use ldap to create a key for each client and ## remove the clear password from here ? #echo "CREATE USER openerp WITH PASSWORD 'xxxx' CREATEDB NOCREATEROLE;" | sudo -u postgres psql ## add this to pghba #host all all 172.32.0.0/12 md5 #host all all 172.33.0.0/12 md5 ## modify listen_addresses in postgresql.conf #listen_addresses='*'