Run the broker, the relay and the worker in the stand
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
34741dc2d2
commit
c55fb1b998
+31
-2
@@ -7,7 +7,14 @@ import time
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
S3_CLIENT_SECRETS = ["s3_access_key_id", "s3_root_password", "s3_root_user", "s3_secret_access_key"]
|
||||
S3_CLIENT_SECRETS = [
|
||||
"s3_access_key_id",
|
||||
"s3_root_password",
|
||||
"s3_root_user",
|
||||
"s3_secret_access_key",
|
||||
"s3_worker_access_key_id",
|
||||
"s3_worker_secret_access_key",
|
||||
]
|
||||
POLICY = {
|
||||
"lb": {"secrets": [], "volumes": [], "networks": ["backend", "edge"], "ports": True},
|
||||
"api": {
|
||||
@@ -32,7 +39,29 @@ POLICY = {
|
||||
},
|
||||
"s3-init": {"secrets": S3_CLIENT_SECRETS, "volumes": [], "networks": ["backend"]},
|
||||
"s3-cli": {"secrets": S3_CLIENT_SECRETS, "volumes": [], "networks": ["backend"]},
|
||||
"broker": {
|
||||
"secrets": ["rabbitmq_ops_password", "rabbitmq_users"],
|
||||
"volumes": ["broker-data"],
|
||||
"networks": ["backend", "edge"],
|
||||
"ports": True,
|
||||
},
|
||||
"relay": {
|
||||
"secrets": ["broker_url_api", "database_url", "s3_access_key_id", "s3_secret_access_key"],
|
||||
"volumes": [],
|
||||
"networks": ["backend"],
|
||||
},
|
||||
"worker": {
|
||||
"secrets": [
|
||||
"broker_url_worker",
|
||||
"database_url",
|
||||
"s3_worker_access_key_id",
|
||||
"s3_worker_secret_access_key",
|
||||
],
|
||||
"volumes": [],
|
||||
"networks": ["backend"],
|
||||
},
|
||||
}
|
||||
PUBLISHING = frozenset(name for name, rule in POLICY.items() if rule.get("ports"))
|
||||
|
||||
|
||||
def run(*command):
|
||||
@@ -94,7 +123,7 @@ def running(problems):
|
||||
]
|
||||
if int(cpus) <= 0 or int(memory) <= 0:
|
||||
problems.append(f"container {service}/{host}: no CPU or memory limit applied")
|
||||
if published and service != "lb":
|
||||
if published and service not in PUBLISHING:
|
||||
problems.append(f"container {service}/{host}: publishes {published}")
|
||||
rows.append(
|
||||
[service, host, f"{int(cpus) / 1e9:g}", f"{int(memory) >> 20}MiB", ",".join(published)]
|
||||
|
||||
Reference in New Issue
Block a user