Repository navigation
fix: keep Caddy up across app-only seeder releases - #731
Open
rodrigopavezi wants to merge 2 commits into
Open
rodrigopavezi wants to merge 2 commits into
rodrigopavezi wants to merge 2 commits into
Conversation
On the pull/release path every release recreated the web (Caddy) container, because the web image baked the commit, so every app client dropped with a bare 1006 and nothing held its redial. release.yml now builds a separately pinned, signed varanda-caddy image (rebuilt only when Dockerfile.caddy changes) and records its digest in /app/caddy.json inside the signed seeder image; release.json is unchanged, so installed servers keep accepting releases. In the full profile update.sh runs web from that image, binds the Caddyfile from a content-addressed path and serves www through an atomically swapped link, brings up seeder and account first, and recreates web only when the Caddy digest or the Caddyfile changed. The health gate and rollback are kept; rollback restores the previous Caddy. A release without caddy.json runs in the old mode. deploy.sh now stages the app beside www and merges it file by file with renames (index.html last) instead of emptying www while Caddy serves it.
This branch has not been deployed
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.
O que muda e por quê
Na atualização por imagem (pull), toda versão recriava o Caddy, porque a imagem
webtrazia o commit. Cada recriação derrubava todos os apps com um 1006 seco, sem a espera de discagem do #718. Esta é a etapa P1 da fase B (implantação do semeador sem porta escura).releasepublica a imagem assinadaghcr.io/varanda-org/varanda-caddy(dedeploy/seeder/Dockerfile.caddy, refeita só quando esse arquivo muda) e grava o digest dela em/app/caddy.jsondentro da imagem assinada do semeador. Orelease.jsonnão muda: os servidores instalados conferem esse arquivo com uma expressão exata, e um campo novo os faria recusar toda versão;full, oupdate.shroda owebcom essa imagem, monta oCaddyfilepor um caminho que só muda com o conteúdo e o app pelo link/opt/varanda-release/web, trocado de uma vez;Caddyfilemudou;Caddyfilee o link anteriores;caddy.jsonsegue o modo antigo. Um erro do Docker ao ler o arquivo adia a versão, sem cair no modo antigo;deploy.sh(SSH) monta o app novo ao lado e o troca arquivo a arquivo por rename, comindex.htmlpor último, em vez de esvaziar owwwcom o Caddy servindo. Um passo que falha faz a volta falhar, e um link no caminho nunca é seguido.Este PR mexe em CI e implantação (
release.yml,Dockerfile,update.sh,deploy.sh): quem mantém faz o merge.Antes da segunda versão com
caddy.json, quem mantém precisa tornar público o pacotevaranda-caddy. Sem isso, os servidores não baixam a imagem e ficam na versão atual, tentando a cada ciclo.Limites conhecidos (detalhes em
docs/verification/fix-caddy-stays-up.md):webem paz quando só o diretório da versão muda, nem que o Caddy segue o link/srv/weba cada pedido;caddy.jsoné aplicada peloupdate.shantigo, que recria o Caddy como hoje. A segunda o recria uma última vez, porque os binds mudam. Daí em diante ele fica de pé;wwwficou atômica;/opt/varanda-releaseinteiro, só leitura. São os pacotes públicos das versões; os segredos ficam em/var/lib/varanda-update;Issue
Closes # (não há issue aberta para este problema)
Como verificar
Checklist
npm run lint,npm test(ounpm test -- --affected=origin/main) enpm run demopassamdocs/changelog/<branch>.mde verificação emdocs/verification/<branch>.md, se houver, sem editar o CHANGELOG.md nem acrescentar seção ao docs/verification.md