20 lines
636 B
Bash
Executable File
20 lines
636 B
Bash
Executable File
#!/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
|
|
|
|
# Readable by the non-root users inside the containers (bind-mounted as is).
|
|
umask 022
|
|
|
|
for name in db_password redis_password s3_access_key_id s3_secret_access_key s3_api_access_key_id s3_api_secret_access_key; do
|
|
if [ ! -s "secrets/$name" ]; then
|
|
openssl rand -hex 24 > "secrets/$name"
|
|
echo "created secrets/$name"
|
|
else
|
|
echo "secrets/$name already exists, keeping it"
|
|
fi
|
|
done
|