{
  "manifest_version": "1.0.0",
  "template": {
    "id": "d09e3dcf-f515-4b9d-9d04-c8ed8308c586",
    "slug": "paperless-ngx-4",
    "name": "Paperless-ngx",
    "description": "Secure Paperless-ngx with native PostgreSQL, Redis, OCR, and recovery.",
    "url": "https://railway.com/deploy/paperless-ngx-4",
    "upstream": {
      "repo_url": "https://github.com/l4time/railway-paperless-ngx-template"
    }
  },
  "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": "Redis",
      "source": {
        "image": "redis:8.2"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "paperless-ngx",
      "source": {
        "repo": "https://github.com/l4time/railway-paperless-ngx-template"
      },
      "needs_volume": true,
      "volume_mount_path": "/paperless",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Persistent PostgreSQL data directory inside the mounted volume.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private Railway hostname for the PostgreSQL service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Fixed private PostgreSQL port.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "PostgreSQL user referenced from the managed bootstrap user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "PostgreSQL database referenced from the managed bootstrap database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "PostgreSQL password referenced from the generated bootstrap password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Managed PostgreSQL database name.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private PostgreSQL connection URL assembled from managed values.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Managed PostgreSQL bootstrap username.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Lifetime in days for the generated PostgreSQL TLS certificate.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Generated PostgreSQL authentication password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Grace period in seconds for Railway deployment draining.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Private Railway hostname for the Redis service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Fixed private Redis port.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Fixed authenticated Redis username.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Private authenticated Redis connection URL assembled from managed values.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Redis password alias referenced by clients.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Generated Redis authentication password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PORT",
      "service": "paperless-ngx",
      "description": "Fixed HTTP port used by the Paperless-ngx web service.",
      "secret": false,
      "strategy": "default",
      "default": "8000"
    },
    {
      "key": "PAPERLESS_URL",
      "service": "paperless-ngx",
      "description": "Public Railway domain used as the canonical Paperless-ngx URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "PAPERLESS_REDIS",
      "service": "paperless-ngx",
      "description": "Private authenticated Redis URL referenced from the Redis service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBHOST",
      "service": "paperless-ngx",
      "description": "Private PostgreSQL hostname referenced from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBNAME",
      "service": "paperless-ngx",
      "description": "PostgreSQL database name referenced from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBPASS",
      "service": "paperless-ngx",
      "description": "PostgreSQL password referenced securely from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBPORT",
      "service": "paperless-ngx",
      "description": "Private PostgreSQL port referenced from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBUSER",
      "service": "paperless-ngx",
      "description": "PostgreSQL user referenced from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_ADMIN_MAIL",
      "service": "paperless-ngx",
      "description": "Bootstrap administrator email; change it after the first login.",
      "secret": false,
      "strategy": "default",
      "default": "admin@localhost.invalid"
    },
    {
      "key": "PAPERLESS_ADMIN_USER",
      "service": "paperless-ngx",
      "description": "Fixed bootstrap administrator username for the first login.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "PAPERLESS_SECRET_KEY",
      "service": "paperless-ngx",
      "description": "Generated 64-character Paperless-ngx application secret.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "PAPERLESS_ADMIN_PASSWORD",
      "service": "paperless-ngx",
      "description": "Generated 32-character bootstrap administrator password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PAPERLESS_EXPECTED_VERSION",
      "service": "paperless-ngx",
      "description": "Expected immutable Paperless-ngx release enforced at startup.",
      "secret": false,
      "strategy": "default",
      "default": "3.0.5"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "paperless-ngx-4"
      }
    },
    "cli": "railway deploy --template paperless-ngx-4",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "d09e3dcf-f515-4b9d-9d04-c8ed8308c586",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "6c0a900e-f854-4d7c-99e7-58246cb789a3": {
                  "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": "Persistent PostgreSQL data directory inside the mounted volume.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private Railway hostname for the PostgreSQL service.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Fixed private PostgreSQL port.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "PostgreSQL user referenced from the managed bootstrap user.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "PostgreSQL database referenced from the managed bootstrap database.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password referenced from the generated bootstrap password.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Managed PostgreSQL database name.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private PostgreSQL connection URL assembled from managed values.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Managed PostgreSQL bootstrap username.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Lifetime in days for the generated PostgreSQL TLS certificate.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated PostgreSQL authentication password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Grace period in seconds for Railway deployment draining.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "6c0a900e-f854-4d7c-99e7-58246cb789a3": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "a838f3cd-eb6d-49e6-96d2-1093ce70fb24": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "Redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "redis:8.2"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "description": "Private Railway hostname for the Redis service.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "description": "Fixed private Redis port.",
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "description": "Fixed authenticated Redis username.",
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Private authenticated Redis connection URL assembled from managed values.",
                      "defaultValue": "redis://${{REDISUSER}}:${{REDIS_PASSWORD}}@${{REDISHOST}}:${{REDISPORT}}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "description": "Redis password alias referenced by clients.",
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated Redis authentication password.",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "a838f3cd-eb6d-49e6-96d2-1093ce70fb24": {
                      "mountPath": "/data"
                    }
                  }
                },
                "f24e6402-f6d2-41d9-977a-55d4b8b59c06": {
                  "icon": null,
                  "name": "paperless-ngx",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/accounts/login/",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/l4time/railway-paperless-ngx-template",
                    "rootDirectory": null
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Fixed HTTP port used by the Paperless-ngx web service.",
                      "defaultValue": "8000"
                    },
                    "PAPERLESS_URL": {
                      "isOptional": false,
                      "description": "Public Railway domain used as the canonical Paperless-ngx URL.",
                      "defaultValue": "${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "PAPERLESS_REDIS": {
                      "isOptional": false,
                      "description": "Private authenticated Redis URL referenced from the Redis service.",
                      "defaultValue": "${{Redis.REDIS_URL}}"
                    },
                    "PAPERLESS_DBHOST": {
                      "isOptional": false,
                      "description": "Private PostgreSQL hostname referenced from the Postgres service.",
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "PAPERLESS_DBNAME": {
                      "isOptional": false,
                      "description": "PostgreSQL database name referenced from the Postgres service.",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "PAPERLESS_DBPASS": {
                      "isOptional": false,
                      "description": "PostgreSQL password referenced securely from the Postgres service.",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "PAPERLESS_DBPORT": {
                      "isOptional": false,
                      "description": "Private PostgreSQL port referenced from the Postgres service.",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "PAPERLESS_DBUSER": {
                      "isOptional": false,
                      "description": "PostgreSQL user referenced from the Postgres service.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "PAPERLESS_ADMIN_MAIL": {
                      "isOptional": false,
                      "description": "Bootstrap administrator email; change it after the first login.",
                      "defaultValue": "admin@localhost.invalid"
                    },
                    "PAPERLESS_ADMIN_USER": {
                      "isOptional": false,
                      "description": "Fixed bootstrap administrator username for the first login.",
                      "defaultValue": "admin"
                    },
                    "PAPERLESS_SECRET_KEY": {
                      "isOptional": false,
                      "description": "Generated 64-character Paperless-ngx application secret.",
                      "defaultValue": "{{PAPERLESS_SECRET_KEY}}"
                    },
                    "PAPERLESS_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated 32-character bootstrap administrator password.",
                      "defaultValue": "{{PAPERLESS_ADMIN_PASSWORD}}"
                    },
                    "PAPERLESS_EXPECTED_VERSION": {
                      "isOptional": false,
                      "description": "Expected immutable Paperless-ngx release enforced at startup.",
                      "defaultValue": "3.0.5"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8000": {
                        "port": 8000
                      }
                    }
                  },
                  "volumeMounts": {
                    "f24e6402-f6d2-41d9-977a-55d4b8b59c06": {
                      "mountPath": "/paperless"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "paperless-ngx",
      "method": "GET",
      "path": "/accounts/login/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T16:14:49.616Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-19T14:16:35.478Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_5a059db196e44e7a9175",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": false,
        "detail": "FAILED,SUCCESS,SUCCESS"
      }
    ]
  }
}
