nnesly

Deployments

Production and preview deployments, promoting a preview, rolling back in one step, and releasing to a share of your traffic.

A deployment is one build of your project with its own id (dep_…). Every deployment is kept as built, so going back to one never means building it again.

Production and preview

nesly deploy                       # goes live
nesly deploy --preview             # its own address; the live site is untouched
nesly deploy --preview --alias staging   # a preview address that stays the same

Production is what your project's addresses serve. A previewgets an address of its own and changes nothing for your visitors — the way to look at a change before anyone else does. With neither flag a deploy goes live;--prod says so explicitly.

From GitHub, a push to the production branch deploys to production and other branches and pull requests get previews: see GitHub. A preview reads the preview environment's variables and gets an empty database of its own instead of production's: see environment variables.

Deploying a repository by URL

nesly deploy https://github.com/owner/repo --yes
nesly deploy owner/repo --branch develop --preview --yes

Name a public repository and the platform clones and builds it itself: nothing is cloned or uploaded from your machine. It takes https://github.com/owner/repo,owner/repo, …/tree/<branch> or any other https clone URL, and builds the default branch unless you pass--branch (or --commit). The project is named after the repository unless you pass --project. Run the same command again for a new deployment from the repository's current head. A private repository goes through the GitHub App instead: see GitHub.

A Deploy button for your README

Put a button in a README or on a web page and anyone with an account can deploy your public repository in two clicks. Replace owner/repo with your repository; add &branch=<name> to pick a branch (it overrides a…/tree/<branch> in the address).

[![Deploy](https://nesly.net/deploy-button.svg)](https://console.nesly.net/new?repo=https://github.com/owner/repo)
<a href="https://console.nesly.net/new?repo=https://github.com/owner/repo"><img src="https://nesly.net/deploy-button.svg" alt="Deploy"></a>

The link opens the console. Whoever clicks it signs in (or signs up), sees which repository and branch will be deployed, can change the project name, and presses Confirm and deploy. Opening the link creates nothing; the button is the confirmation. It is the same call asnesly deploy <url>: the platform clones the repository itself, public repositories only, with the same address forms and the same refusals (https only, no credentials in the address). A private repository goes through theGitHub App.

Ready

A container deployment is ready when two things have happened, in this order. First the platform waits up to 5 minutes for the new version to start; if it does not, the deployment is failed and the log ends with what the application printed. Then the platform sends one GET to the path your [health]block names (/ when it names none), as a visitor's request would arrive (the public host in X-Forwarded-Host, https), and waits up to 2 minutes for an answer. A redirect is not followed: its own status is the answer.

  • No answer at all: failed, and the new version is removed.
  • With a [health] block and no status: any answer below 500 is ready; 500 and above is failed.
  • With [health] status = N: only an answer of exactly N is ready.
  • With no [health] block: any answer is ready, a server error included. The log then says the application answers 500 and is going live anyway, with the line to add.

A failed health check leaves the previous release serving. A static site has no process to ask: it is ready when its files are published.

nesly deploy cancel <id> (the MCP tool is cancel_deployment) stops a queued or building deployment: its status becomes cancelled, neverfailed, and nothing is published. A deployment that is already live cannot be cancelled; use rollback. Closing the terminal or pressing Ctrl-C on a waiting nesly deploy doesnot cancel: the platform keeps building. Cancel by id, or follow it with nesly wait <id>.

Rollback and promote

nesly promote dep_3k2m…           # a ready deployment becomes the live release
nesly ls                           # deployments, newest first
nesly rollback                     # put the release before the live one back
nesly rollback dep_…               # or a named earlier production release

Neither builds. Both are tested against the real API code path: a rollback hands the platform the image reference the earlier release already has, and a promote creates a new production deployment that carries the previewed deployment's image reference.

Promote takes a deployment that is Ready. A container keeps the image reference of the deployment you promote, digest included, so what goes live is the image you looked at, not a rebuild of the same commit; a static site keeps its published files. The promoted deployment has an id of its own. Its release command runs as on a deploy, and the workers, health check and site rules are the ones the previewed deployment was built with. A deployment that is Failed, Previous or Cancelled is refused.

Rollback takes a deployment that was live in production and is now Previous; a preview was never live and is refused (promote it instead). The platform starts that deployment's own image — the same reference, so the same digest — and makes it the live release; the deployment keeps its id and nothing is uploaded, built or pushed. A rollout in progress ends, production builds still running are cancelled, and scheduled jobs move to the restored release. The command answers once visitors are served by it; the platform works on it for at most six minutes twenty seconds even if your connection drops, and a rollback that does not go live in that time is reported as failed, with the release that was serving still serving.

In the console, the project's Overview offers Roll back to previous, and any earlier production release can be put back from Deployments.

After a rollback, automatic production deploys pause. Otherwise the next push — or a deploy hook — would bring back the release you just rolled away from. Previews keep deploying. Production resumes when you deploy or promote to it, or when you undo the rollback by rolling forward to the release that was live, which the Overview offers asUndo.

Releasing to part of your traffic

nesly deploy --percent 10      # the new release takes a tenth of visitors
nesly rollout                  # how the two releases are doing
nesly rollout set 50
nesly rollout promote          # give the new release everyone
nesly rollout abort            # send everyone back to the release that was live

The release that is live keeps the rest of the traffic until you decide.

Start rule

Your app must listen on the port in the PORT environment variable, on every interface (0.0.0.0). nesly sends traffic to that port on the container's own address, so an app bound to localhost or 127.0.0.1cannot be reached, and an app that picked a port itself is reached only if the number happens to match. For .NET the platform sets ASPNETCORE_URLS for you; removeUseUrls and Kestrel endpoints from your code and appsettings, because they override it.

app.listen(process.env.PORT || 3000)                 # fine: a fallback for your own machine
app.listen(3000)                                      # not reachable
http.ListenAndServe(":" + os.Getenv("PORT"), nil)     # fine
gunicorn app:app --bind 0.0.0.0:$PORT                 # fine
php -S 0.0.0.0:$PORT -t public                        # fine

Before the build starts, nesly reads your source and prints astart rule: line for every bind it can prove will not receive traffic, with the file and line and the change to make, for exampleserver.js:4: binds the fixed port 3000 instead of the PORT the platform provides.It reads Node, Python, Go, .NET and PHP start code and the start commands inProcfile, shell scripts, a Dockerfile's CMD and the start script ofpackage.json. It skips comments, tests, vendored and generated folders, and any line that reads PORT from the environment. It is advice: it never changes your code and never stops the deploy. nesly build show prints the same lines for the directory you are in.

A container that is started and does not answer on PORT within5 minutes is a failed deployment; the live site is untouched.

Shutdown and restarts

When a deployment is replaced, the process of the old one gets SIGTERM. If it is still running 300 seconds later it gets SIGKILL. HandleSIGTERM: stop accepting work, finish what is in flight, exit. The same300 seconds is the longest one request may take before nesly ends it. The two share a number on this platform, so a request time shorter than that is yours to enforce in the app.

If the process exits, it is started again. If it has been restarted 2 times and has still not answered, the deployment is failed at once instead of after5 minutes, and the failure says the app kept crashing before it answered, with the exit code and what the app printed last. One restart is not enough to fail it: an app that loses one race with its database on the first boot and comes up on the second is fine. An app that stops within a few seconds after it first answered is failed too.nesly diagnose names the cause when the app's own output shows it (a missing variable, an error it printed) and falls back to the restart count when it does not.

Other commands

nesly redeploy                 # build again from the connected repository, or the last upload
nesly redeploy dep_…           # build that deployment's source again, with today's variables
nesly cancel dep_…             # stop a deployment that is queued or building
nesly inspect dep_…            # one deployment in detail
nesly logs dep_…               # its build and runtime output

redeploy without a connected repository rebuilds the newest upload for the same environment; a preview upload never goes live that way — promote it. With an id it rebuilds that deployment's upload, commit or image and lands where that deployment did. To bring back an earlier release exactly as it ran, roll back instead.

What the status means

Queued, Building, DeployingThe source is being built and started. `cancel` stops it; nothing is published.
ReadyBuilt and answering (what that means: the Ready section below). For production, the one serving your address is marked Current.
FailedThe build or the start did not succeed. The log says where; the live site is untouched.
PreviousWas production until a newer release replaced it. Kept so you can roll back to it.
CancelledStopped before it was published.

The status is one of queued, building,deploying, ready,failed, superseded andcancelled (--json prints these words). Final states: cancelled, failed, superseded. A final deployment never changes status again.

A deployment is settled when it is ready or in a final state.nesly deploy --detach returns the id while it isqueued or building, andnesly wait <id> --timeout 30m returns when it is settled: exit 0 when ready, exit 1 when it ended without going live. A timeout is also exit 1, reason WAIT_TIMEOUT, and it only stops the waiting: the deployment keeps running. The MCP tool is wait_deployment.

A deployment that has been built waits 5 minutes for its first version to answer; after that it isfailed. A build has 15 minutes on the build workers (20 for a static-site framework build the control plane runs itself). What nesly builds and how: builds.