Apps

Runtimes, framework presets, Git deploy with rollback, workers and cron for apps in any language.

Available apps version 1.0.1 Part of Apps and runtimes

Actions

55 actions, callable from the panel, the command palette and the API as POST /api/v1/a/<id>. Internal actions used between modules are not listed.

ActionWhat it doesRiskPreview
apps.preset.list List framework presets (read) low No dry run
apps.runtime.install Install language runtimes medium
apps.runtime.list List installed runtimes (read) low No dry run
apps.app.detect Detect a repository's framework (read) low No dry run
apps.app.create Create an app medium
apps.app.update Change an app medium
apps.app.get Show an app (read) low No dry run
apps.app.list List apps (read) low No dry run
apps.app.delete Delete an app high
apps.env.list List environment variables (read) low No dry run
apps.env.set Edit environment variables medium
apps.deploy.run Deploy an app medium
apps.deploy.list List deploys (read) low No dry run
apps.deploy.get Show a deploy with its log (read) low No dry run
apps.deploy.rollback Roll back to a previous release medium
apps.release.list List releases on the server (read) low No dry run
apps.unit.control Start, stop or restart a process low
apps.status Process status (read) low No dry run
apps.logs.get Process logs (read) low No dry run
apps.command.run Run a command once high
apps.workers.set Set queue workers medium
apps.cron.set Set scheduled jobs medium
apps.site.link Serve an app on a domain medium
apps.webhook.info Show the webhook secret high
apps.webhook.rotate Rotate the webhook secret high
apps.webhook.receive Receive a Git webhook medium No dry run
apps.environment.list List the environments of an app (read) low No dry run
apps.environment.create Add a staging environment to an app medium
apps.environment.promote Promote staging to production high
apps.git.link Deploy an app from a Git connection's repository medium
apps.git.unlink Stop deploying an app from its Git connection medium
apps.reconcile Re-apply every app's units low
apps.template.list List app templates (read) low No dry run
apps.template.get Show an app template (read) low No dry run
apps.template.save Save an app as a template low
apps.template.delete Delete an app template medium
apps.template.export Export a template as YAML (read) low No dry run
apps.template.import Import a template from YAML low
apps.override.preview Preview the repository's respirecloud.yaml (read) low No dry run
apps.nginx.get Show the app's web server snippets (read) low No dry run
apps.nginx.set Set the app's web server snippets medium
apps.process.list List the processes of an app (read) low No dry run
apps.process.set Change one process of an app medium
apps.process.delete Remove a worker medium
apps.process.scale Run more or fewer copies of a worker medium
apps.cron.list List the scheduled jobs of an app (read) low No dry run
apps.cron.runs Show the history of a scheduled job (read) low No dry run
apps.cron.run Run a scheduled job now medium
apps.queue.list Show the queues of an app (read) low No dry run
apps.queue.jobs List the failed jobs of a queue (read) low No dry run
apps.queue.retry Retry failed jobs medium
apps.queue.forget Forget failed jobs medium
apps.queue.watch Watch a queue and alert low
apps.app.adopt Run an app from a folder on the server medium
apps.import.pm2 Import a PM2 ecosystem file medium

Permissions and limits

Permissions

  • apps.view View apps, deploys and logs
  • apps.operate Start, stop and restart app processes
  • apps.deploy Deploy and roll back
  • apps.manage Create, change and delete apps
  • apps.runtime.manage Install language runtimes
  • apps.webhook Trigger a deploy through a webhook
  • apps.admin Administer apps on every server

Plan limits

  • apps.apps Apps
  • apps.container_cpu CPU of one app container
  • apps.container_memory_mb Memory of one app container
  • apps.workers Worker processes per app

Engineering notes

Generated from modules/apps/docs.md at build 38156245. These are the notes the engineers keep next to the code: precise, technical, and honest about what is not done yet.

Declared in module.yaml; agent driver internal/agent/apps*.go; op types sdk/agentop/apps.go; detection table modules/apps/preset (pure Go, unit-tested; heuristics follow railpack's providers, MIT).

Model

  • Runtimes: apps.runtime.install installs Node, Python, Ruby, Go, Java, .NET, Deno, Bun, Elixir, PHP or Rust per account with mise (pinned release, sha256 checked, /usr/local/bin/mise; data in ~/.local/share/mise). PHP apps default to the distro PHP + composer (runtime: system) so they match the web module's FPM.
  • Apps (apps table): repo URL, branch, preset, build/migrate/start as argv arrays (no shell strings), health path, shared paths, workers, cron, keep-N, port (21000-21999, per node), link to the web site. A generated ed25519 deploy key (private half in the vault, public half returned) and a webhook secret (vault).
  • Environment: apps.env.set/list; secret values go to the vault (apps/<id>/<KEY>), never to the table, never returned. On the node they land in /etc/respirecloud/apps/<user>/<app>.env (root:user 0640) read by the units (EnvironmentFile=), by build steps (-E) and, for dotenv readers like Laravel, through a .env symlink.
  • Processes: rc-app-<user>.<app>[.<worker>].service, cron as rc-cron-<user>.<app>.<job>.{service,timer} (cron expressions are converted to OnCalendar), all User=, Slice=rc-acct-<user>.slice, NoNewPrivileges, PrivateTmp, ProtectSystem=full, restart on failure. ${PORT} in argv is expanded by systemd. The dot separator keeps accounts a-b/app c and a/app b-c from colliding.
  • Deploy modes: buildpack (default, below), dockerfile / compose (w9-15) and fast (w12, ADR 0031): see the sections further down.
  • Deploy (apps.deploy.run, one at a time per app): fetch the bare mirror (~/apps/<app>/repo) with the deploy key, git clone a release dir releases/<id>, drop .git, link shared paths (first deploy seeds shared/ from the repo, e.g. Laravel storage), run build steps then migrations in the release dir, as the account user, in its slice (systemd-run --uid --slice; root never follows a path in the home), swap current with ln -sfn + mv -T (atomic rename), rewrite units and restart, reload the account's rc-fpm-<ver>-<user> for PHP, health-check (HTTP path or "unit stays active"); any failure after the swap flips current back and restarts the previous release. Old releases beyond keep are deleted. apps.deploy.rollback swaps to the previous (or a named) release. Log (256 KiB head+tail) is stored in deploys and the final status goes out as apps.deploy.finished.
  • Presets (apps.preset.list): Laravel, Symfony, WordPress, Drupal, generic PHP, Next.js, Nuxt, SvelteKit, Remix / React Router, Astro (static or node adapter), NestJS, Express/Fastify/Koa, Node, Vite, Eleventy, Hugo, Jekyll, MkDocs, Django (module derived from manage.py), Flask, FastAPI, Python, Rails, Spring Boot, ASP.NET Core, Phoenix, Go, Rust, Deno, Bun, static. preset: auto runs detection on the first deploy and stores the answer; every field is editable.
  • Sites: apps.site.link (or domain_id on create) calls web.sites.create: PHP -> php site with docroot apps/<app>/current/<public>, static -> static, process -> proxy to http://127.0.0.1:<port> (needs the admin proxy.allow_internal layer setting, see modules/web). The web module pre-creates the docroot path as real directories; the first swap replaces an empty current/ directory with the symlink.
  • Webhook (apps.webhook.receive): verifies the signature or token in constant time, then deploys in the background. The push rules are in the Git section below.

An app gets its code from a plain repository address (repo_url and branch, with a deploy key the panel makes), or from a Git connection (module git: a GitHub App, or a token for GitLab, Gitea or Forgejo, or Bitbucket Cloud). A linked app is wired up by the panel, so nothing is set up by hand at the provider.

  • Link: apps.git.link (app_id, connection_id, repo as owner/name, optional branch; dry_run shows the plan). The panel adds a webhook to the repository through the git module and, for a token connection, a read-only deploy key. The branch defaults to the repository's default branch. Linking again replaces the old webhook and key. The link is kept in the app's config.git.
  • Create takes git: {connection_id, repo} in place of repo_url.
  • Unlink: apps.git.unlink removes the webhook and the deploy key at the provider. The app keeps its repository address and its own deploy key. Deleting the app does the same. What the provider refuses is named in the result, to remove by hand.
  • How the code is fetched: with a deploy key, the agent clones over SSH. With a GitHub App, the agent clones with a one-hour, read-only token made for each deploy, so no Administration permission is needed.
  • No public address yet: the link still works, but no webhook is added, and the result warns that pushes will not deploy the app until the panel has a public address.

Status reporting. Every deploy of a linked app is reported to the Git host against the commit it builds:

  1. pending ("Waiting to deploy") when the deploy starts. The commit is pinned here: the one asked for, or the head of the app's branch as the host reports it.
  2. building.
  3. live (with the site's https address as the environment address, when the app has a site) or failed (with the plain reason).

Each status links back to the deploy in the panel (/apps?app=<id>&deploy=<deploy>). On GitHub, each deploy is also a GitHub Deployment of the app's environment. A host that refuses never fails the deploy: the refusal is kept on the deploy as a warning (hook_warnings), and the host's deployment id is kept as provider_deployment.

Webhooks. Each linked app has one webhook, at <panel address>/api/v1/hooks/apps/<app id>. Its secret is kept in the vault, made once and reused. The public route only forwards the request; the apps module checks the signature (GitHub and Gitea X-Hub-Signature-256, Bitbucket Cloud X-Hub-Signature, GitLab's token header) and refuses a bad one, with an audit entry (apps.webhook.denied). The four providers' events are read the same way.

  • A push to the app's branch of its repository deploys the pushed commit.
  • A push to another branch, a deleted branch, a tag and any other event are ignored, and the answer says why.
  • ping is answered with pong.
  • A pull request event is ignored for now: previews come in a later slice.
  • A request with a JSON body and no event header still deploys the branch head, as before.

Not built yet (card N, later slices): pipeline steps and build caches, environments (staging and promote), pull request previews, the CI deploy step (GitHub Action and GitLab CI template), and runners.

Not done / needs core

  • UI bundle (card w6-05), per-site "deploy status" in the web module.
  • Runtimes are per account, not shared (disk); mise compiles Ruby/PHP/Python from source for some versions (needs the allow-listed build packages, installed on demand).

Customisable apps (w9-06)

Presets are starting points: every field of an app is editable (apps.app.update, with dry_run = field diff).

  • Fields: runtime + version (any mise spec shaped like a version/alias; the agent refuses what mise cannot resolve), commands, process types (workers, cron, release = migrate), ports, working directory, docroot, shared paths, release retention, health path + timeout, restart policy, per-process resource limits (sub-limits inside the account slice, so never above the plan), deploy mode. Stored in apps columns plus apps.config (AppConfig).
  • Env scope: each variable is both (default), build (build/migrate/hooks only) or runtime (running processes only). A secret shows set: true, never its value; saving it with an empty value keeps the stored one.
  • Deploy hooks: pre_build, post_build, pre_release, post_release, post_deploy, argv lists run in the release dir. A failing hook before the switch fails the deploy and removes the release; post_deploy failures are warnings.
  • Custom preset: preset: custom starts empty (no framework detection).
  • Templates (apps.template.*): save any app (secrets keep their name only), versioned per (scope, owner, name), scopes global (admin) / reseller / account. Export/import is YAML (apiVersion: respirecloud/app-template/v1, keys are the JSON field names, strict: unknown keys refused). apps.app.create takes template: {id|name,scope,version}; fields in the request win over the template. Store packages: the Store verifies the signature and calls the internal apps.template.install_signed {yaml, store_ref} (becomes a global template, source: store).
  • respirecloud.yaml / Procfile in the repository (read after checkout, strict schema, argv only, nothing executes that is not declared): runtime: node@22, build, release, start, health, health_timeout, restart, workdir, docroot, shared, env, build_env, hooks.*, workers: {name: cmd}, cron: {name: {schedule, command}}. Procfile: web = start, release = migrate, other types = workers. It overrides the app for that deploy (the deploy row lists the fields: override_file, overrides); panel variables win over the file's env (a repo cannot clobber a secret); limits and secrets are not overridable. apps.override.preview shows the changes before deploying; the app can opt out (config.no_repo_file). Known limit: a later panel-side unit rewrite (env change without redeploy) uses the panel's values until the next deploy.
  • Per-app nginx snippets: apps.nginx.get/set go through web.layers.get/set on the app site's layer (allow-listed, validated with line numbers, drift rules and dry-run nginx diff apply).
  • Deploy rows carry auto_reverted (failed after the switch and went back by itself).

Container apps: Dockerfile and Compose modes (w9-15)

mode: dockerfile | compose (config dockerfile / compose_file paths, container_port, default 8080). Needs Docker on the node (an administrator installs it with containers.runtime.install). Code: internal/agent/apps_container.go.

  • Release = a checkout of the repository (release list, marker, current and keep work as before) + one local image per built service, rc-app-<account>-<app>-<service>:<release>, labelled rc.account/rc.app/rc.release.
  • Dockerfile mode: the agent generates a one-service compose file (build: the repository, publishes the container port on 127.0.0.1:<app port>, runtime variables as ${KEY} references, PORT=<container port>, the app's limits). Compose mode: the repository's compose file (compose.yaml, ...). Both go through the containers module's strict validator and renderer (modules/containers/compose), extended only with build: for the app's own repository: context/dockerfile must be repository-relative (no absolute path, .., URL), args literal, target allowed; ssh, secrets, additional_contexts, network, cache and platforms are refused. Everything else stays refused exactly as in the containers module: privileged, host network/pid/ipc, devices, cap_add outside the allow-list, host-path mounts, non-loopback ports. An app publishes one port (the site proxies to it); other ports stay internal. The rendered compose adds the account slice as cgroup parent, caps, no-new-privileges, pull_policy: never for built images.
  • Build: docker build with BuildKit on the node's Docker daemon, streamed to the job log. Secret build variables (env scope build/both + secret) are BuildKit secrets (RUN --mount=type=secret,id=KEY): written to a root-only temp dir, removed after the build, never --build-arg, so docker history / image config do not show them; their values are redacted from the job log and the stored log. Non-secret build variables are --build-arg.
  • Run: the stack app-<name> (so app names are at most 27 characters in these modes) is applied through the containers driver; the plan's per-service ceilings come from the limits apps.container_cpu / apps.container_memory_mb. Healthy = the containers' healthchecks plus, when the app has a health path, an HTTP check on its port.
  • Failure and rollback: a failure after the new containers started re-applies the previous release's compose (the previous images are still there) and deletes the new release and image. apps.deploy.rollback re-applies an earlier release's stored definition (rel-<id>.in in the root-only stack directory) with its image; if that image was pruned the rollback says so. keep prunes old release directories, their images and stored definitions.
  • Operate: status lists the compose services (the app service = unit "", others worker:<service>), logs and start/stop/restart go through docker compose; an env change (apps.units.apply) re-applies the current release. Removing the app removes the stack, its images and (with purge) its volumes.
  • Limits of this version: BuildKit runs build steps in the Docker daemon's cgroup, so a build is bounded by a timeout (25 min) and the node, not by the account's slice (a per-build slice would need a daemon change; see the handover). Workers/cron of buildpack mode do not apply (use compose services). The container stack name app-<name> is also reachable for a user through containers.stack.* (same account); do not reuse it there.

Fast mode: an optimised container generated per preset (w12, ADR 0031)

mode: fast (config fast_server: auto | classic, container_port, default 8080). Code: generator modules/apps/fastgen (pure, embedded templates, golden tests in testdata/), agent internal/agent/apps_fast.go. The app never boots the framework per request where the app supports it, and nobody writes a Dockerfile.

  • What happens: after the checkout the agent writes .respirecloud/{Dockerfile, Dockerfile.dockerignore, compose.yaml} (+ entrypoint.sh, php.ini for PHP) into the release (a .respirecloud/ from the repository is replaced; nothing is committed), then the dockerfile/compose pipeline above runs unchanged (validator, account builder, slice limits, release images, health, rollback, env re-apply). A repository with its own root Dockerfile keeps it (dockerfile behaviour). The preset is the app's (apps.preset), detected again on the checkout when it is auto/custom or not covered.
  • Covered: Laravel, Symfony, WordPress, Drupal, PHP (Composer) on FrankenPHP; Next.js, Nuxt, SvelteKit, Remix, NestJS, Express/Fastify/Koa, Node; Django, Flask, FastAPI, Python on gunicorn. Other presets are refused with that list.
  • PHP worker rule: worker mode only when the app ships it: laravel/octane (Octane octane:frankenphp, workers from the app's CPU/memory limits, --max-requests=500) or runtime/frankenphp-symfony; else classic FrankenPHP. Octane is never added to an app. fast_server: classic forces classic.
  • Laravel: extensions from composer.json ext-* + the usual set; composer install --no-dev, authoritative class map; Vite build in a node stage when package.json has build; OPcache with validate_timestamps=0, JIT off; non-root. At container start the entrypoint runs config:cache route:cache event:cache view:cache (env is there then), then the server. storage is a named volume shared by app, queue (Horizon when installed, else queue:work), scheduler (schedule:work) and reverb (when installed, internal only). Health: /up when bootstrap/app.php declares it.
  • Release step: the app's migrate argv lists (Laravel: php artisan migrate --force) run once per deploy in a one-off container of the new image (docker compose run --rm --no-deps, the new release's rendered definition: same network, volumes, variables, slice) before the new containers start; a failure stops the deploy before the switch. Only the fast mode runs it (dockerfile/compose modes have none).
  • Env changes restart every service of the app (every service references every variable, so compose recreates them).
  • Base images are pinned by digest in catalog/versions.json, component app-images (frankenphp-php8.5, composer-2, node-24, python-3.13); a family whose image is not pinned is refused.
  • Developer tool: FASTGEN_TREE=<checkout> go test ./modules/apps/fastgen -run TestWriteTree writes the files for a local tree. go test ./modules/apps/fastgen -run TestGolden -update rewrites the golden files after a template change.
  • Not covered yet: switching a non-Octane app to worker mode (a code change), a public route to Reverb, Rails/Go/other presets, run-once commands (apps.command.run) for container apps, trusted proxies (Laravel needs trustProxies to see HTTPS behind the site proxy, as in the dockerfile mode).

Store app templates

The Store publishes app-template items (signed channel metadata with k-of-n threshold, expiry and a monotonic version; the package's release-role attestation covers template.yaml only; per-template rollback floor). store.template.list shows them with version and publisher; store.template.install verifies and calls the internal apps.template.install_signed {yaml, store_ref} as the system actor (becomes a global template, source: store).

Build isolation (w11-30, proven on a real Docker node in w11-56)

An account's image builds run in the account's own slice. Before, docker build ran in the Docker daemon's cgroup: the account's memory / CPU limits never saw the build. Now the first Dockerfile or compose build of an account starts a BuildKit daemon for it, a container rc-buildkit-<user> created by the agent with --cgroup-parent rc-acct-<user>.slice, and every build goes through the buildx "remote" builder rc-build-<user> that talks to it through docker exec (no socket on the host). The builder container is capped at 75 % of the slice's MemoryMax (no swap), below the slice's MemoryHigh, so a step that wants more is OOM-killed inside the builder at once and the customer reads "the build ran out of memory and was stopped: a build may use up to N MB of your plan's memory" (not a stall until the 25-minute build limit, and not the account's running apps starved by throttling). CPU is the slice's CPUQuota (throttled, cpu.stat). The cache lives in the account's own BuildKit daemon, so another account cannot read or poison it.

  • The builder image is pinned by digest in the version catalogue (catalog/versions.json, component buildkit, binaries.image.sha256; a signed catalogue overrides it): the agent runs moby/buildkit@sha256:<digest>, never a tag.
  • Why not buildx's own --driver docker-container --driver-opt cgroup-parent=... (w11-30's first design): measured on a node, buildx records the option but the container stays in system.slice (CgroupParent empty): that path never bounded anything. The agent creates the container itself.
  • The builder is rootless (w11-67). BuildKit runs in its rootless mode (moby/buildkit:<v>-rootless, pinned by digest as binaries.rootless in the catalogue): the container has no --privileged and no --userns host; BuildKit makes its own user namespace inside it. Proven on a real Docker 29.9 node (userns-remap on): a build step's root has uid 0 inside, and read from the node /proc/<pid>/uid_map of the step is 0 101000 1 / 1 102000 60000, Uid: 101000; the step is in rc-acct-<user>.slice/docker-<id>.scope/...; a step that allocates a GB under a 192 MB cap is killed inside the builder (memory.events max 198, oom_kill 1, exit 137) while Docker and the builder stay up. To get there the container is started with --security-opt no-new-privileges=false (the daemon sets it for every container and that stops the setuid newuidmap: "Could not set caps"), seccomp, apparmor and systempaths unconfined (BuildKit needs unshare and mount in its own namespace; it holds no capability in the node's), and /etc/subuid / /etc/subgid replaced by a root-owned file (/run/rc-buildkit/subid, user:2000:60000: container ids, which the daemon's remap places at host 102000+). That range is only safe when the daemon remaps, so the agent refuses the rootless builder on a daemon that does not (docker info must show userns). The builder is reached through buildx docker-container://rc-buildkit-<user> (docker exec ... dial-stdio): there is no socket on the host any more.
  • What rootless costs. Root in a step is an unprivileged uid of the node, with 60001 ids (not all 65535): a Dockerfile that needs uid/gid above 61999, RUN --security=insecure, mounting a device or a filesystem, or loading kernel modules no longer works (it never did without an insecure entitlement). chown 4242:4242 works (measured). Only the BuildKit process sandbox is off (--oci-worker-no-process-sandbox: a step can see the other processes of its own builder, nothing else). The first build of an account takes a few seconds longer to start the daemon (rootlesskit sets up its namespace).
  • Kernel settings. Rootless needs unprivileged user namespaces: user.max_user_namespaces above 0 and, where the kernel has them, kernel.unprivileged_userns_clone=1 and kernel.apparmor_restrict_unprivileged_userns=0 (Ubuntu 24.04+ sets it to 1, which may stop the builder; the lab host has it at 1 and the builder still ran inside the lab node's container). The installer's preflight reports the setting by name (install/lib/preflight.sh, userns_blocker) and the agent refuses the build with the same name when max_user_namespaces is 0 or unprivileged_userns_clone is 0; it appends the setting to the error when the builder cannot start.
  • The privileged builder, only behind an administrator's switch. RC_APPS_BUILDER_PRIVILEGED_ACCEPT_ROOT_RISK=1 in the agent's environment (a systemd drop-in, root only) brings back the w11-56 builder: --privileged --userns host, the socket in /run/rc-buildkit/<user>/. Build steps then run as the node's real root behind Docker's default sandbox. The build log says so on the first build. It is never chosen on its own; a builder of the other mode is replaced (its cache is lost).
  • Idle builders stop. A builder sits idle at memory nobody uses: after 15 minutes without a build (RC_APPS_BUILDER_IDLE_MINUTES, 1 to 1440) the agent runs docker stop on it (checked once a minute; never while a build runs); the cache stays in the container. The next build starts it again and the build log says "starting the builder".
  • Lifetime. The builder is removed (container, buildx instance, cache) when the account is deleted (userRemove) and when the account's last container app is removed. A changed plan updates the cap on the next build.
  • Base images (FROM x) are pulled by BuildKit itself, not taken from the daemon's local images.
  • Podman / no Docker: container apps (dockerfile / compose modes) need Docker; there is no Podman path in the agent, before or after this change, so there is nothing to keep. If the builder cannot be created or started the build is refused with the reason; it never falls back to the daemon.

Address at create time

App creation can include address and https. Clear Address to create a private app. The app-domain name needs no separate ownership TXT record.

Pipelines, environments and webhook secrets (w12 card N)

  • Pipeline steps. pipeline: in respirecloud.yaml (an ordered map name: command, or name: {run: ..., timeout: 300}) or config.pipeline on the app ([{name, argv, timeout_sec}], at most 20; the repository file wins, like build). The agent runs them as the account user in its slice, in the release folder with the build environment, after post_build and before pre_release. The first failing step stops the deploy: the release is removed, the running version is untouched, the error names the step ("the check test failed (exit code 1) ...") and the step's output is in the deploy log. deploys.steps keeps {name, ok, skipped, exit_code, seconds, error} for each step and deploys.failed_step the one that stopped it. A step has 600 s unless timeout says otherwise (3600 at most). Container apps (dockerfile, compose, fast) run the steps in a one-off container of the image that was just built (service app, else the first built one), before their release step.
  • Cache. cache: (or config.cache) lists up to 10 folders of the release. After a green build and pipeline they are copied to ~/apps/<app>/cache/<folder>; the next deploy puts them back before it builds. Best effort: a problem is a warning in the log. Buildpack apps only (containers use BuildKit's own layer cache). Purging the app deletes them.
  • Environments. apps.environment.create adds a staging app (<name>-staging, parent_id = production, environment = staging): own branch (default staging), port, release folder, domain and, with a Git connection, own webhook and deploy key. Settings and variables are copied (secrets too; the plan warns that staging may point at production's services). It counts in the account's app limit. apps.environment.list shows the family from any member. Deleting production deletes its environments first.
  • Promote. apps.environment.promote (staging app) ships staging's running build to production. Buildpack apps with a movable build (system, node, bun, deno, go; same runtime, version and mode on both sides; production deployed once) copy staging's release folder into a new production release (the agent op apps.deploy.run with promote_from): no fetch, no build, no pipeline; links into staging's shared/ are replaced by production's; then production's own migrations, health check and rollback apply. Everything else (containers, Python/Ruby/Java builds, production never deployed) builds the same commit again with production's variables. The deploy has kind promote and source = <staging app>@<release>. Values a build bakes in at staging time stay as built.
  • Webhook secret rotation. apps.webhook.rotate also updates the Git host for a linked app: the git module adds a new webhook with the new secret (git.repo.hook.add), the panel stores the secret, then the old webhook is removed (git.repo.detach). If the host refuses, the secret is not changed; an app that is not linked only changes the panel's secret. A panel without a public address cannot give the host a new secret and refuses to rotate a linked app.

Processes, scheduled jobs and queues for real projects (card P, w12)

Projects such as nerix run a dozen long-lived processes with their own settings, from a folder on the server. Code: agent internal/agent/apps_proc.go (units), apps_checkout.go, cronrun.go, queues.go; control plane modules/apps/cp/process.go, cron.go, queues.go, adopt.go; PM2 reader modules/apps/pm2; plain-words schedules internal/cronspec; screens modules/apps/ui/src/{procs,cron,queues,adopt}.tsx. Decision record: ADR 0033.

  • Each process (the main one and every worker) is a systemd service with its own settings (agentop.AppsProc): variables on top of the app's (app_proc_env; secrets in the vault apps/<app>/p/<process>/<KEY>, written to /etc/respirecloud/apps/<user>/<app>.<process>.env, root:user 0640, read after the app's file), PORT, MemoryMax, CPUQuota, TasksMax, TimeoutStopSec and KillSignal (stop wait and signal), restart policy, RestartSec, backoff (RestartSteps + RestartMaxDelaySec, systemd 254+), StartLimitBurst, working folder, health path, instances, a scheduled restart (rc-rst-<user>.<app>.<process>.timer, PM2's cron_restart) and an optional log file. Actions: apps.process.list|set|delete|scale, each with dry_run. apps.workers.set still replaces the whole list.
  • Instances. instances: n writes n units <worker>.1 .. <worker>.n; copy k gets PORT = port + k - 1, INSTANCE_ID=k and NODE_APP_INSTANCE=k-1. PM2's cluster mode shares one port between copies; that cannot be copied for arbitrary programs, so copies listen on their own ports (the import says so). The main process runs once.
  • Log files. log_file makes systemd append to /var/log/respirecloud/apps/<user>/<app>/<process>.log. The folder and file are root-owned (never a path the user controls; systemd opens it as root), rotated by logrotate each hour (rc-apps-logrotate.timer, size and kept files per process). apps.logs.get reads the file when there is one, else the journal.
  • More than 10 workers. The fixed cap is now the plan limit apps.workers (default 50; instances count). The agent keeps a hard ceiling of 500 and re-checks the limit the control plane sends (AppsSpec.MaxWorkers).
  • Run from a folder (apps.app.adopt, config.checkout): an app whose code is a folder inside the account's home (the agent resolves it as the account user and refuses anything outside the home). No release folders, no clone, no deploy key. apps.deploy.run runs hooks, build and migrate steps in the folder as the account user, rewrites the units and restarts them (op apps.checkout.deploy); a failing step stops before anything restarts. There is no rollback (the folder is the only copy) and no webhook. Status "release" is checkout. Everything else (variables, processes, logs, cron, run once, site link) is as for any app. An app that is only workers needs no main command.
  • PM2 import, env modes. env_mode: live (default) stores no variable value: each process starts through respirecloud-agent pm2-exec --file F --name N [--env E] -- command, which evaluates the ecosystem with node at every start (so a change to the project's .env shows after a restart), merges the env it computes over the unit's, and execs the command; the panel keeps units, limits, restarts, logs and health, and the plan lists variable names only. A .json file is read by pm2-exec itself and needs no node; a .js/.cjs file needs node: the server's own, else the newest one the account installed through the panel (mise, ~/.local/share/mise/installs/node/*). The import preview of a .js file without node fails with a plain message (install Node.js, or save the file as .json). A later change to a process (apps.process.set, apps.workers.set, the settings save) keeps the eco_* fields unless it names another file, so the process keeps reading the file; the settings save also keeps the app's folder (config.checkout). env_mode: copy copies the values (secrets to the vault) and does not read the file again.
  • PM2 import (apps.import.pm2): reads ecosystem.config.js|cjs|json. A JavaScript file is evaluated by node in a child started as the account user with PrivateNetwork, a read-only home, 256 MB, 25 s and 64 tasks, printing JSON only (apps.pm2.read); ecosystem takes the JSON directly. Mapping: name (lowercased, _ to -), cwd (must be inside the project folder), script/args/interpreter/interpreter_args/node_args to argv, env (+ env_<name>), instances, max_memory_restart to the memory limit, kill_timeout to the stop wait, cron_restart, restart_delay, max_restarts, autorestart false to "never", out_file/error_file to a log file; variables every process has with the same value become the app's; names that look like secrets (PASS, SECRET, TOKEN, KEY ...) or URLs with a password go to the vault. The first process with a PORT that runs once is the main process (its port becomes the app's port). watch, wait_ready and similar are reported as not used. The dry run lists every process; nothing starts until Deploy (or deploy: true).
  • Scheduled jobs. apps.cron.set takes, per job, timezone, timeout_sec and alert_after (default 3). A job is a timer + oneshot service whose ExecStart is respirecloud-agent cron-run: it runs the command as the account user, mirrors the output to the journal and leaves one JSON record (exit code, seconds, output tail 32 KiB) in /var/spool/respirecloud/cron/<user>/ (outside the panel's 0750 data folder, which an account user cannot enter; root-owned 0711 parent, the account's own folder). The agent reads records with os.Root, so a link in that folder is never followed; a user can only write records about their own jobs. A one-minute collector (apps.cron.collect) copies them into app_cron_runs (kept 60 days), keeps app_cron_state (failure streak) and, when the streak reaches the job's limit, raises one notice (core.notice.raise) and the event apps.cron.failed; a success clears it. apps.cron.list shows the plain-words schedule (internal/cronspec), the expression, the next run, the last run and the streak; apps.cron.runs the history (one run in full with run_id); apps.cron.run starts a job now. Overlap: systemd never starts a oneshot service that is running, so a job cannot run twice at once and "run now" on a running job says so. Time zones use systemd's calendar time zone suffix. A cron expression that gives both a day of the month and weekdays is refused (cron means "either", a timer means "both"). Records are looked up two hours back from the last one seen, so a job that runs longer than two hours can be missed.
  • Queues (apps.queue.list|jobs|retry|forget|watch): the agent reads the code (apps.queue.detect: composer.json, package.json, requirements, pyproject, Gemfile) and the control plane works out the connection from the app's variables. Read where it can: BullMQ/Bull (<prefix>:<queue>:wait|active|delayed|failed|completed, meta), Laravel (<redis prefix>queues:<name>, :delayed, :reserved; the database driver on PostgreSQL), Horizon (same keys), Celery (list length of the queue names from -Q), Sidekiq (queue:*, schedule, retry, dead), RQ (rq:queue:*, rq:failed:*), procrastinate (procrastinate_jobs by status, throughput from the events table is not read yet). Retry and forget work for BullMQ, Sidekiq, RQ and procrastinate in the store; Laravel runs php artisan queue:retry|forget in the app. The agent connects only to a store on this machine (127.0.0.1, ::1, localhost or a unix socket under /run): a queue on another server is reported as not readable. The consumers of a queue are the app's workers whose command matches the system; they are scaled with apps.process.scale. apps.queue.watch arms an alert (waiting above N, or failed jobs at M or growing by M); apps.queue.tick (every 5 minutes) raises one notice per episode.

Stopping, stop waits and PM2 import choices (slice p1-stops-overrides)

  • Gentle restarts (2026-10-28). A change restarts only the processes it reaches: the node rewrites the unit files and restarts a process only when its own unit file, its own variables or the app's shared variables differ from what it ran with. A worker's variables restart that worker; a cron change restarts nothing; a variable used only to build restarts nothing; apps.reconcile restarts only what drifted. Every plan preview (apps.process.set, apps.workers.set, apps.process.scale, apps.app.update, apps.env.set) lists exactly which processes restart. "Restart the whole app" is the explicit apps.unit.control with unit: "all".
  • Per-process stop and readiness settings: kill_signal (for example SIGINT for uv run wrappers: systemd's SIGTERM reaches the workers twice through uv), stop_timeout_sec, before_stop (one shell line, run by systemd ExecStop before the signal, for example a drain call; its failure never blocks the stop) and ready with ready_timeout_sec (default 60): an http(s)://127.0.0.1... address that answers below 400, a tcp://127.0.0.1:port that accepts a connection, or a command that ends with success; ${PORT} is the process's own port. A restart is rolling, one process at a time, whenever any process in the set has a before_stop or a ready: each must be ready before the next stops, and the first one that is not ready ends the restart (the rest keep running). Without them the restarts go together as before. The node keeps the gates in /etc/respirecloud/apps/<user>/<app>.gates.json so a plain restart knows them too.
  • The memory limit (MemoryMax) counts the whole process tree: a Chromium or esbuild child counts against the parent's limit. The help text and the import preview say so.
  • Every process unit says KillMode=control-group: the stop signal (KillSignal, default SIGTERM) goes to every process of the unit, so a wrapper such as uv run that does not forward it cannot leave its child running.
  • Actions that stop or restart processes wait up to 1500 s, so a 620 s stop timeout (up to 3600 s per process) is honoured.
  • apps.import.pm2 maps pm2's autorestart (true or absent) to restart always, as pm2 behaves, false to no; max_memory_restart to the memory limit (counted over the whole process tree), kill_timeout to the stop timeout, and wait_ready / listen_timeout to a readiness check on the process's port (tcp://127.0.0.1:${PORT}) with that wait. apps.import.pm2 takes only (PM2 names to bring) and overrides (per process: stop_timeout_sec, kill_signal, before_stop, ready, ready_timeout_sec, memory_mb, instances, restart_delay_sec, port, env). Both show in the dry-run plan. An env override such as HOST=127.0.0.1 is stored with the process and wins over the ecosystem file (pm2-exec --keep).
  • Deploys tab: each deploy lists its checks (steps) with passed, failed or not run and the time each took. A failed one names the check; "See the output" shows that check's part of the deploy log. /apps?app=<id>&deploy=<id> (the link on a commit status) opens the app on its Deploys tab with that deploy open.
  • Staging tab: production and the staging copy, each with branch, address and last deploy; "Add a staging copy" (apps.environment.create) and "Promote staging to production" (apps.environment.promote) both show their plan first, with the shared-database warning.
  • Settings: "Checks before release" (name, command, time limit) and "Folders kept between builds"; the same as respirecloud.yaml is under "Show details".
  • Times of scheduled jobs (walk apps/12): the agent reports a job's next run as RFC 3339 (UTC) and the server's zone; apps.cron.list gives each job a zone (its own, else the server's) and the screen shows last run, next run and the history in that zone, in one format.
  • Deep links: /apps?app=<id>&tab=queues opens an app on one tab (deploys, settings, env, staging, git, procs, cron, queues, web).

New app starts with the code, then the address (UX round, group 2)

  • New app asks "Where is the code?": a repository of a connected Git account (account, repository and branch pickers, the same as Repository > Link; one connected account is chosen for you), a folder on this server (with how it starts), a Git address, or a template. What it is is found for you: apps.app.detect now takes git: {connection_id, repo}. A GitHub App connection is read at once; a deploy-key connection has no key before the app exists, so it answers note and the kind is found on the first deploy. The kind is a pick list, pre-selected when found.
  • Address (apps, stacks and catalog installs): not yet, one of my domains (also a new subdomain or domain), or a name under the server's app domain. The first two use web.sites.add (one preview, one job); the last is the old address of create. An existing app gets "Give it an address" at the top of its page.
  • Processes: "How many copies" (apps.process.scale, 0 switches a worker off and keeps its settings) and "Deploy some processes" (apps.deploy.run with only).
  • apps.process.set is a patch: a setting that is not sent keeps its value. instances: 0 on a worker means switched off (stopped; the node gets no unit, so nothing restart-loops); on the main process it is refused. Ecosystem files (eco_file, eco_name, eco_env) can be set on workers and the main process by apps.app.update, apps.workers.set and apps.process.set: the path must be inside the account's home and the file must read (apps.pm2.read), so an app whose folder moved is re-pointed with --config checkout plus the new eco paths. apps.unit.control accepts "" or "main" for the main process and explains when an app has none. apps.app.update previews a changed folder or main process.

Adding an app from a folder (w14)

  • apps.app.detect with path (a folder inside the account's home) reads the folder in place and answers how it starts: folder.kind, runtime, version, build, start and source in plain words (the web line of a Procfile, the start script or main file of package.json, a Go module, a FastAPI or Flask file). PHP, Docker and plain-file folders get a note saying where they belong instead of a start command.
  • apps.app.adopt without start (and without workers) does the same reading and fills start, build steps and runtime; the preview and the result say where the command came from. If nothing is found, the error asks for the command.
  • A runtime other than system is installed for the account before the app is made, so the first start does not exit because the runtime is missing. Adopt is therefore a job.
  • rcctl apps app adopt --start "node server.js --port 80" is read as words (quotes keep a word whole); the JSON form --start '["node","a.js"]' still works.
  • Serving an app on a domain whose site has another type switches that site with web.sites.kind.set, so its certificate, redirects and files stay. Only an empty new PHP site wanted as static files is still replaced.
  • A repository of a Git connection is detected before the first deploy for a GitHub App connection; a deploy-key connection has no key before the app exists, so its framework is found on the first deploy (the screen says so).