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

This commit is contained in:
MacBook
2026-11-03 14:05:38 +03:00
parent 276dbdad8a
commit 9db2fa724a
41 changed files with 4267 additions and 37 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/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