{
  "manifest_version": "1.0.0",
  "template": {
    "id": "79aff97f-3eaa-4b56-9612-122485866131",
    "slug": "lacuna",
    "name": "lacuna",
    "description": "Turn scanned PDFs into a searchable archive and reader site, with OCR",
    "url": "https://railway.com/deploy/lacuna",
    "upstream": {
      "repo_url": "https://github.com/eveningsoftware/lacuna"
    }
  },
  "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": "lacuna",
      "source": {
        "repo": "https://github.com/eveningsoftware/lacuna"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Directory inside the volume where Postgres keeps its data files",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private hostname of the Postgres service",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port Postgres listens on",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Postgres user for client connections",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Database name for client connections",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Postgres password for client connections",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Name of the default database created on first boot",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Connection string over Railway private networking",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Superuser created on first boot",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Days the generated SSL certificate stays valid",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Superuser password, generated at deploy time",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Connection string over the public TCP proxy",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Seconds to let the old deployment drain before it stops",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "lacuna",
      "description": "Port the lacuna server listens on",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "S3_ENDPOINT",
      "service": "lacuna",
      "description": "Object storage endpoint URL",
      "secret": false,
      "strategy": "default",
      "default": "https://t3.storageapi.dev"
    },
    {
      "key": "DATABASE_URL",
      "service": "lacuna",
      "description": "Postgres connection string for the corpus and search index",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "QUERY_PROVIDER",
      "service": "lacuna",
      "description": "Where search is served from: postgres or turbopuffer",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "AWS_ENDPOINT_URL",
      "service": "lacuna",
      "description": "Bucket endpoint, from the bucket service",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AWS_ACCESS_KEY_ID",
      "service": "lacuna",
      "description": "Bucket access key ID, from the bucket service",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AWS_DEFAULT_REGION",
      "service": "lacuna",
      "description": "Bucket region, from the bucket service",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AWS_S3_BUCKET_NAME",
      "service": "lacuna",
      "description": "Name of the bucket that stores uploads and page images",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AWS_SECRET_ACCESS_KEY",
      "service": "lacuna",
      "description": "Bucket secret access key, from the bucket service",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DOCKERFILE_PATH",
      "service": "lacuna",
      "description": "Dockerfile used to build the lacuna server image",
      "secret": false,
      "strategy": "default",
      "default": "deploys/Dockerfile.server-node"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "lacuna"
      }
    },
    "cli": "railway deploy --template lacuna",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "79aff97f-3eaa-4b56-9612-122485866131",
            "serializedConfig": {
              "buckets": {
                "bf602be6-ac42-4ba7-9f7b-a920eba93100": {
                  "name": "bucket"
                }
              },
              "services": {
                "c2368f55-e2dd-4885-8f4c-6deb77f937f5": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "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 inside the volume where Postgres keeps its data files",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private hostname of the Postgres service",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port Postgres listens on",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Postgres user for client connections",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Database name for client connections",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Postgres password for client connections",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Name of the default database created on first boot",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Connection string over Railway private networking",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser created on first boot",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Days the generated SSL certificate stays valid",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Superuser password, generated at deploy time",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Connection string over the public TCP proxy",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds to let the old deployment drain before it stops",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "c2368f55-e2dd-4885-8f4c-6deb77f937f5": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  },
                  "haTemplateCode": "postgres-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxy",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "Routes traffic to the primary",
                      "defaultValue": 3
                    },
                    "replica": {
                      "label": "Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "nodeLabel": "Postgres",
                      "description": "Streaming replicas for automatic failover",
                      "defaultValue": 2
                    },
                    "internal": {
                      "label": "Coordinator Nodes",
                      "options": [
                        3,
                        5,
                        7,
                        9
                      ],
                      "nodeLabel": "etcd",
                      "defaultValue": 3
                    },
                    "description": "This will convert your Postgres database to an HA cluster with Patroni failover and etcd consensus."
                  }
                },
                "f7d279a3-9c7c-460c-aeb6-c8d02a52faae": {
                  "icon": null,
                  "name": "lacuna",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/health",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/eveningsoftware/lacuna",
                    "rootDirectory": "/"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port the lacuna server listens on",
                      "defaultValue": "8080"
                    },
                    "S3_ENDPOINT": {
                      "isOptional": false,
                      "description": "Object storage endpoint URL",
                      "defaultValue": "https://t3.storageapi.dev"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Postgres connection string for the corpus and search index",
                      "defaultValue": "${{Postgres.DATABASE_URL}}"
                    },
                    "SITE_PASSWORD": {
                      "isOptional": true,
                      "description": "",
                      "defaultValue": ""
                    },
                    "QUERY_PROVIDER": {
                      "isOptional": false,
                      "description": "Where search is served from: postgres or turbopuffer",
                      "defaultValue": "postgres"
                    },
                    "AWS_ENDPOINT_URL": {
                      "isOptional": false,
                      "description": "Bucket endpoint, from the bucket service",
                      "defaultValue": "${{bucket.ENDPOINT}}"
                    },
                    "AWS_ACCESS_KEY_ID": {
                      "isOptional": false,
                      "description": "Bucket access key ID, from the bucket service",
                      "defaultValue": "${{bucket.ACCESS_KEY_ID}}"
                    },
                    "AWS_DEFAULT_REGION": {
                      "isOptional": false,
                      "description": "Bucket region, from the bucket service",
                      "defaultValue": "${{bucket.REGION}}"
                    },
                    "AWS_S3_BUCKET_NAME": {
                      "isOptional": false,
                      "description": "Name of the bucket that stores uploads and page images",
                      "defaultValue": "${{bucket.BUCKET}}"
                    },
                    "TURBOPUFFER_API_KEY": {
                      "isOptional": true,
                      "description": "",
                      "defaultValue": ""
                    },
                    "AWS_SECRET_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "Bucket secret access key, from the bucket service",
                      "defaultValue": "${{bucket.SECRET_ACCESS_KEY}}"
                    },
                    "RAILWAY_DOCKERFILE_PATH": {
                      "isOptional": false,
                      "description": "Dockerfile used to build the lacuna server image",
                      "defaultValue": "deploys/Dockerfile.server-node"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "lacuna",
      "method": "GET",
      "path": "/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-26T22:14:55.008Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-26T18:37:33.270Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_1acaa9d95f554419ac99",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": false,
        "detail": "Your workspace has been restricted. Please contact support to resolve this."
      }
    ]
  }
}
