Docs-as-code: full deploy configs, compose stacks, and DR guide
- Add root README and docs/ (architecture, hosts, disaster-recovery, operations) - Add compose/ for superset, forgejo, lam, cadvisor; unified deploy compose - Add scripts/deploy (deploy-atc-docker01.sh, container inventory export) - Add inventory/containers-atc-docker01.json snapshot - Add config READMEs for kafka and airflow; .env.example; expand .gitignore - Sync atclab helper scripts; update homepage/superset compose with env support
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
if [[ -f .env ]]; then
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
echo "==> Homepage + RSS + icons"
|
||||
docker compose -f deploy/docker-compose.homepage.yml up -d --build
|
||||
|
||||
echo "==> Superset + Redis"
|
||||
docker compose -f compose/superset/docker-compose.yaml up -d --build
|
||||
|
||||
echo "==> Forgejo (lokaal)"
|
||||
docker compose -f compose/forgejo/compose.yaml up -d
|
||||
|
||||
echo "==> LAM (lokaal)"
|
||||
docker compose -f compose/lam/compose.yml up -d
|
||||
|
||||
echo "==> Revalidate homepage"
|
||||
docker exec homepage wget -qO- http://127.0.0.1:3000/api/revalidate 2>/dev/null || true
|
||||
|
||||
echo "Done. Open http://atc-docker01.dell-atc.lan/"
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
SKIP_ENV_PREFIXES = (
|
||||
"PATH=", "NODE_", "PYTHON_", "GPG_", "LANG=", "YARN=", "HOSTNAME=",
|
||||
"NGINX_", "NJS_", "ACME_", "DYNPKG_", "PKG_", "CADVISOR_",
|
||||
)
|
||||
|
||||
ids = subprocess.check_output(["docker", "ps", "-aq"], text=True).split()
|
||||
if not ids or ids == [""]:
|
||||
raise SystemExit("no containers")
|
||||
|
||||
raw = subprocess.check_output(["docker", "inspect", *ids])
|
||||
data = json.loads(raw)
|
||||
out = []
|
||||
for c in data:
|
||||
env = [
|
||||
e for e in (c["Config"].get("Env") or [])
|
||||
if not any(e.startswith(p) for p in SKIP_ENV_PREFIXES)
|
||||
]
|
||||
out.append({
|
||||
"name": c["Name"].lstrip("/"),
|
||||
"image": c["Config"]["Image"],
|
||||
"ports": c["NetworkSettings"]["Ports"],
|
||||
"restart": c["HostConfig"]["RestartPolicy"]["Name"],
|
||||
"binds": c["HostConfig"].get("Binds") or [],
|
||||
"volumes": [
|
||||
{"name": m["Name"], "dest": m["Destination"]}
|
||||
for m in c["Mounts"]
|
||||
if m.get("Type") == "volume"
|
||||
],
|
||||
"env": env,
|
||||
})
|
||||
|
||||
with open("/root/lakehouse/inventory/containers-atc-docker01.json", "w") as f:
|
||||
json.dump(out, f, indent=2)
|
||||
print("wrote", len(out), "containers")
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
OUT="$ROOT/inventory/containers-atc-docker01.json"
|
||||
|
||||
python3 "$ROOT/scripts/deploy/export-inventory.py" "$OUT"
|
||||
echo "Wrote $OUT"
|
||||
Reference in New Issue
Block a user