Build and deployment automation
Build and deployment automation turns one workspace into checked source, runnable images, hosted services, and release assets. Nx orders project work, Docker defines service boundaries, and GitHub Actions moves trusted outputs through checks, publication, promotion, and monitoring. The parent page Deployment and developer operations gives the wider operations view.
Workspace orchestration
The workspace uses one project graph for local work and CI. Nx runs named targets in dependency order and reuses work when the inputs are unchanged. Yarn and Lerna group packages, while Nx remains the source of truth for task order and cache behavior.
Nx task graph
Nx models each application and library as a project with targets such as build, serve, test, and lint. A target can run for one project or for a set of projects. Nx builds the needed dependencies before the selected product.
The default build target uses production inputs and depends on each project's library builds. Test files do not change a production build result. This keeps local commands, image builds, and CI checks aligned while avoiding work that cannot affect delivery.
References: nx.json• L2-33 nx.json• L146-159 nx.json• L160-247
Workspace package groups
Yarn defines the workspace groups for applications, tools, shared packages, and plugins. Lerna uses those groups and delegates task work to Nx. The root project also exposes a local registry target for package-flow work. Root scripts provide common entry points for grouped builds, configuration, desktop packaging, MCP products, and release work.
These scripts make common actions easy to start. The project targets still define the actual build and test contract. Grouped package builds can retry a one-pass Nx build, while their production and Docker variants prepare the same package families for delivery. Package scripts also group the API, web, integration, plugin, desktop, and MCP products so a release can prepare the same product family in local work and CI.
References: package.json• L21-38 package.json• L63-120 package.json• L455-472 package.json• L579-624 lerna.json• L1-19 project.json• L1-13
Project targets
Project targets describe how source becomes an application or a reusable package. Application targets produce API, web, worker, MCP, or desktop outputs. Library targets produce packages that other targets consume.
Application products
The main application targets build the API, web app, worker, and MCP Auth service as separate products. The Gauzy project also exposes browser output for the web product and alternate UI output for packaged server and desktop products.
Target names and output paths are delivery contracts. Docker stages, root scripts, end-to-end workflows, and packaged-product workflows call them directly.
References: apps/…/project.json• L15-80 apps/…/project.json• L12-183 apps/…/project.json• L198-321 apps/…/project.json• L1-56 apps/…/project.json• L15-107 apps/…/project.json• L13-142 package.json• L574-605
Shared package products
Shared libraries use the same target model as applications. Their dependency links make a library build follow the libraries it needs. A grouped build can therefore prepare a consistent package set before an application or image uses it.
Plugin libraries follow this model for both server code and UI code. Server plugins also define release metadata and publish from their built package output. The realtime plugin also exposes a separate PostgreSQL test target for CI checks that need a real database. This lets new collaboration and integration packages enter the same build and release graph as older shared libraries instead of using a separate path.
CI reports the library result separately. This gives shared-package and strict template failures an early, named result before the application checks finish.
References: packages/…/project.json• L6-34 packages/…/project.json• L6-45 packages/…/project.json• L1-44 packages/…/project.json• L1-39 packages/…/project.json• L1-44 packages/…/project.json• L1-39 packages/…/project.json• L1-44 packages/…/project.json• L1-39 packages/…/project.json• L1-44 packages/…/project.json• L1-39 packages/…/project.json• L1-50 nx.json• L149-202 package.json• L455-467
Build configurations
Development and production are configurations of the same targets. Development supports fast feedback. Production creates output for delivery. The web container configuration leaves public setting placeholders in the bundle so one image can receive values when it starts.
Server secrets remain runtime values. This separates image creation from the environment that runs the image.
References: apps/…/project.json• L16-53 apps/…/project.json• L84-162 package.json• L69-88 .scripts/configure.ts• L233-321 .deploy/…/entrypoint.prod.sh• L4-16
Container environments
Containers provide the common boundary between build output and a running platform. Docker Compose gives local development and self-hosting a service-shaped environment. Image definitions create repeatable API, web, worker, MCP, and MCP Auth products for CI and hosted systems.
Compose environments
The standard Compose environment connects the API and web app to the backing services used by the platform. PostgreSQL stores data. Redis supports shared state and queues. Object storage, search, analytics, tracing, and reporting complete the local service shape.
The demo environment uses a smaller API, web, and PostgreSQL set. It runs published API and web images and exposes the database, API, and web ports for a simple demo stack. The build environment keeps the supporting services but builds selected images from local Dockerfiles.
The Caddy environment provides a self-hosting path with one public origin. Caddy owns ports 80 and 443, sends API paths to the API, sends other paths to the web app, and manages public or local certificates. PostgreSQL, Redis, and the worker remain inside the private Compose network. The operator supplies runtime secrets through the environment file, so the published images stay reusable across hosts.
This diagram shows the main local and self-hosted service relationship.
flowchart LR
Browser[Browser] --> Edge[Caddy or web app]
Edge --> Web[Web app]
Edge --> API[API]
API --> DB[(PostgreSQL)]
API --> Queue[Redis]
Worker[Worker] --> Queue
API --> Files[Object storage or local files]
References: docker-compose.yml• L1-4 docker-compose.yml• L5-83 docker-compose.yml• L85-145 docker-compose.demo.yml• L1-21 docker-compose.demo.yml• L23-86 docker-compose.build.yml• L1-18 docker-compose.infra.yml• L1-21 docker-compose.infra.yml• L147-222 docker-compose.caddy.yml• L1-14 docker-compose.caddy.yml• L52-171 .deploy/…/Caddyfile• L12-31
Container image products
The API, web app, and worker each have a multi-stage image path. Build stages create one product while keeping the large workspace dependency tree out of stored image layers. The final API and worker images run compiled Node output. The final web image serves browser output through Nginx. MCP and MCP Auth use separate image paths with the same broad publish model.
The API image uses BuildKit secrets for private package access and optional build services. Those values support image creation but do not become runtime settings. The final image contains public release identity data so a running API can report the version and commit that produced it.
Branch image workflows publish the main products for stage and production. Demo image workflows build the released commit after the release workflow succeeds. The MCP workflows publish their matching branch image directly. GHCR is the image source for hosted clusters, while Docker Hub and, when enabled, DigitalOcean provide additional mirrors.
Image workflows use registry-backed layers where the image family supports them. They pass registry access as build secrets rather than as image-visible build arguments. Demo images also carry the release version and commit identity used by the running product.
References: .deploy/…/Dockerfile• L1-20 .deploy/…/Dockerfile• L396-460 .deploy/…/Dockerfile• L466-628 .deploy/…/Dockerfile• L1-18 .deploy/…/Dockerfile• L1-20 .deploy/…/Dockerfile• L1-20 .deploy/…/Dockerfile• L1-20 .github/…/docker-build-publish-demo.yml• L39-114 .github/…/docker-build-publish-demo.yml• L193-267 .github/…/docker-build-publish-stage.yml• L37-99 .github/…/docker-build-publish-prod.yml• L26-79 .github/…/docker-build-publish-mcp-demo.yml• L34-73 .github/…/docker-build-publish-mcp-stage.yml• L33-72 .github/…/docker-build-publish-mcp-prod.yml• L23-62
Runtime configuration
The system separates values needed to build an image from values needed to run it. The API and worker receive service settings from the runtime environment. The API image keeps only neutral defaults and public release identity values in the image. The web image replaces named public placeholders in its compiled files before Nginx starts.
This lets one web image serve more than one environment. A missing or wrong runtime value can still make a valid image behave incorrectly.
References: .deploy/…/Dockerfile• L14-20 .deploy/…/Dockerfile• L591-628 .deploy/…/Dockerfile• L14-20 .deploy/…/Dockerfile• L14-18 .deploy/…/Dockerfile• L253-309 .deploy/…/entrypoint.prod.sh• L4-16 .scripts/configure.ts• L233-321 docker-compose.caddy.yml• L17-50
CI pipelines
GitHub Actions separates source checks, product builds, image publication, release creation, upgrade validation, rollout, and runtime boundary checks. Each workflow uses a source ref, run artifact, release tag, image identity, or target environment as the handoff between stages.
Build validation
The build workflow checks pushes to develop, stage, and master. Pull requests aimed at branches other than develop run the workflow, and manual runs support other refs. Newer builds for the same source ref cancel older builds, while fork pull requests skip jobs that need repository-controlled resources.
One producer job validates the native rebuild and release-channel setup, prepares the dependency tree, and publishes a short-lived, run-scoped archive. Library, API, web, and delivery-branch desktop jobs consume that archive first, then use a repository cache or a fresh install as fallback. The library job reports strict package builds as its own early result. The API job runs database and plugin checks before its production build. The web job builds the application and checks its UI integration boundary. The desktop job runs only on the delivery branches.
The consumer jobs keep a failed producer visible as a real failed result instead of becoming skipped checks. Cleanup removes the temporary handoff only when the run has no failed or cancelled job. A failed or cancelled build keeps the archive for a rerun, and its one-day retention limits storage growth.
This diagram shows the build gate and its dependency handoff.
flowchart LR
Source[Source ref] --> Deps[Prepare dependency archive]
Deps --> Libs[Build libraries]
Deps --> API[Check and build API]
Deps --> Web[Build web app]
Deps --> Desktop[Build desktop on delivery branches]
References: .github/…/build.yml• L33-95 .github/…/build.yml• L97-198 .github/…/build.yml• L199-268 .github/…/build.yml• L269-533 .github/…/build.yml• L534-609 .github/…/build.yml• L610-685 .github/…/build.yml• L686-735 .github/…/archive-node-modules.sh• L1-53 .github/…/restore-node-modules.sh• L1-39
Static checks
The static-check workflow runs on pushes to develop and on manual dispatch. A pull request into develop does not start it. It gives fast source checks a separate result by type-checking every Jest configuration and running platform contract checks without a full workspace install. The workspace lint target remains a non-blocking report while its backlog is reduced.
The platform gates protect source contracts such as API surface parity, GraphQL shape, database rules, plugin boundaries, package coverage, release wiring, self-hosting templates, and packaged runtime dependencies. They fail close to the changed source instead of waiting for a full application run. Each gate has a named workflow step, and a wiring check verifies that the workflow invokes the expected gate set. The workflow also reports later failures after an earlier gate fails, so one broken rule does not hide the rest.
These checks are deliberately split by trust level. Configuration and platform gates block a bad result. Lint reports its backlog but does not block delivery until the workspace is ready for that policy.
References: .github/…/static-checks.yml• L1-47 .github/…/static-checks.yml• L49-80 .github/…/static-checks.yml• L82-180 .github/…/static-checks.yml• L182-357 .github/…/static-checks.yml• L359-555
Unit test validation
The unit-test workflow connects the existing Nx test targets to CI on stage. It is an information gate rather than a required promotion gate while the workspace test state is established. This keeps unit-test results visible without adding a new test system or slowing normal development work.
References: .github/…/test-unit.yml• L1-18 nx.json• L163-197
Browser test validation
The browser workflow runs Playwright against a locally started API and web app after code reaches stage, or on a manual run. It separates dependency setup, application builds, and test execution. Four shards run the suite against separate seeded databases.
The dependency job publishes the workspace tree. The build job publishes API and web bundles. Each test job unpacks those bundles, starts a clean stack, and runs one shard. The web bundle is checked against the API port before the test starts. This keeps a runner failure from forcing every phase to repeat and keeps a stale local database from changing the result.
References: .github/…/test_playwright.yml• L22-47 .github/…/test_playwright.yml• L49-149 .github/…/test_playwright.yml• L151-352 .github/…/test_playwright.yml• L353-592 .github/…/test_playwright.yml• L593-630
Image checks and publication
Pull requests use a local Docker check to build API, web, and worker images without publishing them. The check starts each product in an environment-like setup and verifies health or serving behavior. This proves that source can become a runnable image before any hosted system sees it.
Release workflows create the version identity first. Production release publication creates the tag and GitHub release together. The demo image workflow then checks out that released commit and publishes the matching API, web, and worker images. Stage and production branch workflows publish the matching main images, while separate workflows publish MCP and MCP Auth images for demo, stage, and production.
Each image workflow has its own concurrency group. Newer work can replace older work inside that image family without starving unrelated image families. The release workflow does not cancel an active release because a cancelled release would break the image handoff.
References: .github/…/docker-build-check.yml• L1-37 .github/…/docker-build-publish-demo.yml• L1-37 .github/…/docker-build-publish-demo.yml• L39-180 .github/…/docker-build-publish-stage.yml• L1-35 .github/…/docker-build-publish-prod.yml• L1-24 .github/…/docker-build-publish-mcp-demo.yml• L1-32 .github/…/docker-build-publish-mcp-auth-stage.yml• L1-31 .github/…/release-prod.yml• L1-29 .github/…/release-prod.yml• L43-131
Schema and upgrade validation
The schema workflow treats the committed GraphQL snapshot as a client contract. It rebuilds the schema and classifies changes against the base revision. This catches stale snapshots and unapproved breaking changes.
The upgrade workflow tests a different contract. It starts the develop API image with a fresh seeded database. It then starts the branch image on that same database on SQLite and PostgreSQL when selected. The branch must apply its migrations, keep earlier migration records, boot, and answer login, REST, GraphQL, and commerce checks.
The workflow can also boot gated plugins on the upgraded database. Their migrations and routes must work when the switches are enabled. A fresh-database control helps separate an upgrade defect from a defect in the branch itself.
This diagram shows the database upgrade path.
sequenceDiagram
participant Before as Develop image
participant DB as Fresh database
participant After as Branch image
participant Smoke as Smoke and commerce checks
Before->>DB: Apply existing migrations and seed data
Before->>DB: Stop
After->>DB: Apply branch migrations
After->>Smoke: Serve login, REST, GraphQL, and commerce
Smoke-->>After: Report upgrade result
References: .github/…/graphql-schema.yml• L1-20 .github/…/graphql-schema.yml• L24-130 .github/…/upgrade-test.yml• L1-23 .github/…/upgrade-test.yml• L24-86 .github/…/upgrade-test.yml• L113-198 .github/…/upgrade-test.sh• L1-27 .github/…/upgrade-test.sh• L235-370 .github/…/upgrade-test.sh• L376-472 .github/…/upgrade-test-smoke.mjs• L1-17 .github/…/upgrade-test-smoke.mjs• L64-112
Source assurance
Separate workflows cover source risks that a product build cannot see well. Code scanning, dependency checks, secret scanning, spelling checks, and broad lint runs use their own triggers and concurrency rules. This keeps a slow or specialized check from hiding the main build result.
The platform gates in static checks remain the main fast contract check. The other workflows add independent signals for code risk and repository health.
References: .github/…/codeql.yml• L1-18 .github/…/snyk-analysis.yml• L1-18 .github/…/secrets-analysis.yml• L1-18 .github/…/typos.yml• L1-18 .github/…/mega-linter.yml• L1-18
Egress audit
The egress audit checks published API and web images inside isolated networks. It proves that optional platform modules make no external request when disabled and make only their documented calls when enabled against a mock platform. A no-mock control must fail so a green audit proves that the check was active.
The API leg captures DNS and connection attempts before startup. The browser leg signs in and walks the Angular route list. Static checks keep the host list, import boundary, outbound-call contract, and browser baseline aligned. The workflow audits published images on its scheduled path, on demand, and on relevant changes. Pull requests into develop do not start this workflow; the push after merge performs the comparison. Promotion paths can adopt a baseline that does not yet exist on the target branch.
This diagram shows the runtime and source checks that protect the egress boundary.
flowchart LR
Images[Published API and web images] --> Network[Isolated Docker networks]
Network --> API[API process]
Network --> Browser[Browser session]
API --> Capture[DNS and connection capture]
Browser --> Baseline[Route and link baseline]
Mock[Mock platform] --> Network
Capture --> Evidence[Reports and captures]
Baseline --> Evidence
Source[Source and route changes] --> Static[Static boundary checks]
References: .github/…/egress-audit.yml• L1-49 .github/…/egress-audit.yml• L62-142 .github/…/egress-audit.yml• L144-309 .github/…/egress-audit.yml• L311-492 .github/…/egress-audit.yml• L493-540 tools/…/egress-audit.config.json• L1-200
External uptime monitoring
The external uptime monitor gives production an independent health signal from outside the homelab network. Scheduled and manual runs use GitHub-hosted runners to probe public web and API endpoints, while pull request runs test the workflow without changing alert state.
The monitor retries each probe and separates critical production failures from warning targets. It records network timing and response checks, then keeps one alert issue in sync with the current failure set. A recovery closes that issue. When configured, a temporary Cloudflare allow rule lets the external probe pass edge protection and is removed after the probe.
This diagram shows how an outside probe becomes an operational alert without confusing a workflow failure with an application outage.
flowchart LR
Schedule[Schedule or manual run] --> Runner[GitHub-hosted runner]
Runner --> Probe[Public endpoint probes]
Probe --> Result{Critical endpoint failure?}
Result -->|Yes| Alert[Open or update alert issue]
Result -->|No| Recover[Comment and close open alert]
Probe --> Evidence[Timing and response report]
Workflow[Pull request change] --> SelfTest[Probe self-test without alerting]
References: .github/…/external-uptime-monitor.yml• L37-117 .github/…/external-uptime-monitor.yml• L293-459 .github/…/external-uptime-monitor.yml• L481-505 .github/…/external-uptime-monitor.yml• L520-685
Hosted deployment manifests
Hosted manifests turn published images into reachable services. They describe domains, health checks, replicas, ports, storage, and runtime settings for a target platform. They consume images. They do not build them.
Kubernetes services
The Kubernetes manifests define separate API and web services with HTTPS ingress rules. Stage and production use separate names and hosts. Demo manifests adapt this same service boundary to different hosted clusters and image registries.
The demo variants differ in the platform contract around those services:
| Manifest family | Service shape | Hosted-platform contract |
|---|---|---|
| DigitalOcean demo | API, web, and worker deployments | Nginx ingress and DigitalOcean registry images |
| Civo demo | API and web deployments | Traefik ingress and GHCR images |
| CoreWeave demo | API and web deployments | Tenant Traefik ingress, private registry access, and fixed node placement |
Each demo variant keeps API and web on separate public hosts and passes environment values through placeholders. The DigitalOcean variant also runs the worker for background work. The Civo and CoreWeave variants omit that worker and focus on the API and web demo pair.
The deployment workflow renders secret-backed values, applies the manifest, and restarts deployments that track a mutable latest image. Image names, ports, URLs, worker settings, and runtime secrets must remain one contract.
References: .deploy/…/k8s-manifest.stage.yaml• L1-78 .deploy/…/k8s-manifest.stage.yaml• L80-103 .deploy/…/k8s-manifest.stage.yaml• L330-425 .deploy/…/k8s-manifest.stage.yaml• L430-546 .deploy/…/k8s-manifest.demo.yaml• L1-78 .deploy/…/k8s-manifest.demo.yaml• L80-164 .deploy/…/k8s-manifest.demo.yaml• L166-236 .deploy/…/k8s-manifest.demo.yaml• L238-304 .deploy/…/k8s-manifest.civo.demo.yaml• L2-26 .deploy/…/k8s-manifest.civo.demo.yaml• L28-109 .deploy/…/k8s-manifest.civo.demo.yaml• L111-180 .deploy/…/k8s-manifest.civo.demo.yaml• L182-237 .deploy/…/k8s-manifest.cw.demo.yaml• L2-26 .deploy/…/k8s-manifest.cw.demo.yaml• L28-127 .deploy/…/k8s-manifest.cw.demo.yaml• L129-214 .deploy/…/k8s-manifest.cw.demo.yaml• L216-271 .github/…/deploy-do-stage.yml• L1-18
Deployment promotion
Deployment workflows start after a successful image workflow. Each workflow maps an environment branch and image family to one hosted target. Civo, CoreWeave, DigitalOcean, Fly, and Render paths use the same broad handoff: publish an image, wait for the publish workflow to complete, then apply the target-specific settings.
The DigitalOcean App Platform production path consumes the appplatform image workflow. It renders .do/app.yaml from production secrets and fixed service settings, then creates or updates the named application. It keeps read-only repository access and does not cancel an apply already in progress.
The deployment workflows do not cancel an update that is already applying. They replace only work that is waiting. This protects a live rollout from being cut off while still avoiding an old queued promotion.
References: .github/…/deploy-civo-stage.yml• L1-18 .github/…/deploy-cw-stage.yml• L1-18 .github/…/deploy-do-stage.yml• L1-18 .github/…/deploy-do-app-platform-prod.yml• L1-30 .github/…/deploy-do-app-platform-prod.yml• L32-48 .github/…/deploy-do-app-platform-prod.yml• L169-195 .github/…/deploy-fly-demo.yml• L1-18 .github/…/deploy-render-demo.yml• L1-18 .github/…/deploy-mcp-stage.yml• L1-18 .do/app.yaml• L1-20
Render and Fly services
Render and Fly provide image-based hosted paths for demo use. Render uses a blueprint with API and web services. Fly uses one application definition per service. Both describe service health and public settings, while deployment workflows invoke the platform after the matching image workflow completes.
These platforms use different controls for domains, machines, storage, and service health. The image remains the common delivery unit.
References: render.yaml• L1-80 .render/render.demo.yaml• L1-74 .fly/…/fly.toml• L1-48 .fly/…/fly.toml• L1-39 .github/…/deploy-render-demo.yml• L1-56 .github/…/deploy-fly-demo.yml• L1-45
Repository build and release tools
Root scripts and small repository tools connect project targets to delivery systems. They prepare generated settings, control dependency setup, watch package output, assemble desktop products, and mirror releases.
Dependency and registry tools
The supported install path separates package installation from post-install work. The post-install tool runs required package actions and rebuilds native packages. It checks required native output before a dependency tree can become an image or release.
CI can use an internal package cache and resets registry state around reused runners. Release jobs also remove package credentials and fail if they cannot prove that the credentials are gone.
References: package.json• L63-68 package.json• L117-120 .scripts/postinstall.js• L1-15 .scripts/postinstall.js• L157-173 .scripts/postinstall.js• L175-229 .github/…/action.yml• L48-81 .github/…/action.yml• L156-181 .github/…/build.yml• L123-196
Configuration and watch tools
The configuration tool creates Angular environment files for local and production builds. It keeps browser-visible settings separate from server secrets and can create Docker placeholders instead of fixed hosted URLs. The watch tool rebuilds one library when immediate package output is useful.
These tools prepare target inputs. They do not create a second build system.
References: .scripts/configure.ts• L1-20 .scripts/configure.ts• L31-49 .scripts/configure.ts• L416-465 .scripts/build-watch.ts• L1-32 package.json• L28-38 package.json• L89-90
Desktop packaging and release mirroring
Desktop and packaged server workflows build desktop, timer, agent, API server, server, and MCP products only after a platform branch is promoted to an app-build branch. Demo promotion moves develop to local-apps. Stage promotion moves stage to stage-apps. Production promotion moves master to apps. Each workflow can also run manually, while the stage path keeps temp for ad-hoc builds.
The workflow first checks that the promoted source carries the platform release tag. It then passes that tag to the package build, so packaged products and platform images share one release identity. Stage packages use prerelease releases. Production packages use full releases. Stage and production workflows create the target GitHub release once before their platform matrix starts. This gives parallel package jobs one release to update instead of asking them to create the same release at the same time.
The package workflows prepare platform-specific runners and publish installers or update data to the product's release destination. Windows jobs provide a stable Bash environment for shared install, build, and credential-cleanup steps. macOS jobs verify signing before packaging and declare the minimum supported system version in the update manifest. Linux jobs prepare the native packaging tools needed by the selected architecture. Runners without Snap or Flatpak support remove only those unavailable Linux targets and still produce the supported package formats.
GitHub Releases remains the source of truth for installers and update feeds. A scheduled mirror copies those assets to the R2-backed download path. The mirror is repeatable, so a missed run can repair the download service without changing the app build workflows.
This diagram shows the release identity moving from a platform release to packaged products and downloads.
flowchart LR
Platform[Platform release tag] --> Apps[Promoted app-build branch]
Apps --> Packages[Desktop and server packages]
Packages --> Releases[GitHub Releases]
Releases --> Mirror[R2 download mirror]
References: .github/…/desktop-app-demo.yml• L1-107 .github/…/desktop-app-stage.yml• L1-133 .github/…/desktop-app-prod.yml• L1-129 .github/…/desktop-timer-app-demo.yml• L1-107 .github/…/desktop-timer-app-stage.yml• L1-133 .github/…/desktop-timer-app-prod.yml• L1-129 .github/…/agent-demo.yml• L1-107 .github/…/agent-stage.yml• L1-133 .github/…/agent-prod.yml• L1-129 .github/…/server-api-demo.yml• L1-107 .github/…/server-api-stage.yml• L1-107 .github/…/server-api-prod.yml• L1-129 .github/…/server-demo.yml• L1-107 .github/…/server-stage.yml• L1-133 .github/…/server-prod.yml• L1-129 .github/…/server-mcp-demo.yml• L1-107 .github/…/server-mcp-stage.yml• L1-133 .github/…/server-mcp-prod.yml• L1-133 .github/…/mirror-releases-to-r2.yml• L1-18
CI storage controls
Large dependency trees and reports are treated as short-lived handoffs rather than permanent cache state. The cache janitor keeps duplicate cache entries from consuming the repository budget. Build and browser workflows delete their run-scoped dependency artifacts after successful consumers finish, while failed builds keep the handoff long enough for a rerun.
This makes storage behavior part of delivery reliability. Losing a dependency handoff can turn a quick rerun into another long install.
References: .github/…/cache-janitor.yml• L1-18 .github/…/build.yml• L626-723 .github/…/test_playwright.yml• L593-630
Change checklist
When these files or sections are changed, remember to consider these:
- When changing Nx target names, configurations, inputs, or output paths, check project consumers, root scripts, Docker stages, browser bundle jobs, and release jobs together.
- When adding a plugin project, keep its dependency links, build output, package metadata, and any API or UI Docker copy contract aligned.
- When changing the root project or local registry target, keep package scripts, CI registry setup, and any package-flow checks aligned.
- When changing the build producer or dependency archive, keep the run-scoped artifact handoff, cache fallback, failed-run retention, and cleanup rule aligned.
- When changing build workflow triggers or concurrency, keep the develop pull-request policy, fork guard, source-ref grouping, and named library and application results aligned.
- When changing static checks, keep blocking type and platform gates separate from the non-blocking lint report. Keep each gate wired into the workflow.
- When changing browser test shards or bundle creation, keep the API port, rewritten web bundle URL, clean database, shard count, and report retention aligned.
- When changing image or release workflows, preserve the release-tag handoff, image tag identity, package permissions, and successful
workflow_runchain. - When changing deployment targets, keep environment branch mapping, mutable image rollout behavior, target secrets, and non-cancelling apply behavior aligned. For App Platform, keep .do/app.yaml placeholders and production secret injection aligned.
- When changing Compose environments, keep Caddy's one-origin path map, proxy trust, required secrets, service health order, and persistent volumes aligned.
- When changing upgrade checks, keep the before-image identity, migration list, same-database boot, SQLite and PostgreSQL modes, gated-plugin boot, and fresh control aligned.
- When changing egress audit modes or route coverage, keep the isolated networks, mock-positive case, expected-failing control, browser baseline, source boundary checks, and promotion baseline rules aligned.
- When changing external uptime targets, runner type, alert mode, or cleanup, keep the outside-homelab vantage point, critical and warning policy, retry threshold, alert fingerprint, and temporary edge-rule lifecycle aligned.
- When changing packaged app branches or release mirroring, keep the platform release tag, promoted app branch, GitHub Release asset, update feed, and R2 object path aligned.
- When changing a packaged app workflow, keep its source branch, release-tag check, product release repository, prerelease or full-release mode, and platform-specific package target aligned.
- When changing the packaged release matrix, keep the one-time release creation, shared tag output, signing or update-manifest step, and final asset upload aligned across all supported products.
- When changing artifact retention or cache pruning, keep rerun needs, consumer completion, storage limits, and report access aligned.
- When adding a workspace package to the API image, keep its package metadata, build-stage dependency input, production dependency input, and runtime package assembly aligned with the worker and web image contracts.
- When changing Docker build inputs, keep BuildKit secret use separate from runtime configuration and keep public release identity values aligned with the version endpoint.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A build producer fails and downstream jobs are only skipped | A required check can look harmless even though it never ran | Keep downstream jobs live after cancellation checks and make the restore fail loudly |
| A failed build deletes its dependency archive | A rerun repeats the long dependency setup | Keep the run archive after red builds and use short retention |
| A release workflow is cancelled before its image workflow starts | No matching image is published and the environment keeps its old image | Serialize release work without cancellation and publish images only after a successful release |
| A demo image checks out a moving branch instead of the released commit | The image version and the GitHub release can describe different source | Build from the successful release workflow's commit and keep its release identity |
| A release image is pushed only to a public mirror | A hosted cluster cannot pull the new image | Push GHCR independently after the image build succeeds |
| Two image families share one concurrency group | An unrelated queued build is cancelled and its environment keeps the old image | Give each image workflow its own group |
| The web bundle and test API use different ports | Browser tests load the page but fail on API calls | Rewrite and verify the built bundle before the test shards start |
| An image check publishes or uses a deploy-tracked tag | A pull request can affect a hosted environment | Use isolated check tags and keep publishing in the publish workflows |
| An upgrade image misses a migration or loses an earlier migration record | A release can fail on an existing database | Compare before and after migration records on the same SQLite and PostgreSQL database |
| A deployment run is cancelled during an apply | A hosted service can remain half-updated | Keep deploy concurrency non-cancelling while replacing only queued work |
| App Platform receives an empty or stale rendered secret value | The API fails to start or connects to the wrong service | Render .do/app.yaml from the production environment and keep the template and secret names aligned |
| A packaged app builds from a branch without the platform release tag | Desktop and platform products report different versions | Resolve app versions from the promoted platform release |
| An app workflow runs from an untagged promotion or the wrong app branch | The package job stops before publishing, or an ad-hoc build enters a release path | Keep the source-branch guard and release-tag check matched to the promotion flow; allow only the named temp path to skip it |
| Parallel package jobs race to create the same GitHub release | One job can fail after its assets build, leaving release status unclear | Create the target release once before the stage or production matrix and keep its repository and release type equal to the package metadata |
| A package workflow points at the wrong product release repository | Assets or update data are published where the product cannot find them | Keep the product name, release repository, update manifest, and mirror source aligned |
| A reused Windows runner resolves a non-Git Bash shell | Shared install, build, or credential-cleanup steps fail before they run | Put Git Bash first on the runner path before any Bash step |
| The external monitor runs inside the homelab | A local routing fault can look like a production outage | Keep live probes on GitHub-hosted runners outside the homelab |
| A critical endpoint fails once during a transient network blip | The monitor opens an unnecessary production alert | Require consecutive failed attempts before alerting |
| The temporary edge allow rule is not removed | A runner address stays allowed longer than the probe needs | Clean up in an always-run step and fail loudly when removal is not confirmed |
| The egress positive case passes without its mock | The audit can report green without proving outbound-call behavior | Require the no-mock control to exit with a violation |
| An egress baseline grows outside an allowed promotion or legal change | A new external link can enter the UI without review | Compare against the base and allow growth only through the named baseline rules |
| A runtime value is supplied only as a build input | The image builds but the running service has a wrong or empty setting | Check Compose, hosted manifests, and container entrypoints as one runtime contract |
| A workspace package is added to only one API image stage | The image can build with missing runtime dependencies or fail when the service starts | Keep package metadata, production dependencies, and runtime package assembly in sync |
| A registry or build credential is passed as an image argument | A secret can remain in an image layer or build history | Pass build-only credentials through BuildKit secrets and keep service credentials in the orchestrator |
| The local registry target or package registry setup is unavailable | Package-flow checks or dependency setup can fail before product builds start | Keep the root target, registry action, and package install path aligned |
| Caddy does not route a new API path or the proxy trust count is wrong | A feature fails through the public origin or rate limits use the proxy address | Update the one-origin path map and proxy contract together |
| A blocking static gate is added without its wiring check | The source rule exists but CI never measures it | Add the gate as a named workflow step and keep the gate-wiring check green |
| A new plugin project omits its dependency or release target | Nx can build an incomplete package or the plugin is absent from a release set | Match the server and UI project target contracts and verify the package is included in the grouped build |
Key files
| File | Why to read it |
|---|---|
| nx.json | Defines the project graph, target defaults, cache inputs, and release build hook |
| lerna.json | Shows the package groups and Lerna-to-Nx relationship |
| project.json | Defines the root local registry target used by workspace package flows |
| package.json | Provides the main build, Docker, desktop, MCP, grouped package, and release entry points |
| apps/…/project.json | Shows service targets and API build variants |
| apps/…/project.json | Shows browser and packaged UI build configurations |
| packages/…/project.json | Shows a shared library target and its package output |
| packages/…/project.json, packages/…/project.json | Show the server and UI plugin target contracts |
| packages/…/project.json | Shows a released plugin with dependency links, package output, and its PostgreSQL test target |
| docker-compose.yml | Shows the normal local API and web relationship |
| docker-compose.demo.yml | Shows the small published-image demo environment |
| docker-compose.caddy.yml | Shows the one-origin self-hosting environment and runtime secret boundary |
.deploy/caddy/Caddyfile | Shows the public path split between the API and web app |
.deploy/api/Dockerfile | Shows the API multi-stage build, build-secret boundary, release identity, and runtime defaults |
.deploy/webapp/Dockerfile | Shows the browser image and public setting boundary |
| .github/…/build.yml | Shows the shared dependency producer, named build results, source triggers, concurrency, fallback paths, and failure-aware cleanup |
| .github/…/static-checks.yml | Shows blocking source contracts, non-blocking lint reporting, trigger policy, and platform gate wiring |
| .github/…/test-unit.yml | Shows where existing Nx unit targets enter CI |
| .github/…/test_playwright.yml | Shows dependency reuse, bundle creation, sharding, clean local startup, and report flow |
| .github/…/docker-build-check.yml | Shows non-publishing image startup checks |
| .github/…/docker-build-publish-stage.yml | Shows branch image publication and stage image tags |
| .github/…/docker-build-publish-demo.yml | Shows release-commit image publication and version identity |
| .github/…/docker-build-publish-mcp-stage.yml | Shows MCP image publication for a non-production branch |
| .github/…/release-prod.yml | Shows the release tag and GitHub release step that supplies image identity |
| .github/…/upgrade-test.yml | Shows same-database upgrade validation across supported database modes |
| .github/…/upgrade-test.sh | Shows migration comparison, boot checks, and gated-plugin validation |
| .github/…/egress-audit.yml | Shows isolated image checks, baseline rules, and outbound-call evidence |
| .github/…/external-uptime-monitor.yml | Shows independent public health probes, alert issue state, and edge-rule cleanup |
| .deploy/…/k8s-manifest.stage.yaml | Shows the hosted API, web, worker, ingress, and runtime setting shape |
| .github/…/deploy-do-stage.yml | Shows an image-to-hosted-environment promotion path |
| .github/…/deploy-do-app-platform-prod.yml | Shows production App Platform rendering, app creation, and app update |
| .do/app.yaml | Shows the App Platform service and runtime setting contract |
| .scripts/configure.ts | Shows how web configuration becomes build input or a runtime placeholder |
| .scripts/postinstall.js | Shows controlled dependency setup and native package checks |
| .github/…/desktop-app-stage.yml, .github/…/desktop-app-prod.yml | Show release-tag checks, one-time release creation, and cross-platform desktop packaging |
| .github/…/desktop-timer-app-stage.yml, .github/…/desktop-timer-app-prod.yml | Show timer app version matching and release targets |
| .github/…/agent-stage.yml, .github/…/agent-prod.yml | Show agent package promotion, runner target selection, and release publishing |
| .github/…/server-api-stage.yml, .github/…/server-api-prod.yml | Show API server package promotion and release destinations |
| .github/…/server-stage.yml, .github/…/server-prod.yml | Show server package promotion and release preparation |
| .github/…/server-mcp-stage.yml, .github/…/server-mcp-prod.yml | Show MCP server package promotion and release targets |
| .github/…/mirror-releases-to-r2.yml | Shows the release asset mirror and its source-of-truth model |