chore: add compose stack, restart hook and helper scripts

This commit is contained in:
2026-10-30 01:35:04 +03:00
parent f68710818d
commit df7b8fb701
8 changed files with 206 additions and 2 deletions
+18
View File
@@ -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"