From 23d2c764e364c9ffdbcc3fd1cb18c0d976c6582d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Aug 2026 11:10:30 +0000 Subject: [PATCH] fix(dotnet-service): the Coolify deploy called a verb Coolify refuses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `deploy-coolify` issued `GET /api/v1/deploy`. Coolify still routes that path, but to `OtherController::post_required`, which answers 405 "This endpoint has changed to a POST request." So the step did not fail at the network and did not fail obscurely — it reached Coolify, was understood, and was refused, on every deploy this profile has ever been capable of running. Switched to POST, and gave the two diagnosable statuses their own messages: 405 names the verb, 401/403 names the missing `deploy` ability (Coolify guards this route with `api.ability:deploy`, so a read-only token fails here and nowhere earlier). Also connects the schema to the platform side. `coolifyUrl` and `coolifyAppUuid` read like values someone types in; they are not. A workspace with a Coolify connection now serves both from the integrations registry — the origin from the `instance-url` connection-anchor template, the credential from `deploy-application`, TTL-bounded and ledgered per issuance — so nothing here belongs in a repo secret. The descriptions say so. Stack 0.2.1 → 0.2.2: this changes what a published composition does. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JMrCB3sCZsboPbuVpvtpA1 --- .gitignore | 1 + .../jobs/dotnet-service-verify-deploy.yaml | 16 ++++++++++++++- compositions/dotnet-service/schema.yaml | 20 +++++++++++++++++-- stack.yaml | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7de69c9..97d5fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .workspace/ .DS_Store error.log +.orun/ diff --git a/compositions/dotnet-service/jobs/dotnet-service-verify-deploy.yaml b/compositions/dotnet-service/jobs/dotnet-service-verify-deploy.yaml index f64a32f..981adf1 100644 --- a/compositions/dotnet-service/jobs/dotnet-service-verify-deploy.yaml +++ b/compositions/dotnet-service/jobs/dotnet-service-verify-deploy.yaml @@ -190,22 +190,36 @@ spec: # Coolify pulls the image and redeploys. One bearer token is the entire # credential story — no federated identity, no registry auth on the # target, no cloud-specific login step. + # + # POST, and that is not cosmetic. Coolify's deploy endpoint used to be a + # GET and this step was written against it; current Coolify still ROUTES + # `GET /api/v1/deploy`, but to `OtherController::post_required`, which + # answers 405 "This endpoint has changed to a POST request." So the old + # verb does not fail at the network — it reaches Coolify, is understood, + # and is refused, on every deploy. + # + # The token needs the `deploy` ability (Coolify's `api.ability:deploy` + # middleware guards this route). A `read`-only token 403s here, which is + # why the platform's connect recipe asks for `deploy` explicitly. run: | set -euo pipefail test -n "${COOLIFY_TOKEN:-}" || { echo "deploy-coolify: COOLIFY_TOKEN unset — wire it through the component's secretEnv" >&2; exit 1; } test -n "${SERVICE_IMAGE:-}" || { echo "deploy-coolify: SERVICE_IMAGE unset — an image step must precede this one" >&2; exit 1; } echo "deploy-coolify: {{ .parameters.coolifyAppUuid }} → ${SERVICE_IMAGE}" - response="$(curl -sS -X GET \ + response="$(curl -sS -X POST \ "{{ .parameters.coolifyUrl }}/api/v1/deploy?uuid={{ .parameters.coolifyAppUuid }}&force=true" \ -H "Authorization: Bearer ${COOLIFY_TOKEN}" \ -H "Accept: application/json" \ + -H "Content-Length: 0" \ -w '\n%{http_code}')" code="$(printf '%s' "$response" | tail -n1)" body="$(printf '%s' "$response" | sed '$d')" echo "$body" case "$code" in 2*) : ;; + 405) echo "deploy-coolify: Coolify returned 405 — the deploy endpoint expects POST" >&2; exit 1 ;; + 401|403) echo "deploy-coolify: Coolify returned $code — the token needs the 'deploy' ability" >&2; exit 1 ;; *) echo "deploy-coolify: Coolify returned HTTP $code" >&2; exit 1 ;; esac onFailure: stop diff --git a/compositions/dotnet-service/schema.yaml b/compositions/dotnet-service/schema.yaml index b062c04..b502f53 100644 --- a/compositions/dotnet-service/schema.yaml +++ b/compositions/dotnet-service/schema.yaml @@ -63,14 +63,30 @@ spec: description: Registry namespace for the GHCR build path, without image name or tag # --- Coolify deploy target --- + # + # These are PARAMETERS, not secrets, and they are meant to come from + # the platform rather than be typed in. A workspace with a Coolify + # connection serves both from the integrations registry: the origin + # from the `instance-url` template (a connection-anchor fact — no + # token is read and there is nothing to revoke) and the deploy + # credential from `deploy-application`, which is TTL-bounded and + # ledgered per issuance. Wire COOLIFY_TOKEN through the component's + # secretEnv against that template; nothing here belongs in a repo + # secret. coolifyUrl: type: string default: "" - description: Base URL of the Coolify instance, e.g. https://coolify.example.com + description: >- + Origin of the Coolify instance, e.g. https://coolify.example.com + (https and a public hostname — the platform's connect flow + refuses anything else, so a value it would refuse will not have a + connection behind it). coolifyAppUuid: type: string default: "" - description: UUID of the Coolify application this component deploys + description: >- + UUID of the Coolify application this component deploys — the + `applicationUuid` the deploy-application template is minted for. serviceUrl: type: string default: "" diff --git a/stack.yaml b/stack.yaml index 0d25392..75f0b0d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -3,7 +3,7 @@ kind: Stack metadata: name: stack-basalt title: Stack Basalt - version: 0.2.1 + version: 0.2.2 description: Versioned OCI-hosted catalog of .NET and Azure Container Apps compositions for Sourceplane repositories. owner: sourceplane tags: