[+] Completed lab 4

This commit is contained in:
Антон Архипов
2026-11-16 16:23:32 +03:00
parent ec540a1a72
commit 06f0a9f31e
60 changed files with 7160 additions and 53 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
if [ -e .env ]; then
printf '%s\n' 'Using existing .env'
exit 0
fi
umask 077
set -C
pg_password=$(python3 -c 'import secrets; print(secrets.token_hex(24))')
s3_access_key=$(python3 -c 'import secrets; print(secrets.token_hex(15))')
s3_secret_key=$(python3 -c 'import secrets; print(secrets.token_hex(32))')
sed -e "s/^POSTGRES_PASSWORD=$/POSTGRES_PASSWORD=$pg_password/" \
-e "s/^S3_ACCESS_KEY_ID=$/S3_ACCESS_KEY_ID=$s3_access_key/" \
-e "s/^S3_SECRET_ACCESS_KEY=$/S3_SECRET_ACCESS_KEY=$s3_secret_key/" .env.example > .env
printf '%s\n' 'Created .env for the local stand'
Executable → Regular
View File
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
docker compose ps
docker compose down
docker compose up -d --no-build --wait --wait-timeout 55
docker compose ps
Executable → Regular
View File
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
case "${TARGET_INSTANCE_ID:-}" in
api-a|api-b) service=$TARGET_INSTANCE_ID ;;
*) printf '%s\n' 'TARGET_INSTANCE_ID must be api-a or api-b' >&2; exit 2 ;;
esac
docker compose stop -t 5 "$service"
docker compose ps --all "$service"