Services releases

A release is one build-and-serve attempt of a service. It is immutable: it freezes the source, the settings and the built image it ran with.

Deploy

miosa service deploy shop API                        # rebuild the service's own source
miosa service deploy shop API --dir . --wait         # upload a directory
miosa service deploy shop API --repo https://github.com/acme/api --branch main
miosa service deploy shop API --image ghcr.io/acme/api:1.4 --port 8080

Every release takes an Idempotency-Key; the CLI sends one so a retried command returns the first release instead of starting a second.

--wait follows the release and exits non-zero if it fails, printing the reason.

The state machine

StateMeaning
queuedAccepted, waiting for a worker.
buildingThe source is being built.
builtThe image exists; the release is about to start replicas.
pre_deploypre_deploy_command is running in the new replica.
startingReplicas are booting.
health_checkThe health path is being probed.
activeServing.
sleepingIdle sleep stopped the replicas; the next request wakes them.
drainingAn earlier release is stopping.
crashedA replica crashed and the restart policy did not recover it.
failedTerminal failure, with a reason.
canceledCanceled by a user.
stoppedStopped by stop.

A release that never leaves a state before its deadline is settled by the reaper with deadline_exceeded.

Read a failure

miosa service releases shop API
miosa service logs shop API
miosa service logs shop API --release 6

logs prints every transition and the failure reason of the newest release, or of the release you name. The release events carry the reason a release failed. Build logs and live streaming are not available yet.

What a running replica printed is a separate read:

GET /projects/:id/services/:sid/logs                    # the active release
GET /projects/:id/services/:sid/deployments/:did/logs   # one release

Each returns the last lines of every replica’s output, with your secret values masked. tail sets the number of lines (1 to 1000, default 200) and replica narrows it to one replica. A replica that cannot be read says so in its own entry and does not hide the others. It is a snapshot, not a stream.

Common reason codes:

CodeWhat to do
build_failedRead the build output; the command exited non-zero.
clone_failedThe repository or branch was not reachable, or the credential is wrong.
image_pull_failedThe image reference is wrong, or the registry secret is missing.
healthcheck_timeoutThe app did not answer its health path in time. Check start_command and the port.
pre_deploy_failedpre_deploy_command exited non-zero; nothing serves.
no_capacityNo host had room for the shape in that region. Try another region or a smaller limits.
reference_missingA variable references something that does not exist. miosa service vars effective lists them.
reference_cycleTwo variables reference each other.
deadline_exceededThe release sat in one state too long and the reaper settled it.
quota_exceededA plan limit was reached.

Promote and roll back

Rollback serves an earlier release’s built image with its frozen source and settings. Nothing is rebuilt, so it is fast.

miosa service rollback shop API 3 --yes
miosa service promote  shop API 3 --yes   # the same call

The Services API has one operation for this and calls it rollback. The CLI accepts promote as its name for “serve this release again”; there is no separate promote route.

Cancel and remove

miosa service cancel shop API 7     # a queued or building release
miosa service release shop API 3    # one release

A release that already finished can be removed from the history; one that is still running cannot.

Stop, start, restart

miosa service stop    shop API --yes   # stop every active release now
miosa service start   shop API         # start a stopped service
miosa service restart shop API         # queue a release that restarts it

stop fails with SERVICES_NOT_STOPPED if a replica cannot be stopped, so a service is never reported stopped while it still runs. start on a service that is already running or starting is SERVICE_CONFLICT.

Rollout and rollback of several services

Each service releases independently. For a coordinated change, apply a template or a change set, which stages every service’s change and deploys them together.

Was this page helpful?