Prepare database-free BortStack deployment
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Check the public deployment topology without starting containers."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
env = os.environ.copy()
|
||||
env["APP_ENV_FILE"] = str(ROOT / ".env.example")
|
||||
result = subprocess.run(
|
||||
["docker", "compose", "--env-file", str(ROOT / ".env.example"),
|
||||
"config", "--format", "json"],
|
||||
cwd=ROOT, env=env, check=True, capture_output=True, text=True,
|
||||
)
|
||||
config = json.loads(result.stdout)
|
||||
services = config["services"]
|
||||
assert set(services) == {"api", "nginx"}, sorted(services)
|
||||
assert not config.get("volumes"), "Production topology must not require a database volume"
|
||||
api = services["api"]
|
||||
web = services["nginx"]
|
||||
assert api.get("environment", {}).get("EMAIL_DELIVERY_ENABLED") == "false"
|
||||
assert api["environment"]["CONTACT_TRUST_PROXY"] == "true"
|
||||
assert not api.get("depends_on"), "Contact must have no database dependency"
|
||||
assert web["depends_on"]["api"]["condition"] == "service_healthy"
|
||||
assert "api/health/ready" in " ".join(api["healthcheck"]["test"])
|
||||
assert config["networks"]["swag"]["external"] is True
|
||||
assert "swag" in web["networks"]
|
||||
assert "swag" not in api["networks"]
|
||||
assert config["networks"]["internal"]["internal"] is True
|
||||
assert "internal" in api["networks"] and "internal" in web["networks"]
|
||||
assert all(port["host_ip"] == "127.0.0.1" for service in (api, web)
|
||||
for port in service["ports"]), "Diagnostic ports must bind to loopback"
|
||||
assert "contact_app:app" in (ROOT / "api" / "Dockerfile").read_text()
|
||||
print("Database-free Contact deployment topology: OK")
|
||||
Reference in New Issue
Block a user