2.7 KiB
GuestOps deployment
GuestOps is deployed by the central Futuresens Ansible repository. Sandbox is
https://sandbox-guestops.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_release.py \
--ref FULL_COMMIT_OR_TAG \
--output-directory ../ansible/playbooks/files/guestops
For version 0.2.2, this creates guestops_0.2.2.tar.gz. The archive contains
self-contained Linux x64 API and worker applications, including the built
frontend. 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.2"
guestopssubdomain: "sandbox-guestops"
Production uses guestopssubdomain: "guestops". The native services use the
existing MongoDB service on 127.0.0.1:27017. Google sending,
automatic live replies, AI, PMS connections, and payment connections remain
disabled until they are configured separately.
Deploy
Deploy sandbox first:
ansible-playbook playbooks/guestops.yml -K \
--extra-vars "thehost=sandbox"
After acceptance, deploy the same versioned archive to production:
ansible-playbook playbooks/guestops.yml -K \
--extra-vars "thehost=dbserver"
The playbook stops the existing systemd services, replaces /srv/guestops,
renders its environment configuration, starts the self-contained API and worker,
and manages its Nginx site. It serves HTTP before the certificate exists and
switches the site to HTTPS after Certbot has created the certificate. Port 8080
remains loopback-only and /var/lib/guestops/keys survives redeployment.
On the first deployment, create the certificate after the HTTP site is available:
sudo certbot --nginx \
-d sandbox-guestops.futuresens.co.uk \
--non-interactive \
--agree-tos \
-m dmccallum@futuresens.co.uk \
--redirect
For production, use -d guestops.futuresens.co.uk. Certbot obtains and renews the
certificate. Rerun the GuestOps playbook after initial certificate creation so
Ansible writes the final HTTPS proxy configuration.
To roll back, select an older retained native guestopsversion (version 0.2.2 or
later) in group vars and run the same playbook. MongoDB backup, Filebeat, certificate
renewal, and host monitoring are provided by the existing central infrastructure.