89 lines
5.1 KiB
Markdown
89 lines
5.1 KiB
Markdown
# Deployment plan — not commissioned
|
|
|
|
BS-009 prepares a database-free marketing deployment. No server, DNS, mail
|
|
provider or production GitHub environment has been changed by this task. Launch
|
|
still requires the Captain's explicit authorization and the gates below.
|
|
|
|
## Topology
|
|
|
|
Docker Compose runs two services. `nginx` serves the prerendered React build and
|
|
proxies `/api/` to the private `api` service. The API image starts
|
|
`contact_app:app` under Gunicorn; it has no account routes, SQLAlchemy startup,
|
|
database, migration or persistent enquiry store. The existing LinuxServer SWAG
|
|
instance should terminate public TLS and reach `nginx:80` over the external
|
|
network named by `SWAG_NETWORK` (default `swagnet`). The API is on the internal
|
|
network only. Port 8081 (web) and 5001 (API) bind to host loopback for local
|
|
diagnostics. No public hostname has been confirmed.
|
|
|
|
`/api/health/ready` confirms that the Contact process can serve requests; it
|
|
does **not** confirm email configuration, provider delivery or inbox receipt.
|
|
`/api/contact/config` reports whether the configured mail settings are present;
|
|
that is not a provider or inbox test. The sample environment disables mail and
|
|
leaves sender, recipient and API key blank. Contact responds with 503 when
|
|
delivery is disabled or unconfigured.
|
|
|
|
## Server and GitHub prerequisites
|
|
|
|
- Docker Engine with Compose and an existing SWAG stack on the configured
|
|
external network; validate the final SWAG proxy configuration and TLS.
|
|
- A clean `production` branch checkout at `PRODUCTION_DEPLOY_PATH`, a readable
|
|
external mode-600 environment file at `PRODUCTION_ENV_PATH`, and a deployment
|
|
user with Docker and GHCR pull access.
|
|
- GitHub Actions secrets `PRODUCTION_SSH_HOST`, `PRODUCTION_SSH_USER`,
|
|
`PRODUCTION_SSH_PRIVATE_KEY`, `PRODUCTION_SSH_KNOWN_HOSTS`; variables
|
|
`PRODUCTION_DEPLOY_PATH`, `PRODUCTION_ENV_PATH`, `PRODUCTION_PUBLIC_URL`.
|
|
Confirm the public URL before enabling this path.
|
|
|
|
The current workflow runs on `production` pushes and manual dispatch, publishes
|
|
commit-tagged API/nginx images, fast-forwards a clean server checkout, pulls and
|
|
starts the two services, then probes the loopback web endpoint and public Contact
|
|
readiness. Protect the branch and `production` environment before using that
|
|
trigger. The workflow is **configured**, not evidence of a successful release.
|
|
It does not perform automatic rollback.
|
|
|
|
## Commissioning sequence
|
|
|
|
1. Confirm the public hostname, SWAG network/proxy configuration, host capacity,
|
|
firewall, GHCR access, TLS and external environment file. Use `.env.example`
|
|
only as a variable reference; keep real settings and secrets outside Git.
|
|
2. With mail disabled, validate
|
|
`APP_ENV_FILE=/path/to/env docker compose --env-file /path/to/env config --quiet`
|
|
and `python3 scripts/check-deployment-config.py` in a checkout containing
|
|
the candidate. The script validates the safe example topology, not the
|
|
server's secrets or connectivity.
|
|
3. On a separately authorized deployment, start `api` and `nginx` using the
|
|
tested images. Probe `/`, a known static route, an unknown route, local
|
|
`/api/health/ready`, public `/api/health/ready`, and
|
|
`/api/contact/config`. Confirm an unconfigured submission cannot report
|
|
success. Check container health and logs without recording visitor data.
|
|
4. Before enabling delivery, verify a BortStack sender/domain with Resend,
|
|
verify the intended recipient mailbox and incoming routing, configure
|
|
credentials outside Git, then make a controlled enquiry and confirm inbox
|
|
receipt and visitor Reply-To. Provider acceptance alone is insufficient.
|
|
5. Complete privacy/legal, authentic media, domain/SEO, backup/retention and
|
|
production readiness review. Record the deployed commit/image tags and
|
|
operator observations. Captain acceptance and launch authority remain
|
|
separate from CI checks.
|
|
|
|
Do not copy inherited account/MySQL keys from an old deployment file. Existing
|
|
MySQL containers or volumes from an earlier stack require a separate inventory
|
|
and explicit disposal plan; changing Compose does not authorize deleting them.
|
|
|
|
## Operations and rollback
|
|
|
|
Gunicorn defaults to one worker because Contact's attempt limits are held in
|
|
process memory (5/hour and 20/day per perceived IP). Multiple workers or
|
|
replicas require a shared limiter before scaling. Nginx forwards one proxy hop
|
|
to Contact; verify the real client IP through the actual SWAG chain before
|
|
enabling public submissions. A shared proxy IP can cause unrelated visitors to
|
|
share the limit. Do not trust arbitrary incoming forwarding headers. The
|
|
sample SWAG config is a starting point, not a verified host configuration.
|
|
|
|
Logs are container output; define host retention, monitoring and recovery
|
|
procedures before launch. There is no application database to back up, but
|
|
mailbox records, server configuration and external service recovery still need
|
|
an operator plan. For rollback, retain the previous verified commit and image
|
|
tags, restore their clean checkout and external image overrides, validate
|
|
Compose, restart the two services and repeat probes. Do not delete resources
|
|
or assume that a successful health probe proves mail delivery.
|