forked from mtusi2026/mtusi2026lab2
Embed the checked lab 5 preparation: RabbitMQ 4.1.8 pinned by digest with a fixed node hostname, a volume, a read-only root and 512 MiB, whose topology (vhost messenger, exchange attachments, quorum queue attachments.process with a dead letter exchange, delivery limit 10 and reject-publish overflow) and users come from definitions imported on every boot. The relay may only write to the exchange, the worker may only read the queue, configure belongs to the operator, there is no guest, and the management UI is published on 127.0.0.1 only. The relay and the worker run from the application image with a heartbeat health check, init, a read-only root and their own limits; the worker gets its own S3 user that reads staging and writes originals and variants, and s3-init creates it idempotently. The API has no broker credentials. make secrets also creates the broker passwords, URLs, hashed users and the worker S3 keys; the restart hook now stops the balancer, the API, the relay and the worker and restarts PostgreSQL, Valkey, S3 and the broker with their volumes; worker.sh and broker.sh stop, start and inspect the processes for the failure demonstrations; the limits policy covers the new services and the loopback UI port. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
16 lines
542 B
Bash
Executable File
16 lines
542 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
defined=$(docker compose config --services)
|
|
pick() {
|
|
for service in $1; do
|
|
if printf '%s\n' "$defined" | grep -qx "$service"; then printf ' %s' "$service"; fi
|
|
done
|
|
}
|
|
apps=$(pick "${APP_SERVICES:-lb api relay worker}")
|
|
stores=$(pick "${STATE_SERVICES:-postgres valkey s3 broker}")
|
|
[ -n "$stores" ] || { echo "no state services found" >&2; exit 3; }
|
|
docker compose stop $apps
|
|
docker compose restart $stores
|
|
docker compose up -d --no-recreate --wait --wait-timeout "${WAIT_TIMEOUT:-75}"
|