DeployProject
Deploys a new version of a project and answers as CreateProject does: files written over its own (/.env, /compose.yaml, a source file), x_pethost (name, routes, password), mount_volume, a new archive (upload_id), a commit, or an earlier deploy's files again (rollback_deploy_id). compose.yaml rules: CreateProject's.
It builds build: images, pulls missing ones, runs compose up on the whole project and waits until each service runs (healthy, if it has a healthcheck) or each job exits 0, and until each routed service listens on its route's port (up to 15 s: one that does not is the project's SERVICE_PORT_CLOSED problem, its route answering 502, not a failed deploy). So it also starts stopped services, reruns jobs, recreates changed services and those bind-mounting project files, and fails on an unhealthy service. While Project.x_pethost_applies_at_once, a version differing only in x-pethost (or not at all) applies at once, restarting nothing but a service whose published port a route takes or leaves. Any other deploy applies its routes and password as it ends: to hide new content from its first second, set the password first, in a call of its own, then deploy the content.
A commit other than GithubSource.newest_commit turns auto_deploy off (pinned), even if it fails; only set_source turns it back on.
NOT_FOUND = no such project, or no such kept deploy. ABORTED = base_deploy_id is not Project.deploy_id: reread, redo. FAILED_PRECONDITION = as CreateProject, or commit not on the branch. RESOURCE_EXHAUSTED = too many or too large files: send them with CreateTransfer. ALREADY_EXISTS = operation_id started another kind of operation. When it FAILED, Operation.made_current says whether the files were applied: then fix them, or roll back.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | No | Written in order over the current files, or over the new version's: e.g. [{path: "/.env", text: "…"}] writes that file whole, and the files not named stay. With no new version pethost.compose.yaml is refused: write /compose.yaml. github: only /.env. None = redeploy. | |
| commit | No | github project: a commit of its branch (SHA, ≥7 chars), from ListCommits. | |
| upload_id | No | files project: an archive from CreateTransfer; replaces all files but /.env and x-pethost. | |
| x_pethost | No | Edits x-pethost by part, after `files`: metadata by key; routes all at once. x-pethost as data. Absent parts stay. | |
| project_id | No | ||
| mount_volume | No | Not with upload_id, or github. Adds `<volume>:<container_path>` to the service, declaring the volume if needed. | |
| operation_id | No | For a safe retry: the same id returns the first call's operation and starts nothing. [A-Za-z0-9][A-Za-z0-9._-]*, ≤128 chars; empty = generated. | |
| wait_seconds | No | Seconds to wait for the deploy's end, ≤45. Absent = 45; 0 = answer once it started. Still IN_PROGRESS then: GetOperation waits on. | |
| newest_commit | No | github project: true = GithubSource.newest_commit, read now. | |
| base_deploy_id | No | Project.deploy_id as you read it: ABORTED if the project was deployed since. Empty = no check. | |
| timeout_seconds | No | For the whole deploy, builds included; 0 = default. | |
| rollback_deploy_id | No | files project, a rollback: the operation_id of an earlier deploy with files_kept (Project.operations). Its files return as a new version; /.env, x-pethost and volumes stay. |