Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

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>
Terminal window
curl -fsS -X POST "$PAAS_WEBHOOK_URL" --data-binary @docker-compose.paas.yml
BodyWhat is deployed
emptyThe Compose file saved on the service
Compose YAMLThat 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.

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.

Terminal window
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 5
done
echo "the deploy did not finish in time"; exit 1

curl -f alone only tells you that the deploy started.

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.