Repository navigation
Merge stacks-2 into stacks-3 - #125
Open
davidjalbers wants to merge 56 commits into
Open
davidjalbers wants to merge 56 commits into
davidjalbers wants to merge 56 commits into
Conversation
…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>
… stale record Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…327-plx-update-lands-a-version-on-develop
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…their default Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…327-plx-update-lands-a-version-on-develop
Every case hands the playbook an environment's file instead of a directory the platform laid out: the playbook creates the directory and writes .env from `env`, and .env.secret from `secrets` through a stand-in of the vault's CLI. New cases: values and secrets reach the containers byte for byte and no secret reaches the output, with -v or --diff; a changed value beside a rotated secret that breaks the healthcheck ends with the previous .env, .env.secret, compose.yaml and containers; a secret the vault does not hold; files the playbook cannot write; a dry run of a new environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er cites; ship regenerates the file at the cut Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The playbook takes the environment's file (stack_environment_file) in place of the environment's name and an inventory: a first play where it runs reads the file, refuses one it cannot write faithfully, resolves each pointer under `secrets` with `op read`, and adds the host `host` names, as the user it names or plexus_deploy_user, which the role deploy_user now gives a default. On the host it creates the environment's directory, writes .env from `env` with the project name and .env.secret from the secrets, each value double-quoted and escaped so that Compose reads it back as written, keeps the previous copy of each of the three files that changes, and on a failed deploy restores them together. No task that holds a secret prints it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
host-image.sh builds what platform-playbook.sh built for itself, with Docker's CLI and compose plugin and PyYAML added, and Caddy without a site, so that it listens on nothing until the platform playbook configures it. The platform playbook's test mounts its stand-in for docker over the CLI; the stack playbook's test will run the real one against this machine's daemon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… prepared host A second part runs the playbook against a host the platform playbook prepared, a container booted with systemd in this machine's network, whose proxy listens on 127.0.0.1 and ports of the run's own: a first deploy takes the lowest port of the range and writes the route, which serves the environment and refuses /healthz; a run in which nothing changed changes no file and reloads nothing; two first deploys started at once end with different ports; a hostname another environment serves is refused; a changed value that breaks the healthcheck is rolled back and its route kept; a port a directory holds is kept; no free port; a route the proxy refuses; a dry run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where the environment has a hostname, files/route.sh runs on the host under one lock file under /opt/stacks, which a second deploy waits for: it refuses a hostname another environment's fragment serves, keeps the port the environment's .env names or takes the lowest of stack_port_range (20000-20999) that no other .env and no other fragment names, and writes the route fragment and reloads the proxy only where the fragment's text changes, putting back what was there where the proxy refuses. .env carries the port as PLEXUS_LOOPBACK_PORT. A rollback restores the files and leaves the route, which joins the hostname to a port that does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-lands-a-version-on-develop plx update lands a version on the default branch of origin
…299-plx-deploy-plx-ci-setup-and-the
…or a released name as a citation The maintainer removed path prefixes: a deviation under PLX-Stack/PathPrefix has no meaning the index of an older version could still give it, so the test of released names holds only the renamed one, spelled at run time. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Path prefixes are gone by the maintainer's decision; the requirement's name stays in the index of the last version until the next one is cut, and nothing here cites it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… file, with no inventory Each stack's file for an environment names its host; the playbook is handed the file and no inventory, user, port or environment name, an environment file with a problem refuses the run before any host, and --inventory is an unknown option. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ecret, nothing from the vault, no token for a second repo Setup holds the key in an agent, puts op on the PATH for the playbook that reads the secrets, and reads the vault only to join the overlay; --operations-repo is gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…holds the two repository secrets of a deploy The step of plx deploy holds the read-only vault token, setup holds the deploy key, and no step names an operations repo or an inventory. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e host the file names, and reads no inventory The stack playbook gets the file and no inventory, user, port or environment name; a file with a problem refuses the run before any host or registry; --inventory is gone with the operations record the deploy targets read, and deployTargets.ts keeps only the map from a branch to its environment. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ads nothing from the vault and mints no token for a second repo It puts op where the stack playbook finds it, reads the vault only to join the overlay, and no longer knows an operations repo: --operations-repo, operations-token and isOperationsRepo are gone. 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)
Resolved, per file: - packages/lib/src/deployTargets.ts: milestone 2's file (the inventory reading is gone, and so are DEFAULT_ENVIRONMENT and ENVIRONMENT_BRANCHES) holding only environmentOf, which is the declaration-based one (declared, event, ref, given). - packages/lib/src/deployTargets.test.ts: the tests of environmentOf from the declaration; the inventory tests went with the code they covered. - packages/lib/src/index.ts: exports only environmentOf from deployTargets.ts; every other export of both sides is kept. - packages/lib/src/standard-index.json: the union of both sides' additions (PreparedHost, FileNamesDeclared, DeclaredHasFile), without PathPrefix and PrefixInRecord, which milestone 2 removed. - packages/cli/src/commands/deploy.ts: milestone 2's header examples (no --inventory) with the branch "a declared env/<name> branch"; the declaration read and the refusal were already merged. - packages/cli/src/commands/deploy.test.ts: both tests kept: the declaration refusals (without --inventory) and the unknown --inventory option through plxProcess. - packages/cli-ci/src/commands/setupWithoutToken.test.ts: milestone 2's title and cases, the first job given the marker that declares environments. - newborns/update-released.test.ts: both tests kept (the declaration stands as written; the stack gets no environment file). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ging files declare those two environments, as the doctor now requires Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ts its stack template files stand for, as the doctor now requires Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r that declares environments, as its first job is Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Merges
origin/stacks-2(61d97da, milestone 2) intostacks-3.Conflicts in eight files; the branch map is the declaration's, everything else of milestone 2 is kept.
Per file
packages/lib/src/deployTargets.ts: milestone 2's file, holding no inventory reading,DEFAULT_ENVIRONMENTorENVIRONMENT_BRANCHES, withenvironmentOf(declared, event, ref, given)from the declaration.packages/lib/src/deployTargets.test.ts: the tests ofenvironmentOffrom the declaration; the inventory tests went with the code they covered.packages/lib/src/index.ts:environmentOfis the one export ofdeployTargets.ts; every other export of both sides stays.packages/lib/src/standard-index.json: the union of both sides' additions (PreparedHost,FileNamesDeclared,DeclaredHasFile), withoutPathPrefixandPrefixInRecord.packages/cli/src/commands/deploy.ts: milestone 2's header (no--inventory) with the branch "a declared env/ branch"; the declaration read and its refusal are as they were.packages/cli/src/commands/deploy.test.ts: both tests kept: the declaration refusals, now without--inventory, and the unknown--inventoryoption throughplxProcess.packages/cli-ci/src/commands/setupWithoutToken.test.ts: milestone 2's title and cases; both jobs that runon_pushare given the marker that declares environments.newborns/update-released.test.ts: both tests kept.Fixtures the merge made stale (three added commits, tests only)
The
stacktemplate rendersproduction.yamlandstaging.yaml, andplx doctornow fails a file whose environment the root marker does not declare.So a newborn with a stack and no declaration fails the doctor (
PLX-Stack/FileNamesDeclared).The fixtures that keep those files declare the two names:
newborns/pipeline.test.ts,newborns/repo-operations.test.ts(the deploy job),packages/lib/src/newSite.test.ts(bornTurbo).No case is dropped.
Left for the next issue (PLX-303)
stacktemplate's literalproduction.yamlandstaging.yaml(a stack is born with files for two names whatever the repo declares).plx deploy --environment production, and itsdeploy-productionconcurrency group and header.on_pushandon_commitnamingmainanddevelop, and thepromotetask ofrepo-turbo/files/mise.toml.jinja.PLEXUS.md.jinjaof the operations template ("into production").plx-ci setup's deploy job refuses a push on a branch no environment is declared for, as therepojob does; two fixtures of milestone 2 ran it without a marker and now carry one.Verification
plx requirements . --compendium <the compendium's stacks-3>: citations resolve, nothing found.scratch.tsaftermise run buildandnode newborns/pack.ts:deploy-job,repo-operations,update-released,pipeline: 47 of 47 pass.TURBO_FORCE=true mise run test: exit 0,Tasks: 7 successful, 7 total,Finished in 370.97s.🤖 Generated with Claude Code