2.1 KiB
GuestOps deployment
GuestOps is deployed by the central Futuresens Ansible repository. Sandbox is
https://guestops-sandbox.futuresens.co.uk and production is
https://guestops.futuresens.co.uk.
Prepare a version
The .NET version in Directory.Build.props and the frontend version in
web/package.json must match. Test the committed revision, then package it:
dotnet run --project tests/GuestOps.Tests
python3 -m unittest discover -s tests -p "test_*.py"
cd web && npm ci && npm run build && cd ..
python3 deploy/package_source.py \
--ref FULL_COMMIT_OR_TAG \
--output-directory ../ansible/playbooks/files/guestops
For version 0.2.1, this creates guestops_0.2.1.tar.gz. Published version
files are immutable; change the application version before making another
archive.
Configure Ansible
The server group needs only the application switch, version and subdomain:
hasguestops: true
guestopsversion: "0.2.1"
guestopssubdomain: "guestops-sandbox"
Production uses guestopssubdomain: "guestops". Runtime credentials and the
MongoDB connection string belong in encrypted Ansible Vault data. The MongoDB
URI must use a least-privilege guestops database user and an address reachable
from Docker containers.
Deploy
Deploy sandbox first:
ansible-playbook playbooks/guestops.yml -K --ask-vault-pass \
--extra-vars "thehost=sandbox"
After acceptance, deploy the same versioned archive to production:
ansible-playbook playbooks/guestops.yml -K --ask-vault-pass \
--extra-vars "thehost=dbserver"
The playbook stops the existing Compose project without deleting volumes,
replaces /srv/guestops, renders private configuration, builds and starts the
API and worker, configures Nginx, and verifies local and public readiness. Port
8080 remains loopback-only and the guestops_app-keys volume survives
redeployment.
To roll back, select an older retained guestopsversion in group vars and run
the same playbook. MongoDB backup, Filebeat, certificates, and host monitoring
are provided by the existing central infrastructure.