diff --git a/postgres-alpine/hooks/postgres_database-relation-joined b/postgres-alpine/hooks/postgres_database-relation-joined new file mode 100755 index 00000000..002462aa --- /dev/null +++ b/postgres-alpine/hooks/postgres_database-relation-joined @@ -0,0 +1,21 @@ +#!/bin/bash + +## When writing relation script, remember: +## - they should be idempotents +## - they can be launched while the dockers is already up +## - they are launched from the host +## - the target of the link is launched first, and get a chance to ``relation-set`` +## - both side of the scripts get to use ``relation-get``. + +USER=$(relation-get user) +PASSWORD="$(relation-get password 2>/dev/null)" || PASSWORD="$(gen_password)" + +config-add "\ +services: + $TARGET_CHARM_NAME: + environment: + POSTGRES_USER: $USER + POSTGRES_PASSWORD: $PASSWORD +" + +relation-set password "$PASSWORD" \ No newline at end of file diff --git a/postgres-alpine/metadata.yml b/postgres-alpine/metadata.yml new file mode 100644 index 00000000..3c801410 --- /dev/null +++ b/postgres-alpine/metadata.yml @@ -0,0 +1,4 @@ + +docker-image: postgres:9.3-alpine +data-resources: + - /var/lib/postgresql/data