{
  "$schema": "https://blueprints.servus.run/schema/servus-blueprint-v1.schema.json",
  "schemaVersion": "servus-blueprint/v1",
  "id": "forgejo",
  "name": "Forgejo",
  "tagline": "Self-hosted Git forge, pull requests, and issue tracker",
  "description": "Community-maintained lightweight Git hosting platform with PostgreSQL storage and declarative app configuration.",
  "category": "developer",
  "tags": [
    "git",
    "code-hosting",
    "issues",
    "pull-requests"
  ],
  "version": "2026-12-03.1",
  "publisher": "Forgejo (Servus Blueprint)",
  "icon": "forgejo",
  "homepage": "https://forgejo.org",
  "docsUrl": "https://forgejo.org/docs/latest/",
  "sourceUrl": "https://codeberg.org/forgejo/forgejo",
  "license": "GPL-3.0-or-later",
  "setup": "Open the web UI to complete the installer and create your first repository.",
  "inputs": [
    {
      "key": "appName",
      "label": "Instance title",
      "type": "text",
      "default": "Forgejo Git",
      "min": 1,
      "max": 80
    },
    {
      "key": "disableRegistration",
      "label": "Disable public self-registration",
      "type": "boolean",
      "default": true
    },
    {
      "key": "defaultTheme",
      "label": "Default theme",
      "type": "select",
      "default": "forgejo-auto",
      "options": [
        {
          "value": "forgejo-auto",
          "label": "Auto (System)"
        },
        {
          "value": "forgejo-light",
          "label": "Light"
        },
        {
          "value": "forgejo-dark",
          "label": "Dark"
        }
      ],
      "group": "advanced"
    }
  ],
  "secrets": [
    {
      "key": "dbPassword",
      "format": "base64url",
      "bytes": 32
    }
  ],
  "domains": [
    {
      "key": "primary",
      "label": "Application domain",
      "service": "app",
      "port": 3000,
      "primary": true
    }
  ],
  "profiles": [
    {
      "id": "compact",
      "label": "Compact",
      "services": {
        "app": {
          "cpus": 0.5,
          "memoryMb": 384
        },
        "database": {
          "cpus": 0.5,
          "memoryMb": 256
        }
      }
    },
    {
      "id": "standard",
      "label": "Standard",
      "services": {
        "app": {
          "cpus": 1,
          "memoryMb": 768
        },
        "database": {
          "cpus": 1,
          "memoryMb": 512
        }
      }
    },
    {
      "id": "performance",
      "label": "Performance",
      "services": {
        "app": {
          "cpus": 2,
          "memoryMb": 1536
        },
        "database": {
          "cpus": 2,
          "memoryMb": 1024
        }
      }
    }
  ],
  "defaultProfile": "standard",
  "files": [
    {
      "key": "forgejo_banner",
      "service": "app",
      "target": "/etc/forgejo/servus-profile.ini",
      "mode": 292,
      "content": "; Managed by Servus Blueprint\nAPP_NAME = {{inputs.appName|Forgejo Git}}\nDEFAULT_THEME = {{inputs.defaultTheme|forgejo-auto}}\nDISABLE_REGISTRATION = {{inputs.disableRegistration|true}}\n"
    }
  ],
  "volumes": [
    {
      "name": "data"
    },
    {
      "name": "database"
    }
  ],
  "networks": [
    {
      "name": "private",
      "internal": true
    }
  ],
  "services": [
    {
      "name": "app",
      "image": "codeberg.org/forgejo/forgejo:11.0-rootless",
      "restart": "unless-stopped",
      "resources": {
        "cpus": 1,
        "memoryMb": 768
      },
      "environment": {
        "FORGEJO__APP_NAME": "{{inputs.appName|Forgejo Git}}",
        "FORGEJO__database__DB_TYPE": "postgres",
        "FORGEJO__database__HOST": "database:5432",
        "FORGEJO__database__NAME": "forgejo",
        "FORGEJO__database__USER": "forgejo",
        "FORGEJO__database__PASSWD": "{{secrets.dbPassword}}",
        "FORGEJO__server__ROOT_URL": "{{domains.primary.url|http://localhost:3000}}",
        "FORGEJO__service__DISABLE_REGISTRATION": "{{inputs.disableRegistration|true}}",
        "FORGEJO__ui__DEFAULT_THEME": "{{inputs.defaultTheme|forgejo-auto}}"
      },
      "volumes": [
        {
          "volume": "data",
          "target": "/var/lib/gitea"
        }
      ],
      "networks": [
        "private"
      ],
      "dependsOn": [
        "database"
      ],
      "expose": [
        3000
      ]
    },
    {
      "name": "database",
      "image": "postgres:17-alpine",
      "restart": "unless-stopped",
      "resources": {
        "cpus": 1,
        "memoryMb": 512
      },
      "environment": {
        "POSTGRES_DB": "forgejo",
        "POSTGRES_USER": "forgejo",
        "POSTGRES_PASSWORD": "{{secrets.dbPassword}}"
      },
      "volumes": [
        {
          "volume": "database",
          "target": "/var/lib/postgresql/data"
        }
      ],
      "networks": [
        "private"
      ]
    }
  ]
}
