Repository navigation
fix(deploy): make deployment portable across servers - #61
Closed
ArnavBallinCode wants to merge 1 commit into
Closed
ArnavBallinCode wants to merge 1 commit into
ArnavBallinCode wants to merge 1 commit into
Conversation
Production is moving to a server shared with another app. Remove the assumptions that tie deploys to the current host: - Deploy from $HOME/voxbento (VOXBENTO_DIR overrides) instead of /home/ubuntu/voxbento. - PORTAL_HOST_PORT (default 8000) sets the portal's host port, the deploy health check and the Caddy upstream. - MediaMTX WebRTC host candidates come from MEDIAMTX_PUBLIC_HOSTS, defaulting to JVB_ADVERTISE_IPS, instead of an IP in mediamtx.yml. - The repo Caddyfile is installed as /etc/caddy/sites/voxbento.caddy, imported by the host's main Caddyfile, so other apps keep their sites. The first deploy migrates the old layout once, the whole host config is validated before reload, and files are restored if it is invalid. - Untracked Compose overrides listed in COMPOSE_FILE reach the candidate worktree. - Image pruning is limited to the voxbento Compose project.
Owner
Author
|
Opened upstream instead: fossasia#1347 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Production is moving from AWS to an Azure VM that already runs another app. That app uses host port 8000 and may get its own Caddy site. The deploy workflow assumes it owns the whole server, so pointing it at the new host would fail the health check or route voxbento.com to the other app. This PR removes those assumptions. It changes nothing on the current server beyond a one-time Caddy layout move (details below).
Changes
$HOME/voxbento, overridable withVOXBENTO_DIR, instead of the hardcoded/home/ubuntu/voxbento. This is the same path on the current server.PORTAL_HOST_PORT(default8000) sets the portal's host port indocker-compose.yml, the deploy health check and the Caddy upstream. Containers still useportal:8000. A non-numeric value stops the deploy before it builds anything.MTX_WEBRTCADDITIONALHOSTSis built fromMEDIAMTX_PUBLIC_HOSTS, falling back toJVB_ADVERTISE_IPS. The server IP is no longer hardcoded inmediamtx.yml. Production already setsJVB_ADVERTISE_IPSto its public IP, so its candidates stay the same, except that thevoxbento.comhostname candidate is dropped. That name resolves to Cloudflare, so the candidate couldn't carry media anyway.Caddyfilenow holds only VoxBento's sites. Deploys install it as/etc/caddy/sites/voxbento.caddy, and the main/etc/caddy/Caddyfilecontainsimport /etc/caddy/sites/*.caddy.Caddyfile.before-sitesand replaces it with the import line.COMPOSE_FILEbut not tracked in Git are copied into the candidate worktree. Before this,compose configfailed for them.docker image pruneis limited to images labelledcom.docker.compose.project=voxbento, so images belonging to other apps on the host are kept..env.example, theCaddyfileheader andwebsite/docs/configuration/deployment.mdx.First deploy on the current server
No
.envchanges are needed:PORTAL_HOST_PORTdefaults to 8000 andJVB_ADVERTISE_IPSis already set. The main Caddyfile there starts with the expected header, so it is moved to the new layout once, with a backup kept as/etc/caddy/Caddyfile.before-sites. Sentinel's snippet under/etc/caddy/voxbento-routes/is still imported inside thevoxbento.comsite.Testing
tests/test_deploy_workflow.py: the existing tests were updated, and new ones cover the custom host port (health check and rendered Caddy upstream), an invalid port, host-local overrides, the old-layout migration, a main file VoxBento didn't write, restoring files after a failed host validation, and the MediaMTX env wiring. 16 passed.tests/test_config.py,tests/test_program_ingest_media.pyandtests/test_proxy_trust.py(the other tests that read these files) pass: 42 passed, 1 skipped in total.docker compose configwas checked with no variables set, with onlyJVB_ADVERTISE_IPS, and withMEDIAMTX_PUBLIC_HOSTSplusPORTAL_HOST_PORT=8001.Created with Claude Opus 5.5 in Claude Code, run from T3 Code.