Development environment
How the module behaves in an AntelopeJS Cloud development environment, where the managed option gives its connection.
A development environment that AntelopeJS Cloud runs for a project has nobody to approve a device code. AntelopeJS Cloud hands the module its connection through the managed option instead: a token limited to that one project, which can deploy and observe it, and the project's id. The starter passes both, read from ANTELOPE_CLOUD_TOKEN and ANTELOPE_CLOUD_PROJECT_ID, beside the secretKey, which the module still needs to run:
config: {
secretKey: process.env.ANTELOPE_CLOUD_SECRET_KEY,
managed: {
token: process.env.ANTELOPE_CLOUD_TOKEN,
projectId: process.env.ANTELOPE_CLOUD_PROJECT_ID,
},
},
The module is then connected from its first start.
The connection
The module reads the connection from the options and never stores it. It writes nothing to the connections collection, and the token never reaches the browser or any answer of a route.
The Connection page reads connected, with the project, and "Managed by AntelopeJS Cloud" for the account and the credentials. It offers no Connect, Choose project, Disconnect or Sign out. Their routes refuse with managed_connection, and the module starts no device sign-in.
The first-run setup
The token reaches its project only. The workspace's endpoints, which list or create projects and read onboarding, answer it 403, so the module never calls them. The first-run setup treats Connect and Project as done, reads the project, and opens at Plan once origin is on GitHub. The Overview offers the setup until the plan is applied.
Applying the plan creates no project and links no repository: AntelopeJS Cloud keeps both to the workspace's members. A project that builds another repository than the one this DMS works on stops the first-run setup at Repository, which names both repositories.
What the apply fills
The Production of such a project holds nothing, so the apply fills it, and each stage you chose, with what the plan puts there:
- The app, with a volume for its files and its address.
- The dashboard.
- The databases the project's modules need, and the app's connection to them.
- The variables AntelopeJS Cloud decides.
The plan lists what each environment lacks, with where each variable's value comes from: generated, a reference to the database, an address, a folder of the volume, a fixed text, or yours to set.
Shared secrets
A secret cannot be read back to be copied. So a secret the app and the dashboard share, DMS_BOOTSTRAP_SECRET or DMS_HTML_RENDER_SECRET, that only one of them holds is never generated for the other. The plan lists it as held and it counts as missing. The apply does not call the project ready, and a publish is refused, until you remove the held value on the Variables page. The next apply then generates the same new value for both.
The setup token
The app of a DMS also gets DMS_SETUP_TOKEN, the setup token its first admin registers with. The apply generates it and sends it as a secret, the way AntelopeJS Cloud gives one to a development environment's app. The module neither answers nor logs it. The Create the admin account link on the app's page in the AntelopeJS Cloud console carries it. An apply generates the token only for an app that lacks it, so a token an admin may have used is never replaced.
What the apply never does
- It never deletes a value it did not write.
- It asks for the variables of this module's own config, such as
ANTELOPE_CLOUD_TOKEN, only of an environment that builds no branch, where the module runs.
Applying again
Every step reads the environment first, so applying again after a failure creates only what is missing. A step AntelopeJS Cloud refuses is shown with its status and error code, while the steps that do not need it still run.
The first build
The apply's last step, for each environment it filled, has AntelopeJS Cloud build the environment when AntelopeJS Cloud never built one of its services, as the app and the database an apply just created. It calls POST .../environments/{id}/promotion with the commit the environment's branch holds on origin. A push builds only a branch that moves, and a publish with nothing new is refused. Without this step, Production, whose env/production already holds the first version, would never start. The plan lists the step as "Deploys v1 once its services exist", with the version tagged at the branch's tip, else the branch.
The step leaves out:
- An environment whose branch origin does not hold yet. Its first publish builds it.
- An environment that lacks what it needs to start.
- An environment with a build under way or serving.
A refusal is recorded with its status and error code like any other step. The setup does not read Done until an apply gets the build accepted.
When the apply's closing read of an environment fails, the apply reports that AntelopeJS Cloud could not confirm what the environment holds, with the status and error code it answered. It does not report an environment that lacks nothing. The steps read Done, and the page says the project is ready, only once AntelopeJS Cloud holds all of it.
The volume
AntelopeJS Cloud runs a service on a read-only root filesystem, so an app that keeps its files with @antelopejs/file-storage-local cannot start without its volume. AntelopeJS Cloud may refuse the volume with a 409 past a ceiling of the workspace's plan, such as cloud.errors.limits.volumes_per_workspace, or with a tier error for a plan with no volumes. The step then fails with that status and error code, and the page names the ceiling. The volume, and the variable that points the files at it, stay missing on the plan. The environment is not built and a publish is refused. Apply again creates them once the workspace has room.
Incomplete or unconfirmed environments
A publish to an environment that lacks its app, a database or a variable the plan puts there is refused with environment_incomplete before anything is written. The refusal names each lack. A promotion to such an environment is refused the same way, before it pushes a branch or asks AntelopeJS Cloud to deploy.
AntelopeJS Cloud may fail or refuse a read of what the environment holds, or no longer list the environment. The publish and the promotion are then refused too, with environment_unconfirmed or unknown_environment. environment_unconfirmed carries the status and error code AntelopeJS Cloud answered. Nothing is pushed on a state nobody confirmed, and trying again once AntelopeJS Cloud answers goes through.