{
  "manifest_version": "1.0.0",
  "template": {
    "id": "4af3f7f7-24f2-4a99-bf9f-4891d11efc06",
    "slug": "forgejo-2",
    "name": "Forgejo",
    "description": "Git forge with PostgreSQL, persistent volume, HTTPS, and Git-over-SSH.",
    "url": "https://railway.com/deploy/forgejo-2",
    "upstream": {
      "image": "forgejoclone/forgejo:16"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "Forgejo",
      "source": {
        "image": "forgejoclone/forgejo:16"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "tcp_ports": [
        22
      ],
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Directory where Postgres initializes and stores data. Must be a subdirectory of the volume mount, not the mount root.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private hostname other Railway services use to reach this database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port clients use in connection strings. The image still listens on 5432 internally.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Username exposed to Railway's data panel and to other services as Postgres.PGUSER.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Database name exposed to Railway's data panel and to other services as Postgres.PGDATABASE.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Password exposed to Railway's data panel and to other services as Postgres.PGPASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created on first start. Forgejo references this via ${{Postgres.PGDATABASE}}.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private connection URL for apps on Railway's private network.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Superuser created on first start. Forgejo references this via ${{Postgres.PGUSER}}.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Lifetime of the image's self-signed SSL certificate, in days. Restart the service to renew it.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Database password. Generated per deploy from this template; do not hardcode a live password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Seconds Railway waits after SIGTERM so Postgres can shut down cleanly before SIGKILL.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "Forgejo",
      "description": "HTTP port Railway healthchecks and routes to. Must match FORGEJO__server__HTTP_PORT.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "USER_GID",
      "service": "Forgejo",
      "description": "Linux group ID Forgejo runs as in the container.",
      "secret": false,
      "strategy": "default",
      "default": "1000"
    },
    {
      "key": "USER_UID",
      "service": "Forgejo",
      "description": "Linux user ID Forgejo runs as in the container. Keep aligned with volume ownership.",
      "secret": false,
      "strategy": "default",
      "default": "1000"
    },
    {
      "key": "FORGEJO____APP_NAME",
      "service": "Forgejo",
      "description": "Instance title shown in the Forgejo UI (root APP_NAME in app.ini).",
      "secret": false,
      "strategy": "default",
      "default": "Forgejo"
    },
    {
      "key": "FORGEJO__database__HOST",
      "service": "Forgejo",
      "description": "Postgres host and port on Railway private networking.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__database__NAME",
      "service": "Forgejo",
      "description": "Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__database__USER",
      "service": "Forgejo",
      "description": "Postgres username.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__server__DOMAIN",
      "service": "Forgejo",
      "description": "Public hostname used for clone URLs and cookies. Defaults to the Railway domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "FORGEJO__database__PASSWD",
      "service": "Forgejo",
      "description": "Postgres password, referenced from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__server__ROOT_URL",
      "service": "Forgejo",
      "description": "Public HTTPS base URL of this instance. Must end with a trailing slash.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "FORGEJO__server__SSH_PORT",
      "service": "Forgejo",
      "description": "Public TCP-proxy port shown in Git SSH clone URLs.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__database__DB_TYPE",
      "service": "Forgejo",
      "description": "Database engine. Leave as postgres for this template.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "FORGEJO__server__HTTP_PORT",
      "service": "Forgejo",
      "description": "Port Forgejo binds inside the container. Must match PORT.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "FORGEJO__database__SSL_MODE",
      "service": "Forgejo",
      "description": "Postgres TLS mode. disable is correct on Railway private networking.",
      "secret": false,
      "strategy": "default",
      "default": "disable"
    },
    {
      "key": "FORGEJO__server__SSH_DOMAIN",
      "service": "Forgejo",
      "description": "Public TCP-proxy hostname for Git over SSH.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "FORGEJO__security__INSTALL_LOCK",
      "service": "Forgejo",
      "description": "Skip the web installer. The first registered user becomes the administrator.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "FORGEJO__server__SSH_LISTEN_PORT",
      "service": "Forgejo",
      "description": "Internal SSH listen port advertised in config. The image sshd already binds 22.",
      "secret": false,
      "strategy": "default",
      "default": "22"
    },
    {
      "key": "FORGEJO__server__LFS_START_SERVER",
      "service": "Forgejo",
      "description": "Enable Git LFS stored on the Forgejo volume.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "FORGEJO__server__START_SSH_SERVER",
      "service": "Forgejo",
      "description": "Forgejo built-in SSH server. Leave false so it does not collide with the image sshd on port 22.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "FORGEJO__service__DISABLE_REGISTRATION",
      "service": "Forgejo",
      "description": "When true, only admins can create users. Keep false until an admin account exists.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "forgejo-2"
      }
    },
    "cli": "railway deploy --template forgejo-2",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "4af3f7f7-24f2-4a99-bf9f-4891d11efc06",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "7c7020e3-d48c-445c-9262-55f7946b2f37": {
                  "icon": null,
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Directory where Postgres initializes and stores data. Must be a subdirectory of the volume mount, not the mount root.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private hostname other Railway services use to reach this database.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port clients use in connection strings. The image still listens on 5432 internally.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Username exposed to Railway's data panel and to other services as Postgres.PGUSER.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Database name exposed to Railway's data panel and to other services as Postgres.PGDATABASE.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password exposed to Railway's data panel and to other services as Postgres.PGPASSWORD.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created on first start. Forgejo references this via ${{Postgres.PGDATABASE}}.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private connection URL for apps on Railway's private network.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser created on first start. Forgejo references this via ${{Postgres.PGUSER}}.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Lifetime of the image's self-signed SSL certificate, in days. Restart the service to renew it.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Database password. Generated per deploy from this template; do not hardcode a live password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds Railway waits after SIGTERM so Postgres can shut down cleanly before SIGKILL.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "7c7020e3-d48c-445c-9262-55f7946b2f37": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "a4f4e1a3-e790-49c3-8928-3bcdb42633a0": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/forgejo.svg",
                  "name": "Forgejo",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "forgejoclone/forgejo:16"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port Railway healthchecks and routes to. Must match FORGEJO__server__HTTP_PORT.",
                      "defaultValue": "3000"
                    },
                    "USER_GID": {
                      "isOptional": false,
                      "description": "Linux group ID Forgejo runs as in the container.",
                      "defaultValue": "1000"
                    },
                    "USER_UID": {
                      "isOptional": false,
                      "description": "Linux user ID Forgejo runs as in the container. Keep aligned with volume ownership.",
                      "defaultValue": "1000"
                    },
                    "FORGEJO____APP_NAME": {
                      "isOptional": false,
                      "description": "Instance title shown in the Forgejo UI (root APP_NAME in app.ini).",
                      "defaultValue": "Forgejo"
                    },
                    "FORGEJO__database__HOST": {
                      "isOptional": false,
                      "description": "Postgres host and port on Railway private networking.",
                      "defaultValue": "${{Postgres.PGHOST}}:${{Postgres.PGPORT}}"
                    },
                    "FORGEJO__database__NAME": {
                      "isOptional": false,
                      "description": "Postgres database name.",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "FORGEJO__database__USER": {
                      "isOptional": false,
                      "description": "Postgres username.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "FORGEJO__server__DOMAIN": {
                      "isOptional": false,
                      "description": "Public hostname used for clone URLs and cookies. Defaults to the Railway domain.",
                      "defaultValue": "${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "FORGEJO__database__PASSWD": {
                      "isOptional": false,
                      "description": "Postgres password, referenced from the Postgres service.",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "FORGEJO__server__ROOT_URL": {
                      "isOptional": false,
                      "description": "Public HTTPS base URL of this instance. Must end with a trailing slash.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}/"
                    },
                    "FORGEJO__server__SSH_PORT": {
                      "isOptional": false,
                      "description": "Public TCP-proxy port shown in Git SSH clone URLs.",
                      "defaultValue": "${{RAILWAY_TCP_PROXY_PORT}}"
                    },
                    "FORGEJO__database__DB_TYPE": {
                      "isOptional": false,
                      "description": "Database engine. Leave as postgres for this template.",
                      "defaultValue": "postgres"
                    },
                    "FORGEJO__server__HTTP_PORT": {
                      "isOptional": false,
                      "description": "Port Forgejo binds inside the container. Must match PORT.",
                      "defaultValue": "3000"
                    },
                    "FORGEJO__database__SSL_MODE": {
                      "isOptional": false,
                      "description": "Postgres TLS mode. disable is correct on Railway private networking.",
                      "defaultValue": "disable"
                    },
                    "FORGEJO__server__SSH_DOMAIN": {
                      "isOptional": false,
                      "description": "Public TCP-proxy hostname for Git over SSH.",
                      "defaultValue": "${{RAILWAY_TCP_PROXY_DOMAIN}}"
                    },
                    "FORGEJO__security__INSTALL_LOCK": {
                      "isOptional": false,
                      "description": "Skip the web installer. The first registered user becomes the administrator.",
                      "defaultValue": "true"
                    },
                    "FORGEJO__server__SSH_LISTEN_PORT": {
                      "isOptional": false,
                      "description": "Internal SSH listen port advertised in config. The image sshd already binds 22.",
                      "defaultValue": "22"
                    },
                    "FORGEJO__server__LFS_START_SERVER": {
                      "isOptional": false,
                      "description": "Enable Git LFS stored on the Forgejo volume.",
                      "defaultValue": "true"
                    },
                    "FORGEJO__server__START_SSH_SERVER": {
                      "isOptional": false,
                      "description": "Forgejo built-in SSH server. Leave false so it does not collide with the image sshd on port 22.",
                      "defaultValue": "false"
                    },
                    "FORGEJO__service__DISABLE_REGISTRATION": {
                      "isOptional": false,
                      "description": "When true, only admins can create users. Keep false until an admin account exists.",
                      "defaultValue": "false"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "22": {}
                    },
                    "serviceDomains": {
                      "<hasDomain>:3000": {
                        "port": 3000
                      }
                    }
                  },
                  "volumeMounts": {
                    "a4f4e1a3-e790-49c3-8928-3bcdb42633a0": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Forgejo",
      "method": "GET",
      "path": "/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-18T22:14:40.474Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-18T19:41:48.873Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_64339d083fb54f649f1f",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 37,
    "typical_build_seconds": 0,
    "typical_start_seconds": 20,
    "slowest_service": "Forgejo"
  }
}
