Deployments

Put a project from a git repository on your server and keep it deployed. The code is fetched and built on the server, started under PM2, checked for health, and the previous release is kept one step away.

How a deployment runs

  1. Fetch — a fresh checkout into its own release folder. The running release is never built over.
  2. Settings — read from ez.json, then package.json, with anything you set on the app taking precedence.
  3. Pre hook → steps — the ordered steps run in the new folder, with the paths listed under persistent data linked in first. Install, build, migrate and custom steps run in list order; a disabled step is skipped.
  4. Switch — the old process is stopped and the new one started under PM2, as ez-<name>. A cluster app that is already running in cluster mode is reloaded instead, with no downtime.
  5. Health check — the app must answer on its port and stay online under PM2 before the deployment counts.
  6. Post hook, then old releases are pruned.
💡 Nothing before the switch touches what is running, so a broken build or a failed migration costs nothing. If the new release crashes at boot — it exits, PM2 restarts it, or the health check fails — the previous release is started again automatically and the run says why. The switch itself is a restart: the app is down for as long as it takes to start.

When the new release does not start

A health check on its own can be fooled by a release that answers once and then crash-loops. So a release also has to stay online under PM2: a process PM2 reports as errored or stopped, or one that keeps restarting over the confirmation window, fails the deployment even though a probe answered. In cluster mode every worker is watched, and one bad worker fails the release even when the others are healthy.

When that happens the previous release is started again, and the failed run carries a rollback report:

  • Reason — for example crashed at boot: restarting 3 times, crashed at boot: process is "errored" — it exited instead of listening on port 3000, or health check failed: ….
  • Whether the previous release came back — the run distinguishes "rolled back to the previous release" from "the rollback also failed, the app may be down". There is nothing to roll back to on a first deployment, and automatic rollback can be switched off per app.
  • The last lines of the new release's PM2 output, with every environment value on the app replaced by ***. They are read before the rollback reuses the PM2 name, so they still belong to the release that failed.

Runtime and presets

Every app records the runtime it runs on. Node.js is the only one you can select today; Python, Go and a static site appear on the same card row, disabled and labelled Coming soon, so the plan is visible rather than a field that silently does not exist. The runtime is stored on the app and in ez.json; cluster mode is available for node only.

Under the Node.js card, a Preset fills in a starting set of commands:

PresetProposes
Default Node appnpm ci, then npm start
Next.jsnpm ci and npm run build, then npm start
NestJSnpm ci and npm run build, then node dist/main.js
Express / Fastifynpm ci, then node server.js
Nuxtnpm ci and npm run build, then the Node server

A preset only proposes commands. It asks before replacing anything you already wrote, and it never starts a deployment. Check the project's real start and build commands before relying on one — a preset is a starting point, not a detection.

Steps

What a deployment runs is an ordered list of at most five steps. Each one is a command line, a kind, and an on/off switch. It can be set on the app in the dashboard or in the Hub, or in ez.json.

  • Kinds — install, build, migrate and custom. The first three keep their old behaviour (a migration still carries the forward-only warning); a custom step is just a command in the list.
  • Order is the list. Drag a row, or use its move-up / move-down buttons — the buttons are the keyboard-accessible way and focus follows the moved row.
  • Disable instead of deleting when you want to keep a command for later. A disabled step is skipped and the deployment log says so.
  • A failure stops there. A non-zero exit aborts the deployment before the switch, so the running release is untouched. The run record's step is the kind, or step N (its 1-based position) for a custom step.
  • Order warnings, never errors. A migrate before install, a build before install, or a migrate before build will probably fail — only enabled steps count — and the warning says which step to move. It is shown beside the list, not used to refuse the save.

Old apps keep working. The older install, build and migrate settings are still read as the equivalent steps, so nothing has to be migrated by hand. One catch: an app whose saved settings still use those fields keeps winning over a steps list in ez.json — its commands are what deploys — and the app says so. Save the app's commands as steps to make the choice explicit; saving with steps removes the old fields.

When you have not overridden the list, the form cannot show the file's steps: the API returns what the app overrides, not the resolved ez.json list. It shows a read-only inherited from ez.json panel and an Override steps button instead of guessing. Leave the override empty and the file decides.

Requirements

  • git on the server, on the PATH of the Easy DevOps service.
  • PM2 — install it yourself with npm install -g pm2. Easy DevOps does not install PM2 and the dashboard has no install button; when PM2 is missing, the Deployments page says so and links to Processes, which only reports its state.

There is no CLI deploy command. A deployment is started from the dashboard, from a GitHub Action through the deploy hook, from the Hub, or by CI calling the Hub.

Your first app

  1. Open Deployments in the dashboard and press New app.
  2. Give it a name, the repository URL and the branch.
  3. Choose how the server reads the repository (below).
  4. Press Deploy and watch the log.

A plain Node project needs nothing else: with no ez.json, Easy DevOps installs with the lockfile's package manager, runs the build script if there is one, and starts the start script.

Repository accessURL formHow it works
Publichttps://…No credentials.
Deploy keygit@github.com:owner/repo.gitA new app generates an ed25519 SSH key as it is created. You add its public half to the repository under Settings → Deploy keys, read-only, or let the GitHub tab do it. The private half never leaves the server.
Access tokenhttps://…A personal access token stored on the server and sent only to the repository host. Read access to the one repository is enough.

Deploy keys, in one step

With Private — deploy key (SSH) selected, Generate a deploy key for me is on by default. The app is created without starting a deployment, and the key is written in the same step: an ed25519 key in the app folder, with mode 600 (on Windows the data folder's ACL applies), so only the account Easy DevOps runs as can read it. The response shows the public key, its SHA-256 fingerprint, and an Add deploy key link straight to the repository's GitHub settings. The private half is never in a response.

  • Test connection runs git ls-remote with the app's key against the repository. For github.com it checks the server against GitHub's published host keys (StrictHostKeyChecking=yes, never accept-new) and stops after 12 seconds. A wrong key, a changed host key, DNS, port 22 and a missing git each get their own reason and what to do next. Another SSH host is not tested; a deployment to one still uses accept-new.
  • Add it to GitHub for me takes a GitHub token typed for that request. The token is used once and not stored. The key is added read-only, and an older key with the same title is removed only after the new one is on the repository. A GitHub refusal is reported per step, so you can see whether the key or the old-key cleanup failed.
  • Regenerate key replaces the private half at once, so the old key stops working on this server immediately. It is refused while a deployment is running, and the result names the previous fingerprint because GitHub still lists the old public key until someone removes it.
  • An app created before this keeps its RSA key and keeps working until the key is regenerated. Nothing changes under it.

The private key is written only to ez_deploys/<app>/id_deploy; the pinned github.com keys are kept beside it in known_hosts. Neither the key nor a PEM block ever appears in a response, log, event or Hub payload. Live deployment lines redact the app's environment values and token before they leave the server.

ez.json

Optional. Put it in the repository to keep the commands with the code. It is looked for at ez.json, then deploy/ez.json, then .deploy/ez.json.

ez.json
{
  "runtime": "node",
  "steps": [
    { "run": "npm ci", "kind": "install" },
    { "run": "npm run build", "kind": "build" },
    { "run": "npx prisma migrate deploy", "kind": "migrate" }
  ],
  "start": "node dist/server.js",
  "port": 3000,
  "health": "/healthz",
  "execMode": "cluster",
  "instances": "max",
  "persist": ["data", "uploads/imgs"],
  "hooks": {
    "pre": "node scripts/check-env.js",
    "post": "node scripts/warm-cache.js"
  }
}

An older file that still uses install, build and migrate as single fields deploys exactly as before; each one is read as a step.

FieldValueWithout it
runtime"node" — the only one accepted todaynode
stepsUp to five ordered { run, kind, enabled? } entries — see stepsThe old install/build/migrate fields, then package.json
installA command, a list of commands, or false to skip — still accepted, read as an install stepnpm ci with a lockfile (yarn and pnpm are detected), else npm install
buildSame, read as a build stepThe build script, if the project has one
migrateSame, read as a migrate step after build and before startNo migration step
startOne command — the long-running processThe start script, else node <main>
portThe port the app listens onNo HTTP health check; the process only has to stay up
healthA path, or { "path": "/healthz", "timeout": 60 }/, 60 seconds
execMode"fork" (one process) or "cluster" (one worker per instance)fork — exactly as before
instancesA whole number from 1 to the CPU count, or "max" for one per CPU1
persistFolders or single files, or a list of them, kept across deployments and rollbacks — see persistent dataNothing is kept; each deployment starts from the repository
hooks.pre / hooks.postCommands run before install, and after the release is liveNothing
  • The port is passed to your app as PORT, so the port in ez.json is the port it actually listens on.
  • With an explicit health path, only a 2xx or 3xx answer counts. With the default /, any answer that is not a server error does.
  • migrate runs after the build, in the new release, with the same environment as the build. A failing command aborts the deployment before the switch, so the running release keeps running.
  • Migrations are forward-only: rolling the code back cannot undo a migration that already ran. Keep each migration backward-compatible for one release.
  • A failing post hook is reported as a warning; the release stays live.
  • A mistake in ez.json stops the deployment before anything running is touched.

Cluster mode

Cluster mode runs one worker per instance under PM2 and can reload a deployment without downtime: the new workers start before the old ones stop. It is off by default — execMode is "fork" with one instance, which is exactly how every app ran before these fields existed.

  • instances must be a whole number from 1 to the number of CPUs on the server, or "max". The error names the CPU count when the value is out of range or not a whole number.
  • Cluster mode only accepts a Node app started by running a JS file directly: node dist/index.js or node server.mjs. npm start, yarn/pnpm scripts and non-Node commands are refused, because PM2 has to own the workers; the error tells you to change the start command to node <file>.
  • instances above 1 with execMode: "fork" is refused: several forked copies would all try to bind the same port. Choose cluster instead.
  • A deployment of a cluster app that is already running in cluster mode uses pm2 reload; the first deployment, or a switch between fork and cluster, still stops and starts. Rollback follows the same rule, using the mode recorded in the release.
  • The health check watches every worker. One errored, stopped or restarting worker is a boot crash and triggers the normal automatic rollback, even if another worker answers.
  • The app shows how many workers are actually up, for example Cluster · 3/4 online. That count comes from PM2, so a cluster that only partly started is visible rather than assumed healthy; with PM2 not running it reads 0.
⚠️ Cluster mode runs several copies of the app; it must be stateless (no in-memory sessions, sockets, caches or schedulers that assume one process). The dashboard shows this warning wherever the setting appears, but it never blocks a deployment.

Any language

When ez.json gives the commands, they are run exactly as written — the project does not have to be Node. PM2 keeps any program running.

ez.json — a Python app
{
  "install": "pip install -r requirements.txt",
  "build": false,
  "start": "python app.py",
  "port": 8000,
  "health": "/health"
}

Adding one to your project

  1. Open the app in the dashboard and go to its ez.json tab. It shows a file written out from what the app deploys with today — copy it, or download it.
  2. Save it as ez.json at the top of the repository, next to package.json, and change the commands to match your project.
  3. Commit and push. The next deployment reads it; its log shows where each value came from — [ez.json], [package.json] or [override].

A value set on the app in the dashboard overrides the file. To let the file decide, leave that field empty on the app.

A domain for the app

In the app's Domain & folder tab, type a domain name and optionally its www form. A new name is created; an existing domain is re-pointed at the app. nginx proxies it to the app's port, and a deployment that changes the port takes the domain with it. The validation and nginx output are the same as the Domains page.

  • The app needs a port — set on it, or in ez.json with one deployment done — otherwise the link is refused with what to do.
  • New certificate — issued over HTTP-01 at the same time (also covering www when chosen). If it cannot be issued (the DNS does not point here yet) the domain still works over HTTP; the result says why and you can issue it later from the SSL page.
  • The link shows its stages live — domain, the certificate stages, https, nginx test and reload, then HTTPS verification — in the same dialog, through ssl:progress. A failed link is reported once, with its cause and what to do next.
  • Existing certificate — choose one from the server's suggestion, wildcards included. Only the paths in that suggestion are used; a path typed by the caller is ignored.
  • No certificate — the link is HTTP only.
  • Redirect HTTP → HTTPS is on by default whenever a certificate is used, and the Behind Cloudflare option works exactly as it does on the Domains page.
  • A new wildcard certificate is refused. Wildcards need DNS-01, which linking does not do. Issue it from the SSL page, then link the app with that existing certificate.
  • The result is an ordinary domain: it appears on the Domains page and is edited there. Deleting an app asks what to do with its domain; the default is to keep it.

Where apps live, and moving one

New apps are created in the deployments folder: ez_deploys inside the Easy DevOps data directory by default, changeable in Settings. Changing the setting never moves an existing app — each app records the folder it was created in and keeps using it.

To move one, use Move app in its Domain & folder tab and give a folder. The app is stopped in PM2, its folder is moved to <folder>/<app name>, and it is started again from there. Moving to another disk copies every release and can take a while.

Environment variables

Set them on the app, one NAME=value per line — a pasted .env file works. They are stored on the server only, and are available to install, build, migrate and the running app. They are never written to the repository and never sent to the Hub.

Persistent data

Every deployment starts from a fresh checkout in a new release folder. That is what makes a failed build harmless and a rollback instant — but it also means the folder is disposable. A SQLite database, uploaded images, or a JSON log the app writes each day belong to that one release: the next deployment starts without them, and a rollback brings back the older release's code, not the data written since.

List the folders — or single files — your app writes to under Folders and files to keep in the app's Edit form. Add one path at a time and it appears as a chip with an × to remove it. Each path is kept once outside the releases, and every release — new, older, rolled back — reaches it at the same path inside the project. Deploying, rolling back and pruning releases leave it alone.

ez.json
{
  "persist": ["data", "uploads/imgs", "logs"]
}
  • Paths are relative to the project folder. A list set on the app in the dashboard or in the Hub overrides the file, like every other field.
  • Prefer the folder. SQLite creates -wal and -shm files next to its database, so list prisma, not prisma/hub.db — keeping only the database can leave its latest writes behind. A single file works when the file is genuinely all there is, and on Windows it is kept as a hard link instead of a symlink.
  • Up to 20 paths. .git and node_modules cannot be listed; dependencies are always installed fresh for each release.
  • Paths may not overlap: listing data and data/uploads keeps only data.
  • The running app receives the shared location as EZ_SHARED_DIR, for the rare case where it needs an absolute path.
When this happensTo the kept paths
DeployUnchanged. The new release sees the same files the old one did.
Roll backUnchanged. The older release sees the current data, not the copy it had when it was live.
Old releases prunedUntouched. Release folders are deleted; the kept paths are not part of them.
Move appThey move with the app and keep working.
Delete appKept by default, at the path shown when you delete. Tick "Also delete the persistent data" to remove them too.

The first deployment, and after

  • The first deployment after a path is listed seeds the kept location: from the live release when the app has already run, otherwise from the repository. After that the kept copy is what counts — editing those files in the repository changes nothing, because the deployment will not overwrite data your app may have written since.
  • A path that exists nowhere — a database written for the first time at runtime — is created empty: an empty folder, or an empty file when the name has an extension.
  • Paths are linked in before install and build, so a build step can use them too. If a build deletes or replaces one, the deployment fails there, rather than finishing without the data.
⚠️ A rollback runs the older code against the same data. A database migration in a newer release can leave the previous release unable to read it — and the migration itself cannot be undone by rolling the code back. Keep migrations backward compatible for one release, and run them from migrate rather than the post hook so a failed migration stops the deployment before the switch.

What not to keep: caches, compiled assets, anything the build recreates. And since each release installs its own dependencies, keeping node_modules would only hide which release is running with which packages — the disk cost of releases is expected, and releases are pruned for that reason.

Deploying from GitHub Actions

Every push can deploy the pushed commit, and the commit's check on GitHub turns red if the deployment fails. This uses the deploy hook: a small listener that is off until you switch it on.

  1. On the Deployments page, open Deploy hook → Configure, switch it on, and choose how GitHub reaches it.
  2. Open the app's GitHub tab and create its deploy token. It is shown once.
  3. Add the two repository secrets it lists: EZ_DEPLOY_URL and EZ_DEPLOY_TOKEN.
  4. Commit the workflow file it generates to .github/workflows/.
How GitHub reaches the hookWhat it means
Through one of your domains recommendedOne path, /.ez-deploy/, is added to that domain's nginx config. With a certificate on the domain the token travels over HTTPS. Nothing else — and nothing of the dashboard — becomes reachable.
Directly, on its own portThe listener binds to loopback by default (port 6445). Setting its bind to 0.0.0.0 exposes it on every interface, and then it is plain HTTP: the token is sent unencrypted, and the port has to be opened in the firewall. For private networks. The UI says so when you choose it.
Through the HubFor a server paired with a Hub. The Action calls the Hub, which forwards the request down the connection the server already holds open — no inbound port, no public domain. The server still verifies the token itself; the Hub stores nothing. Enable "Deploy from CI through the Hub" in Settings → Hub.

The workflow file is the same whichever way you choose. Only the value of the EZ_DEPLOY_URL secret differs.

Do it for me

For a github.com repository, the GitHub tab can do the steps itself: it stores both secrets (encrypted, the way GitHub requires), commits the workflow file to the app's branch, and adds the deploy key read-only.

  • It needs a GitHub token that may write the repository's secrets, contents and workflows — and administer it, for a deploy key. A token typed for this is used once and not stored.
  • A new deploy token is created and goes straight into the repository's secrets. It is never shown, and the previous one stops working.
  • Each step is reported on its own. If the token may write secrets but not workflows, the secrets are in place and you are told which step is left.
  • Committing the workflow is a push to the branch, so it starts the first deployment.
🔒 A deploy token can start a deployment of its own app, from that app's configured repository, and read that deployment's status. It cannot choose the repository, the commands or the environment. Only a hash of it is stored; ten wrong attempts lock a client out for 15 minutes.

Deploying from the Hub

A paired server's apps appear in the Deployments section of its Hub page. What the Hub may do is decided on the server, in Settings → Hub, one switch per action. All are off until you turn them on, and the server checks every request itself.

PermissionAllows
DeployStart a deployment of an existing app from its configured repository.
Roll backSwitch an app back to an earlier release.
View deployment logsRead a deployment's output.
Create, edit and delete appsAdd an app from a repository, change its settings, issue its deploy token, generate or regenerate its deploy key, test it, add it to GitHub read-only, delete an old release, or remove the app.
Read and edit environment variablesSeparate from managing an app on purpose. Values pass through the Hub while being edited and are not stored there.
Deploy from CI through the HubLet a GitHub Action trigger a deployment by calling the Hub.

The list of apps and their status is always visible on the Hub: a paired server is a monitored server. It contains the names of environment variables, never their values. A deploy key can be generated, regenerated, tested and added to GitHub from the Hub under deploy.manage; only its public half and fingerprint ever come back. Linking a domain needs deploy.manage and domains.create, and ssl.issue when a new certificate is requested.

Rolling back

The app's Releases tab lists what is on disk. Rolling back starts an earlier release exactly as it was built — nothing is fetched or rebuilt. The newest five releases are kept by default (2–20); the live one and the one before it are never deleted. The list follows a deployment started from outside the dashboard — a push through GitHub Actions or the Hub — on its own.

Each older release also has a Delete button beside Roll back. Deleting removes that release's folder from the server; its deployment log stays, and persistent data is not touched. The live release and the one an automatic rollback would return to cannot be deleted, and nothing can be deleted while a deployment of the app is running.

Automatic rollback can be switched off per app. Then an unhealthy release is stopped and the deployment is reported as failed.

Where things live

In the deployments folder
ez_deploys/<app>/releases/<id>/    ← one checkout per deployment, built in place
ez_deploys/<app>/shared/           ← the persistent paths (folders and files) listed under persistent data
ez_deploys/<app>/logs/<id>.log     ← that deployment's output
ez_deploys/<app>/runs/<id>.json    ← that deployment's state
ez_deploys/<app>/id_deploy         ← the app's private deploy key (mode 600)
ez_deploys/<app>/known_hosts       ← GitHub's pinned host keys, written before a fetch