Реализована лабораторная 6 на оценку 4

This commit is contained in:
MacBook
2026-11-16 15:16:54 +03:00
parent 470d9d6f1e
commit 4262a16ada
64 changed files with 8467 additions and 43 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
mkdir -p secrets
if [ ! -f secrets/postgres_password ]; then
umask 077
openssl rand -hex 24 > secrets/postgres_password
fi
if [ ! -f secrets/redis_password ]; then
umask 077
openssl rand -hex 24 > secrets/redis_password
fi
postgres_password=$(cat secrets/postgres_password)
redis_password=$(cat secrets/redis_password)
umask 077
printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable\n' "$postgres_password" > secrets/database_url
printf 'redis://:%s@redis:6379/0\n' "$redis_password" > secrets/cache_url
if [ ! -f .env ]; then cp .env.example .env; fi
for secret_name in s3_admin_access s3_admin_secret s3_access_key_id s3_secret_access_key; do
if [ ! -f "secrets/$secret_name" ]; then openssl rand -hex 24 > "secrets/$secret_name"; fi
done
printf '%s\n' 'S3 credentials ready; bucket and policy are bootstrapped by s3-init.'
if [ ! -f secrets/broker_password ]; then openssl rand -hex 24 > secrets/broker_password; fi
broker_password=$(cat secrets/broker_password)
printf 'redis://:%s@broker:6379/0\n' "$broker_password" > secrets/broker_url
if [ ! -f secrets/grafana_admin_password ]; then openssl rand -hex 24 > secrets/grafana_admin_password; fi