Containers

Deploy a container on a site

Puts a container on a site: every path of the site (and its own domain) then goes to it. Send a public image, or the source of a Node or Python app without a Dockerfile: we install the dependencies on Linux, scan them and build the image. The work runs after the answer (202): get_container shows when the version is live. A new version only gets traffic after its health_path answers 2xx; if it never does, the previous version keeps running. Settings left out on a new version are kept from the running one.

post/containers

Request

  • Base URL: https://api.hypamoon.com/api/v1
  • URL: https://api.hypamoon.com/api/v1/containers
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://app.hypamoon.com/oauth/authorize, token URL https://api.hypamoon.com/oauth/token, scopes: sites:write)

Request body

site_idstring uuid required

The site that serves the container: every path of the site (and its own domain) goes to it. Create the site first with deploy_site.

namestring
imagestring

A public linux/amd64 image, like ghcr.io/acme/api:1.4 or docker.io/library/nginx@sha256:... We copy it, so a later change upstream changes nothing here. Use image or source, not both.

runtime'node' | 'python'

Only with source. Left out: package.json means node, requirements.txt or pyproject.toml means python.

build_commandstring

Only with source. Left out: npm run build when package.json has a build script, nothing for Python.

start_commandstring

Only with source. Left out: npm start (or node main), or the web line of a Procfile, or python main.py/app.py.

portinteger

The port the server listens on. Default 8080; the container also gets it as PORT.

instance_type'lite' | 'basic' | 'standard-1' | 'standard-2'

Size: lite (1/16 vCPU, 256 MiB), basic (1/4 vCPU, 1 GiB), standard-1 (1/2 vCPU, 4 GiB), standard-2 (1 vCPU, 6 GiB). Default lite.

instancesinteger

How many instances share the traffic. Default 1.

always_onboolean

true keeps the instances running (no start-up wait, for webhooks and realtime). Default false: the container sleeps after sleep_after without traffic and starts on the next request.

sleep_afterstring

Idle time before sleeping, like "5m" or "1h". Default 5m. Ignored with always_on.

health_pathstring

A path that answers 2xx when the app is ready. A new version only gets traffic after this answers. Default /.

envobject

Plain environment variables (not secret). Left out on a new version: the running version's env is kept.

secretsstring[]

Vault secrets the container may use without ever seeing them: send a request with the header x-hypamoon-secret: <name> and we add the secret on the way out (the safe default).

allowed_hostsstring[]

The only hosts the container may call over HTTPS, like api.example-payments.com or *.example.com. api.hypamoon.com is always allowed. Nothing else gets out.

Response

The container and the deploy in the queue.

idstring uuid required
site_idstring uuid required
namestring required
urlstring required
mode'live' | 'test' required
status'deploying' | 'running' | 'failed' | 'suspended' required
versioninteger required

The live version; 0 until the first deploy is live.

instance_typestring required
instancesinteger required
always_onboolean required
sleep_afterstring required
portinteger required
health_pathstring required
allowed_hostsstring[] required
secretsstring[] required
env_namesstring[] required

Names of the plain environment variables (never the values of secrets).

created_atstring required
updated_atstring required
keptstring[]

Changes

No recorded changes to this operation across all 1 revision of this API.