From a59c3c601363fcbcec75fb3ccf6ab538a71a6bf4 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 16 Apr 2013 16:34:01 +0200 Subject: [PATCH] new: added ``postgres`` charm. --- precise/postgres/hooks/install | 29 +++++++++++++++++++++++++++++ precise/postgres/hooks/start | 3 +++ precise/postgres/hooks/stop | 3 +++ precise/postgres/metadata.yaml | 8 ++++++++ precise/postgres/revision | 1 + 5 files changed, 44 insertions(+) create mode 100755 precise/postgres/hooks/install create mode 100755 precise/postgres/hooks/start create mode 100755 precise/postgres/hooks/stop create mode 100644 precise/postgres/metadata.yaml create mode 100644 precise/postgres/revision diff --git a/precise/postgres/hooks/install b/precise/postgres/hooks/install new file mode 100755 index 00000000..8c9443d2 --- /dev/null +++ b/precise/postgres/hooks/install @@ -0,0 +1,29 @@ +#!/bin/bash + +set -eux # -x for verbose logging to juju debug-log + + +apt-get install -y --force-yes postgresql-9.1 cron kal-scripts + +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 + + +## 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 'jw8s0F4' 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='*' + diff --git a/precise/postgres/hooks/start b/precise/postgres/hooks/start new file mode 100755 index 00000000..9eb7853c --- /dev/null +++ b/precise/postgres/hooks/start @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to Start for base." diff --git a/precise/postgres/hooks/stop b/precise/postgres/hooks/stop new file mode 100755 index 00000000..170162bd --- /dev/null +++ b/precise/postgres/hooks/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to stop for base." diff --git a/precise/postgres/metadata.yaml b/precise/postgres/metadata.yaml new file mode 100644 index 00000000..f50758ed --- /dev/null +++ b/precise/postgres/metadata.yaml @@ -0,0 +1,8 @@ +name: postgres +summary: "Postgres server" +maintainer: "Valentin Lab " +inherit: base-0k +description: | + Postgres server +data-resources: + - /var/backups/pg diff --git a/precise/postgres/revision b/precise/postgres/revision new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/precise/postgres/revision @@ -0,0 +1 @@ +0