Browse Source

new: [postgres-alpine] added charm.

postgres
Valentin Lab 7 years ago
parent
commit
7e1699b96b
  1. 21
      postgres-alpine/hooks/postgres_database-relation-joined
  2. 4
      postgres-alpine/metadata.yml

21
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"

4
postgres-alpine/metadata.yml

@ -0,0 +1,4 @@
docker-image: postgres:9.3-alpine
data-resources:
- /var/lib/postgresql/data
Loading…
Cancel
Save