forked from unimatrix/web
69 lines
3.7 KiB
Markdown
69 lines
3.7 KiB
Markdown
# Migrated web deployment
|
|
|
|
## Canonical website source after the repository split
|
|
|
|
The trigger and staging builder fetch `refs/heads/main` explicitly from
|
|
`https://www.dunerealms.com/git/unimatrix/web.git`. They do not trust the
|
|
historical checkout's configured `origin`. The checkout is an object store for
|
|
the approved commit: a divergent worktree HEAD must not be reset or copied live.
|
|
Both scripts compare the requested commit with the freshly fetched canonical
|
|
main before queueing or building it.
|
|
|
|
The staging archive includes `website`, the documentation-only `tools` directory
|
|
and the web-only `.forgejo` checks/workflows, so the same repository-policy tests
|
|
run in CI and staging. No plugin source is included.
|
|
|
|
The website build packages these two scripts in `dist/deployment`, with a
|
|
manifest recording repository, source commit, byte sizes and SHA256 hashes.
|
|
CI uploads the tested package as `DuneRealms-Website-Operations`. Any necessary
|
|
bootstrap installation must use that exact built package, verify its manifest
|
|
and expected tested commit, and install only the two existing script targets:
|
|
`/usr/local/bin/dunerealms-ci-trigger` and
|
|
`/usr/local/bin/dunerealms-build-release`. Record installed hashes and the CI
|
|
reference. Do not install scripts from a dirty worktree or publish handwritten
|
|
live fixes. Normal website publication remains main-only through CI.
|
|
|
|
The production website is hosted at `91.107.196.242`. The Forgejo Actions
|
|
workflow pins that host's SSH key and can trigger deployment only from `main`.
|
|
Its deploy key is restricted to `/usr/local/bin/dunerealms-ci-trigger`, which
|
|
rejects commits that do not match the current main branch.
|
|
|
|
Forgejo, repositories, artifact storage, the rootless runner, container data,
|
|
build workspaces and deployment state use `/mnt/HC_Volume_107481500/dunegit`.
|
|
Compatibility links preserve the existing application and home-directory paths.
|
|
The volume is part of the live service and must remain attached. The services
|
|
require its mount before starting, rather than writing to an empty mountpoint.
|
|
|
|
`promote-safe-v3.py` is installed as
|
|
`/usr/local/sbin/dunerealms-promote-safe-v3`. It prepares an immutable release,
|
|
checks a candidate website and panel, updates their shared nginx configuration,
|
|
checks public readiness, and restores the previous routing if that check fails.
|
|
Retired background workers are stopped and the active process list is saved.
|
|
|
|
The first successful promotion retires the migrated baseline systemd website
|
|
services. Subsequent candidates are supervised by `dunerealms-runtime.service`.
|
|
The separate Forgejo service remains `dunegit.service`.
|
|
|
|
Run the promoter routing checks with:
|
|
|
|
```sh
|
|
python3 -m unittest discover -s website/ops -p 'test_*.py'
|
|
```
|
|
|
|
## CI artifact retention
|
|
|
|
Feature CI runs build and test without uploading the website artifact. Main
|
|
publications keep their current artifact with a one-day expiry as a fallback.
|
|
`prune-ci-artifacts.mjs` runs after the asynchronous deploy trigger and waits
|
|
for `/ci-build.json` to report the exact CI commit. Only then can it remove
|
|
older `DuneRealms-Website` artifacts belonging to completed runs. It preserves
|
|
the current build, newer artifacts, running jobs, and all other artifact names.
|
|
A changed live commit stops deletion. Failed or unconfirmed deployment leaves
|
|
previous artifacts available. Cleanup errors are warnings and do not turn an
|
|
already successful publication into a failed deployment.
|
|
|
|
Forgejo removes the corresponding physical chunks through its existing
|
|
`cleanup_actions` maintenance task; deleting API records need not immediately
|
|
increase free disk space. Deployed application releases and their rollback
|
|
retention are separate from CI artifact retention. No backups or Git history
|
|
are removed by this policy.
|

Staff