forked from mtusi2026/mtusi2026lab3
Добавить compose-стенд с HAProxy и двумя API-репликами
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
|
||||
mkdir -p "$ROOT/secrets"
|
||||
if [ ! -f "$ROOT/secrets/postgres_password" ]; then
|
||||
openssl rand -base64 24 | tr -d '\n' > "$ROOT/secrets/postgres_password"
|
||||
fi
|
||||
PASS=$(cat "$ROOT/secrets/postgres_password")
|
||||
ENC=$(printf '%s' "$PASS" | python3 -c 'import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read(), safe=""))')
|
||||
printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable\n' "$ENC" > "$ROOT/secrets/database_url"
|
||||
printf 'redis://valkey:6379/0\n' > "$ROOT/secrets/cache_url"
|
||||
chmod 644 "$ROOT/secrets/"*
|
||||
echo "secrets ready in $ROOT/secrets"
|
||||
Reference in New Issue
Block a user