Completed for a grade of three
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Creates local secrets for the Compose stack. Never overwrites an existing secret:
|
||||
# the PostgreSQL volume is initialised with the first password and keeps it.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mkdir -p secrets
|
||||
|
||||
if [ ! -s secrets/db_password ]; then
|
||||
# Readable by the non-root users inside the api/postgres containers (bind-mounted as is).
|
||||
umask 022
|
||||
openssl rand -hex 24 > secrets/db_password
|
||||
echo "created secrets/db_password"
|
||||
else
|
||||
echo "secrets/db_password already exists, keeping it"
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Restarts the API and PostgreSQL, keeping the named volume (no `down -v`, no re-seed).
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
docker compose stop api postgres
|
||||
docker compose up -d --wait postgres api
|
||||
Reference in New Issue
Block a user