Environments
The Environments page and the release pipeline that promotes a version from Preview to Staging to Production.
Each environment is a branch AntelopeJS Cloud builds and serves. The Environments page lists the release pipeline first, Preview, Staging then Production, then the other environments. For each stage, it shows what the stage serves, and a build that failed while the previous version kept the traffic.
On the page, the owner:
- Promotes the version a stage serves to the next stage, as the release pipeline describes.
- Creates an environment.
- Deletes an environment that is not protected.
- Gives an environment without an address its address. Give it an address sets the port of the first
httpserver thatantelope.config.tsgives@antelopejs/apion its one app service, and opens it to the internet, after a dialog says so. An environment that runs several app services is left to AntelopeJS Cloud. - Adds the dashboard to an environment that runs none, with Add the dashboard, when the repository has a
frontend.Dockerfile.
The dashboard of the project is not an app service. The page shows its address in a column of its own, as the dashboard page describes. While the DMS has no project, the page leads to the first-run setup.
AntelopeJS Cloud refuses an environment past the plan's allowance. The module says so in the words of environment_limit, and guesses no plan on its own.
The release pipeline
An environment named preview, staging or production is a stage of the release pipeline, in that order. Pull-request previews take no part in it. A promotion puts the commit an environment serves on the next stage the project has. Git carries it, as it carries a publish. What the module does depends on the branch the next stage tracks:
- The next stage tracks its own
env/<name>branch, and no other environment tracks it. From the repository atrepositoryPath, the module pushes the commit to that branch alone, as<commit>:refs/heads/env/<name>, with--force-with-leaseagainst the commit origin held when the promotion read it. The localenv/<name>branch stays where it is, checked out or not. The push makes AntelopeJS Cloud deploy the commit, and the module asks it nothing more, so the commit is built once. - Origin's
env/<name>holds the commit already, as after a promotion whose build failed or whose answer was lost. A push would start no build, so the module reads the next stage again. It refuses when the stage serves the commit already. It answers with the deployment of the commit when one is queued, building, checking or switching. Otherwise it asks AntelopeJS Cloud to deploy the commit withenvironments.promote. When AntelopeJS Cloud has not yet listed the deployment of the push, as on a second click right after the first, the commit is built twice, and the newer deployment supersedes the older. - The next stage tracks no branch, as an environment the CLI deploys or a Production created without a repository. The module asks AntelopeJS Cloud to deploy the commit with
environments.promote, and writes nothing in git. - The next stage tracks another branch: one that is not an
env/*branch, theenv/branch of another environment, or a branch another environment tracks too, which the push would deploy as well. The module refuses the promotion.
After a promotion
The version the next stage serves keeps the traffic until the new one passes its health check. The route answers 202 once the push or the request is done. The module then reads the next stage every 5 seconds, for at most 10 minutes, until it serves the commit or its build fails. The promotionFollow option sets both durations. The open Environments and Overview pages show the deployment build, then serve or fail, without a reload. A restart of the server stops following, and a reload still shows where the deployment stands.
Refused promotions
The module refuses a promotion:
- From the last stage, or from an environment outside the pipeline.
- From an environment that serves nothing, or a version without a commit, such as a CLI upload.
- Before a push, while a publish runs.
- Before a push, when
repositoryPathis not the root of a work tree or has no origin that answers. - Before a push, when the repository lacks the commit. A fetch of origin brings it.
When origin refuses the push, because the branch moved since the module read it or because the server may not push there, the promotion stops and AntelopeJS Cloud is asked nothing.
Promotions that push take their turn one after the other in the server. A second click waits for the first, then finds origin holding the commit and answers 202. A publish refuses to begin while a promotion runs or waits for its turn, and a promotion refuses while a publish runs, so no env/* branch moves under a running publish.