Prerequisites
You needcurl, jq, tar, and shasum, plus a Horizon
API key with the write:projects organization permission. Use the
generated API reference for current
request and response schemas.
Collect these values before starting:
- organization slug
- project slug and display name
- source directory
- entrypoint, including the server object when needed
- dependency file, when automatic discovery is insufficient
- deployment target, normally
production
Create the project
Use the API reference’s organization operations to select the organization by its exact slug and confirm that the API key haswrite:projects. Horizon
conceals unauthorized writes with 404, so check the permission before changing
an endpoint that appears to be missing.
Use the project operations to find a project with the requested slug. Reuse it
when it exists. Otherwise, create one hosted project. The project slug determines
the serving hostname, and Horizon creates a production target with the project.
Keep the project and target IDs for future updates.
Build the archive
From the server’s source directory, create the archive in a temporary directory. Exclude credentials, dependencies, build output, caches, and local agent state. Inspect the result before uploading it.Upload the archive
Use the project’s source-upload operation to request a presigned URL with the archive size and digest. Upload the archive bytes to that URL before creating a version. The upload response defines the signed request. Send every returned header without changing or recalculating it. Horizon converts the hexadecimal digest to the checksum value expected by storage.Build the version
Use the version operation to create an archive-source version with:- the uploaded archive’s SHA-256 digest
- the server entrypoint
- the dependency file, when one is required
ready or failed. A ready
version includes the manifest Horizon discovered from the entrypoint. If the
build fails, inspect its error and build logs before creating another version.
Deploy the version
Set required runtime values through the project’s environment variables before the first production deployment. These values stay outside the source archive. Use the target operations to select the requested target, then create a deployment for the ready version. A deployment is active while its status isqueued or deploying. It is complete when it leaves those states:
succeededmeans the target serves the new versionfailedmeans the deployment did not replace the serving versionsupersededmeans a newer deployment replaced it before it started