Repository navigation
Stacks and environments, milestone 2: environments in the repo - #124
Open
davidjalbers wants to merge 100 commits into
Open
davidjalbers wants to merge 100 commits into
davidjalbers wants to merge 100 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… file Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… compose file Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… version as they were A run on a host that carries a deployment and the routes the earlier version rendered, with plexus_apps still set: it says the variable is no longer read, changes none of the deployment's files nor apps.caddy, runs no docker command, and the route still answers. Red: the roles still read the records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The roles apps and secrets go, and with them every per-deployment task: no directory, .env, .env.secret or docker compose up from the records. ingress renders no routes any more; the root Caddyfile imports the apps.caddy earlier versions rendered for as long as it is there, by its absolute path, so the root is validated as a whole before it replaces the one in place. A host that still sets plexus_apps is told the variable is no longer read. The registry login of the deploy user moves to deploy_user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a host without records: /opt/stacks is the deploy user's, the deploy user writes a route fragment that the proxy serves after a reload, and a second run changes nothing. Red: no deploy root, no fragment directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oute fragments deploy_user creates /opt/stacks (plexus_deploy_root) owned by the deploy user, 0750; the test now expects that mode. ingress creates ingress_fragments_dir, /etc/caddy/stacks, owned by the deploy user, and the root Caddyfile imports every *.caddy in it. Neither recurses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…else As the deploy user, sudo -n /usr/bin/systemctl reload caddy reloads the proxy with a changed fragment; sudo lists one rule; restart, another unit, extra arguments, another target user and a shell are refused; the host's sudo rules pass visudo -c. Red: there is no rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ingress writes /etc/sudoers.d/reload-caddy, validated with visudo -cf: <deploy user> ALL=(root) NOPASSWD: /usr/bin/systemctl reload caddy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he root
A fragment of the form <hostname> { import stack <port> } reaches the
stack on its loopback port, /healthz is refused although the stack
answers it, and a port where nothing answers gets the maintenance page.
Red: the root configuration defines no snippet stack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and port
The snippet stack encodes, refuses /healthz, proxies to 127.0.0.1 on the
port it is given, and serves the maintenance page while the stack does
not answer; a fragment is <hostname> { import stack <port> }. The
maintenance page's variables get their defaults in the role's defaults.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fragment beside apps.caddy is served with the old routes; one for a hostname apps.caddy still serves is refused by the proxy, which goes on serving the old route; once the block is out of apps.caddy the hostname moves to its fragment; once apps.caddy is deleted, reloads work before and after the next platform run. Red: the root imports apps.caddy by its path, and a reload fails once it is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…only .env covers them Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ed by env alone Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s are findings Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…orm's names refused, compose file names stated once Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…latform run Caddy refuses a missing import path but imports nothing for a pattern that matches no file, so the root imports /etc/caddy/apps*.caddy where apps.caddy was there when the root was written. The role's header names what the stack playbook uses (the fragment directory and form, the snippet stack, the reload rule and how a reload fails) and how old routes and fragments coexist while a host migrates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bind no port Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hostname needs one Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mes are not also reported missing Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…atform names are reported once Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…epo is Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… update lands on it Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A repo's kind no longer decides the branch: it is read from origin/HEAD of the checkout, else from origin's own HEAD, and a repo with neither is skipped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ates the file at the cut Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y and the vault token as repository secrets The workflows hand setup DEPLOY_SSH_KEY and the step of plx deploy DEPLOY_VAULT_TOKEN as its OP_SERVICE_ACCOUNT_TOKEN; the CI vault's token reaches setup only to join the overlay. repo-operations renders no plexus_apps, plexus_up or plexus_deploy_root, and names no tag the platform playbook dropped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eploy, with host, hostname, env and secrets Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r environment files, with the deploy key a secret of the repo The stand-in playbook takes its host from the file, setup reads nothing from the vault, and the verb has no inventory. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ch the doctor passes as born Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eploy: host, hostname, env and secrets Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…onment file, with no inventory Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ent files, as the doctor asks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mpty or does not answer An environment whose last secret is dropped deploys, under --check too: .env.secret stays, empty and 0600, the services that loaded it are re-created, and a second run changes nothing. A value the vault holds empty is refused, naming the pointer; a read that does not answer within stack_secret_timeout is refused, naming the usual cause, and leaves no op running. The vault CLI's stand-in waits for a pointer ending in /locked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et, and gives op read a timeout The template lookup gives none rather than an empty string for an environment without secrets, so writing .env.secret after the last secret was dropped failed, and the dry run's undo failed with it: the text is now an empty string, and a dry run, which wrote nothing, undoes nothing. Each op read runs under the Python that runs Ansible, which kills op after stack_secret_timeout seconds (30) and says that it mostly waits for an unlock nobody answers; a value the vault holds empty is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…with a line break A run given --limit, --tags or --skip-tags fails with a Result line that says the playbook takes none of them, since each leaves out the deploy or the line that says how it ended. A host or a hostname whose text ends in a line break is refused with the environment's file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing in a line break Every task is tagged always, so that the first, a check of the arguments, runs under --tags too, and refuses a --limit, --tags or --skip-tags with a Result line: each would leave out the deploy, or the line that says how it ended. The forms of host and hostname end in \Z, where $ let a trailing line break pass, and the route script's arguments are quoted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ostname of an earlier version's routes The prepared host carries a route of an earlier version in apps.caddy, as a host in migration does. A new environment claiming its hostname ends refused with the proxy's own reason, its fragment gone and nothing else written; an environment whose fragment changes to it ends with the fragment as it was. A port of the range that something on the host listens on is skipped. A fragment that does not parse gives caddy validate's reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…proxy refused A new port skips every port in state LISTEN that /proc/net/tcp and /proc/net/tcp6 list, which every Linux host has, so that a first deploy does not claim a port it cannot bind and keep it for good. Where the proxy refuses the reload, the line gives the error of caddy validate, which the deploy user can run, instead of a cause the script does not know; where that says nothing, only that the proxy refused. A host without flock is told so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… what its caller must know deploy_user_root, in the role deploy_user's vars, which no inventory overrides, is the one place /opt/stacks is written: the role's task uses it, and the stack playbook reads the file for stack_root's default, which -e still overrides. The header says that the caller passes no -i, --limit, --tags or --skip-tags, and which runs of no task Ansible ends with exit 0 and no Result line; that PLEXUS_TAG and PLEXUS_COMMIT_SHA are rendered into the compose file by the caller; that .env.secret ends empty once the environment has no secrets, and .env.secret.prev keeps the previous ones; and step 3 points at the route script's header instead of repeating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut whose path has a space and an = Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the loader's refusal as it wrote it and names the missing vault secret in CI Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e requirement was removed Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…is told the requirement was removed; the index names neither Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… update Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…dded by an update Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…irth renders both Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… none to a stack born without them Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…from an update, and one a person wrote stays Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…o davidjalbers/plx-299-plx-deploy-plx-ci-setup-and-the
…failure Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… runs Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d requirements are listed by module and suffix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y-plx-ci-setup-and-the plx deploy, plx-ci setup and the templates read environment files (PLX-299, with PLX-298)
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.
Milestone 2 of the project "Stacks and environments": an environment of a stack is a file in its repo,
<stack>/<environment>.yaml, andplx deployhands it to the stack playbook, which does everything that environment needs on its host.It goes with compendium#27, which holds the pages.
Important
What merging starts.
Nothing deploys and nothing is published by the merge.
The next step is yours:
mise ship, after both pull requests are merged, cuts the version that carries this.That version is breaking for every consumer, in an order that matters: each host runs the new platform playbook once before any repo on it takes the version, and each repo needs its environment files and two repository secrets before its first deploy.
The update's pull request stays green and says "Nothing needs a hand" in a repo that has neither.
The release notes are drafted in a comment on PLX-300.
What it holds
libreads environment files;plx doctorchecks them against each other and against the compose file.plx updatelands a version on the default branch the origin names.plx deploy,plx-ci setupand the templates read environment files; the inventory flag and the second repo's token are gone.PLX-298 had no pull request of its own: its branch alone could not pass the whole verify, since the deploy verb's test called the playbook by its old interface, so PLX-299 was stacked on it and each was reviewed by its own range of commits.
To know before merging
shipregeneratespackages/lib/src/standard-index.jsonfrom the compendium; during the milestone, names were appended and removed by hand.birth-only: a path is written only when its directory is born. A stack's environment files use it.DEPLOY_SSH_KEYandDEPLOY_VAULT_TOKEN; creating a vault service account and setting them is yours.plexus.platform's stack playbook resolvesop://pointers where it runs, soopmust be on the PATH of whoever deploys.Decided by the maintainer during the milestone
hostis an SSH destination,[user@]address[:port].env_fileonly; the compose file is never interpolated with one.plx updatelands a version on the repo's default branch.The Decisions document still lacks these four.
Open with you, work done under my suggestion:
094289: environment files are born with a stack and never added byplx update.19c899: PLX-329, the compendium's pass, is still in Triage although its pull request is merged into the compendium'sstacks-2.79ac91:PLX-Stack/Deploysaysmigrateruns on every deploy; the playbook runs it only where the compose file changed.Readings made without the maintainer, to confirm or correct
Environment files and
plx doctor(PLX-296):[a-z]+);composeis no name, and a file<name>.ymlis refused.hostis required;envandsecretsmay be absent and read as empty; values underenvare strings.Bin${A:-${B}}.The platform playbook (PLX-297):
/healthzis a convention of the fragment's shape: it lives in the root's snippet, and a fragment that does not import it escapes it./opt/stacksis 0750 and the deploy user's;plexus_deploy_rootis no longer read, and a host that sets another path is told so.plexus_appsis shown only where it holds records, and the run continues./etc/caddy/tenantsis dropped.The update (PLX-327):
main.The stack playbook (PLX-298; numbers in brackets are those of #121's body):
.envfiles count as taken, and so does any port something on the host listens on, which goes beyond the issue's wording (2, 3, 18)..envand.env.secret, so the port stays claimed (5)..env.secretends empty at 0600 when the last secret goes (6); the previous files are kept as.env.prev,.env.secret.prevandcompose.yaml.prev(13), so a removed secret's last value stays on the host until.env.secretchanges again.hostnameis a DNS name, lowercased, with no wildcard and no port (8).plexus_deploy_userdefaults toplexus; a deploy user with another name is written into each file'shost(9)..env, and its fragment stays (16).op readis stopped after 30 seconds (20).--limit,--tagsand--skip-tags(22).The deploy verb and the templates (PLX-299):
plx deploystep alone, and the step clears the Connect variables, which 1Password documents as taking precedence over a service account token.GITHUB_ACTIONS=true.{{or{%is refused, since Ansible would template it.stacktemplate rendersproduction.yamlandstaging.yamlby those literal names; milestone 3's declared environments replace them.Known and recorded, not fixed
stacktemplate; two literal/opt/stacks;route.shdiscards sudo's own error, so a missing sudo rule reads as "the proxy refused".--limitwithout localhost,--skip-tags always) exits 0 without a result line; the deploy verb reports that as failed.PLEXUS_COMMIT_SHAis still delivered to the stack at run time; the decisions of milestone 3 remove it.{{refusal, the list of removed names) was read by the coordinator and not by the reviewer.Not tried
opCLI, real repository secrets and runners.caddyand the registry login.Verification
TURBO_FORCE=true mise run testat52862a6, run by the coordinator alone: 7 of 7 tasks, none cached, exit 0. The head ofstacks-2,61d97da, has the identical tree (1088b83).mise e2e(the newborn tests) in the pull request run of plx deploy, plx-ci setup and the templates read environment files (PLX-299, with PLX-298) #121 at52862a6: green.stacks-2at61d97da(run 47617908474): green.plx requirements . --compendiumagainst the compendium'sstacks-2at6f42a96: citations resolve.🤖 Generated with Claude Code