From 6f8061644dedad16ff52de2732daeb56aa2d37f5 Mon Sep 17 00:00:00 2001 From: Asger Geel Weirsoee Date: Fri, 27 Feb 2026 20:01:08 +0100 Subject: [PATCH] devops: add staging deploy runbook and release policy (refs #20 #23) --- docs/RELEASE_POLICY.md | 4 ++++ infra/staging/README.md | 4 ++++ infra/staging/deploy_staging.sh | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 docs/RELEASE_POLICY.md create mode 100644 infra/staging/README.md create mode 100755 infra/staging/deploy_staging.sh diff --git a/docs/RELEASE_POLICY.md b/docs/RELEASE_POLICY.md new file mode 100644 index 0000000..675765c --- /dev/null +++ b/docs/RELEASE_POLICY.md @@ -0,0 +1,4 @@ +Release policy issue 23 +- Tag only after successful deploy +- Changelog reference required +- No deploy while tester active diff --git a/infra/staging/README.md b/infra/staging/README.md new file mode 100644 index 0000000..af826b6 --- /dev/null +++ b/infra/staging/README.md @@ -0,0 +1,4 @@ +Staging runbook issue 20 +CT 143 wpp-staging +Service: wpp-staging.service +Health: /healthz diff --git a/infra/staging/deploy_staging.sh b/infra/staging/deploy_staging.sh new file mode 100755 index 0000000..22740d0 --- /dev/null +++ b/infra/staging/deploy_staging.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail +CT_ID="143" +ARCHIVE_URL="https://gitea.weircon.dk/wpp/weirsoe-party-protocol/archive/main.tar.gz" +sudo -n pct exec "" -- bash -lc "set -euo pipefail; mkdir -p /opt/wpp-staging/releases/src; cd /opt/wpp-staging/releases; curl -fsSL -o main.tar.gz ; rm -rf src && mkdir src; tar -xzf main.tar.gz -C src --strip-components=1; rm -rf /opt/wpp-staging/app/*; cp -a src/. /opt/wpp-staging/app/; cd /opt/wpp-staging/app; runuser -u wpp -- python3 -m venv .venv; runuser -u wpp -- .venv/bin/pip install -U pip >/dev/null; runuser -u wpp -- .venv/bin/pip install -r requirements.txt >/dev/null; runuser -u wpp -- .venv/bin/python manage.py migrate --noinput; systemctl restart wpp-staging.service; curl -fsS http://127.0.0.1:8000/healthz" +echo "OK: staging deploy complete for CT ." -- 2.39.5