Files
mtusi2026lab6/scripts/secrets.sh
Artyom 12db77133f Forward the lab 5 foundation while preserving lab 6 telemetry
Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files.

Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
2026-11-06 12:29:35 +03:00

27 lines
973 B
Bash
Executable File

#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
umask 077
mkdir -p secrets
random() { od -An -N32 -tx1 /dev/urandom | tr -d ' \n'; }
put() {
if [ ! -s "secrets/$1" ]; then
printf '%s' "$2" > "secrets/$1"
chmod 644 "secrets/$1"
echo "создан secrets/$1"
fi
}
put postgres_password "$(random)"
put database_url "postgresql://messenger:$(cat secrets/postgres_password)@postgres:5432/messenger"
put cursor_secret "$(random)"
put valkey_password "$(random)"
put valkey.conf "requirepass $(cat secrets/valkey_password)"
put cache_url "redis://:$(cat secrets/valkey_password)@valkey:6379/0"
put s3_root_user "root$(random | cut -c1-16)"
put s3_root_password "$(random)"
put s3_access_key_id "api$(random | cut -c1-16)"
put s3_secret_access_key "$(random)"
put s3_reconciler_access_key_id "rec$(random | cut -c1-16)"
put s3_reconciler_secret_access_key "$(random)"
[ -f .env ] || { cp .env.example .env; echo "создан .env из .env.example"; }