Deploy hook
A deploy hook is a secret URL that deploys one app service. Use it only from a CI system that cannot sign in. From GitHub Actions, sign in as a service principal instead. A hook URL is a password that never expires, and anyone who has it can deploy.
The URL is on the service’s Deployments tab:
https://api.m12p.com/api/hooks/paas/<token>Deploy
Section titled “Deploy”curl -fsS -X POST "$PAAS_WEBHOOK_URL" --data-binary @docker-compose.paas.yml| Body | What is deployed |
|---|---|
| empty | The Compose file saved on the service |
| Compose YAML | That file. It replaces the saved one first |
{"compose": "..."} | The same, as JSON |
A hook deploy cannot add key vault references to the file. Add those in the console, or deploy as a signed-in principal that may read the vault.
Wait for the result
Section titled “Wait for the result”The hook answers at once with 202. The deploy runs in the background for up
to four minutes.
{ "deploymentId": "dep_...", "status": "running", "statusUrl": "https://api.m12p.com/api/hooks/paas/<token>/deployments/dep_..."}GET the statusUrl until status is succeeded or failed. It returns
id, status, summary, host, and createdAt. A failed summary
starts with a Why block. See Troubleshooting.
answer=$(curl -fsS -X POST "$PAAS_WEBHOOK_URL" --data-binary @docker-compose.paas.yml)status_url=$(echo "$answer" | jq -r .statusUrl)for _ in $(seq 60); do result=$(curl -fsS "$status_url") case $(echo "$result" | jq -r .status) in succeeded) exit 0 ;; failed) echo "$result" | jq -r .summary; exit 1 ;; esac sleep 5doneecho "the deploy did not finish in time"; exit 1curl -f alone only tells you that the deploy started.
Turn it off or replace it
Section titled “Turn it off or replace it”On the Deployments tab:
- New URL creates a new token. The old URL stops working at once. Use it when the URL may have leaked.
- Turn off removes the token. The URL then answers
404.
POST /api/paas/{id}/webhook and DELETE /api/paas/{id}/webhook do the same
over the API.