#!/bin/sh # Create the Registry's database role and database (idempotent). Run on the node as root: sudo sh provision-db.sh # The password is read from /opt/coa/secrets/registry_db_password and goes to psql on stdin, never on a command line. set -eu PW=$(cat /opt/coa/secrets/registry_db_password) docker exec -i coa-postgres-postgres-1 sh -c 'PGPASSWORD=$(cat /run/secrets/postgres_password) exec psql -U coa -d coa -v ON_ERROR_STOP=1 -q' <