GitOps

Mentat includes a built-in GitOps engine — no external CI/CD required. Push to your repository, Mentat pulls the code, builds the image, and deploys it automatically. Similar to Coolify or Vercel, but running on your own infrastructure.

How It Works

git push origin main

GitHub webhook → POST /webhook/github

mentat-server: git pull → docker build → deploy

new version live (zero downtime)

Register an App

register a gitops app
# Via API
curl -X POST https://www.getmentat.run/gitops/apps \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-web-app",
    "repo": "https://github.com/user/my-web-app",
    "branch": "main",
    "port": 3000,
    "ingress": "myapp.example.com"
  }'

# Via CLI
mt gitops add my-web-app \
  --repo https://github.com/user/my-web-app \
  --branch main \
  --port 3000

GitHub Webhook Setup

Point your GitHub repository webhook to your Mentat server. The endpoint accepts push events and triggers the build/deploy pipeline.

webhook configuration
# GitHub → Settings → Webhooks → Add webhook
Payload URL: https://www.getmentat.run/webhook/github
Content type: application/json
Events: Just the push event
Active: true

Deploy Pipeline

When a push event arrives, Mentat executes the following steps:

1. Git Pull
Clones or pulls the latest code from the configured branch.
2. Build
Runs docker build with the repository's Dockerfile. The image is tagged with the commit SHA.
3. Deploy
Stops the old container and starts the new one using the configured deploy strategy (rolling by default).
4. Health Check
Waits for the new instance to pass health checks before marking the deploy as successful.
5. Registry Update
Updates the service registry with the new endpoint. Caddy auto-syncs the upstream.

API Endpoints

GET /gitops/appsList all registered GitOps applications
POST /gitops/appsRegister a new application
POST /gitops/deploy/{name}Manually trigger a deploy
GET /gitops/logsView deploy history with timestamps and status
POST /webhook/githubGitHub webhook endpoint (auto-triggered)

Configuration File

GitOps state is persisted in gitops.yaml on the server. This file is managed by Mentat — you do not edit it directly.

gitops.yaml (auto-managed)
apps:
  - name: api-hercules
    repo: https://github.com/org/api-hercules
    branch: main
    port: 5001
    ingress: apijarvis.getmentat.run
    last_deploy: "2026-04-04T23:00:00Z"
    commit: "a1b2c3d"
    status: deployed

  - name: truthsayer
    repo: https://github.com/org/truthsayer
    branch: main
    port: 3000
    ingress: www.truthsayer.app
    status: pending

Manual Deploy

trigger deploy manually
# Deploy a specific app
mt gitops deploy api-hercules

# Deploy with a specific commit
curl -X POST https://www.getmentat.run/gitops/deploy/api-hercules \
  -H "Content-Type: application/json" \
  -d '{"commit": "abc123"}'

# View deploy logs
mt gitops logs