forked from mtusi2026/mtusi2026lab2
chore: add compose stack, restart hook and helper scripts
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p secrets
|
||||
chmod 700 secrets
|
||||
|
||||
if [ ! -f secrets/postgres_password ]; then
|
||||
head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n' > secrets/postgres_password
|
||||
fi
|
||||
password=$(cat secrets/postgres_password)
|
||||
|
||||
[ -f secrets/database_url ] ||
|
||||
printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable\n' "$password" > secrets/database_url
|
||||
[ -f secrets/cache_url ] ||
|
||||
printf 'redis://redis:6379/0\n' > secrets/cache_url
|
||||
|
||||
chmod 644 secrets/postgres_password secrets/database_url secrets/cache_url
|
||||
echo "secrets ready in ./secrets"
|
||||
Reference in New Issue
Block a user