From 24173fe5bb9258d99a839145ef9e25932ae18529 Mon Sep 17 00:00:00 2001 From: Artur Ferreira Date: Mon, 1 Jun 2026 14:00:04 +0200 Subject: [PATCH] Initial Coolify deployment template --- .env.example | 2 ++ .forgejo/workflows/deploy.yml | 21 ++++++++++++ .gitignore | 5 +++ Dockerfile | 5 +++ README.md | 49 +++++++++++++++++++++++++++ public/index.html | 64 +++++++++++++++++++++++++++++++++++ 6 files changed, 146 insertions(+) create mode 100644 .env.example create mode 100644 .forgejo/workflows/deploy.yml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 public/index.html diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..8da891e --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +COOLIFY_WEBHOOK=https://coolify.example.com/api/v1/deploy?uuid=example&force=false +COOLIFY_TOKEN=replace-with-token-that-has-deploy-permission diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..ac1137f --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,21 @@ +name: Deploy to Coolify + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + deploy: + runs-on: docker + steps: + - name: Validate required secrets + run: | + test -n "${{ secrets.COOLIFY_WEBHOOK }}" + test -n "${{ secrets.COOLIFY_TOKEN }}" + + - name: Trigger Coolify deployment + run: | + curl --fail --show-error --request GET "${{ secrets.COOLIFY_WEBHOOK }}" \ + --header "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c744b43 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +.env +.env.* +!.env.example diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1213d99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:1.27-alpine + +COPY public/ /usr/share/nginx/html/ + +EXPOSE 80 diff --git a/README.md b/README.md new file mode 100644 index 0000000..b6f1cb0 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# Template + +Minimal Forgejo + Coolify deployment template. + +This repository is intended to stay on Forgejo. Coolify should use it as an "Other Git Provider" repository: + +- Public repo: use `http://192.168.1.113:3001/artur/template` as the HTTPS/HTTP repository URL. +- Private repo: add a deploy key in Coolify and Forgejo, then use `ssh://git@192.168.1.113:222/artur/template.git`. + +Automatic deployments are handled by Forgejo Actions calling Coolify's Deploy Webhook. + +## Required Forgejo Secrets + +Add these in `Settings -> Actions -> Secrets`: + +| Secret | Purpose | +|--------|---------| +| `COOLIFY_WEBHOOK` | Deploy Webhook URL from the Coolify resource | +| `COOLIFY_TOKEN` | Coolify API token with `deploy` permission | + +The workflow calls: + +```sh +curl --request GET "$COOLIFY_WEBHOOK" \ + --header "Authorization: Bearer $COOLIFY_TOKEN" +``` + +## Coolify MCP + +Coolify's MCP server is read-only. Enable it in Coolify with a `root` API token: + +```sh +curl -X POST http://192.168.1.101:8000/api/v1/mcp/enable \ + -H "Authorization: Bearer " +``` + +Then configure MCP clients with: + +- URL: `http://192.168.1.101:8000/mcp` +- Header: `Authorization: Bearer ` + +Use a token with `read` permission for MCP, not `root`. + +## Local Test + +```sh +docker build -t template:local . +docker run --rm -p 8080:80 template:local +``` diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..6672ee5 --- /dev/null +++ b/public/index.html @@ -0,0 +1,64 @@ + + + + + + Template + + + +
+

Forgejo to Coolify

+

Deployment template is alive.

+

Push to main, let Forgejo Actions call the Coolify Deploy Webhook, and keep the app source in Forgejo.

+
+ +