{
  "manifest_version": "1.0.0",
  "template": {
    "id": "04aa77ff-2f12-4702-aeea-4b9735e4ca85",
    "slug": "deploy-paperless-ngx-ocr-on-railway",
    "name": "Paperless-ngx OCR",
    "description": "Tesseract OCR and PDF/A archives for every scan",
    "url": "https://railway.com/deploy/deploy-paperless-ngx-ocr-on-railway",
    "upstream": {
      "image": "ghcr.io/paperless-ngx/paperless-ngx:3.3.0"
    }
  },
  "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": "paperless-ngx",
      "source": {
        "image": "ghcr.io/paperless-ngx/paperless-ngx:3.3.0"
      },
      "needs_volume": true,
      "volume_mount_path": "/usr/src/paperless/data",
      "http": true
    },
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.2"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Postgres data directory on the volume.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Postgres hostname for private-network clients.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Postgres port (usually 5432).",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Postgres role name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Default Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Password for the Postgres role.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created on first boot.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Full Postgres connection URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Superuser / role created on first boot.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Validity window used when generating TLS certs.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password for POSTGRES_USER.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Seconds to drain connections before stopping.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "paperless-ngx",
      "description": "HTTP listen port for the Paperless-ngx web UI (8000).",
      "secret": false,
      "strategy": "default",
      "default": "8000"
    },
    {
      "key": "USERMAP_GID",
      "service": "paperless-ngx",
      "description": "Linux GID used for files on the Paperless volume.",
      "secret": false,
      "strategy": "default",
      "default": "1000"
    },
    {
      "key": "USERMAP_UID",
      "service": "paperless-ngx",
      "description": "Linux UID used for files on the Paperless volume.",
      "secret": false,
      "strategy": "default",
      "default": "1000"
    },
    {
      "key": "PAPERLESS_URL",
      "service": "paperless-ngx",
      "description": "Public HTTPS URL of this Paperless instance.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "PAPERLESS_PORT",
      "service": "paperless-ngx",
      "description": "Paperless web port; keep aligned with PORT.",
      "secret": false,
      "strategy": "default",
      "default": "8000"
    },
    {
      "key": "PAPERLESS_REDIS",
      "service": "paperless-ngx",
      "description": "Redis URL used as the Celery broker.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBHOST",
      "service": "paperless-ngx",
      "description": "Postgres hostname from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBNAME",
      "service": "paperless-ngx",
      "description": "Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBPASS",
      "service": "paperless-ngx",
      "description": "Postgres password from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBPORT",
      "service": "paperless-ngx",
      "description": "Postgres port from the Postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DBUSER",
      "service": "paperless-ngx",
      "description": "Postgres username.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PAPERLESS_DATA_DIR",
      "service": "paperless-ngx",
      "description": "Root data directory on the persistent volume.",
      "secret": false,
      "strategy": "default",
      "default": "/usr/src/paperless/data"
    },
    {
      "key": "PAPERLESS_DBENGINE",
      "service": "paperless-ngx",
      "description": "Database engine. Use postgresql on Railway.",
      "secret": false,
      "strategy": "default",
      "default": "postgresql"
    },
    {
      "key": "PAPERLESS_TIME_ZONE",
      "service": "paperless-ngx",
      "description": "Application timezone (e.g. UTC).",
      "secret": false,
      "strategy": "default",
      "default": "UTC"
    },
    {
      "key": "PAPERLESS_ADMIN_MAIL",
      "service": "paperless-ngx",
      "description": "Email for the initial admin user.",
      "secret": false,
      "strategy": "default",
      "default": "admin@example.com"
    },
    {
      "key": "PAPERLESS_ADMIN_USER",
      "service": "paperless-ngx",
      "description": "Initial admin username, created on first boot only.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "PAPERLESS_MEDIA_ROOT",
      "service": "paperless-ngx",
      "description": "Path for stored documents and thumbnails.",
      "secret": false,
      "strategy": "default",
      "default": "/usr/src/paperless/data/media"
    },
    {
      "key": "PAPERLESS_SECRET_KEY",
      "service": "paperless-ngx",
      "description": "Django secret key; keep stable across redeploys.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "PAPERLESS_OCR_LANGUAGE",
      "service": "paperless-ngx",
      "description": "Tesseract OCR language code (e.g. eng).",
      "secret": false,
      "strategy": "default",
      "default": "eng"
    },
    {
      "key": "PAPERLESS_TASK_WORKERS",
      "service": "paperless-ngx",
      "description": "Number of Celery worker processes.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "PAPERLESS_ADMIN_PASSWORD",
      "service": "paperless-ngx",
      "description": "Initial admin password, created on first boot only.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PAPERLESS_CONSUMPTION_DIR",
      "service": "paperless-ngx",
      "description": "Drop folder watched for new documents to ingest.",
      "secret": false,
      "strategy": "default",
      "default": "/usr/src/paperless/data/consume"
    },
    {
      "key": "PAPERLESS_WEBSERVER_WORKERS",
      "service": "paperless-ngx",
      "description": "Number of web server worker processes.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "PAPERLESS_THREADS_PER_WORKER",
      "service": "paperless-ngx",
      "description": "Threads per Celery worker process.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Redis hostname for private-network clients.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Redis port (usually 6379).",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Redis username, if authentication requires one.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Full Redis connection URL for clients.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Redis password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Redis password (alternate export name).",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "deploy-paperless-ngx-ocr-on-railway"
      }
    },
    "cli": "railway deploy --template deploy-paperless-ngx-ocr-on-railway",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "04aa77ff-2f12-4702-aeea-4b9735e4ca85",
            "serializedConfig": {
              "services": {
                "7f5facb3-72f6-4100-a137-f3609dcd3d53": {
                  "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": "Postgres data directory on the volume.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Postgres hostname for private-network clients.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Postgres port (usually 5432).",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Postgres role name.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Default Postgres database name.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Postgres role.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created on first boot.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Full Postgres connection URL.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser / role created on first boot.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Validity window used when generating TLS certs.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for POSTGRES_USER.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds to drain connections before stopping.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "7f5facb3-72f6-4100-a137-f3609dcd3d53": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "ad4e7de4-4ff4-4310-bd32-bd0ab44d7967": {
                  "icon": null,
                  "name": "paperless-ngx",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/paperless-ngx/paperless-ngx:3.3.0"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP listen port for the Paperless-ngx web UI (8000).",
                      "defaultValue": "8000"
                    },
                    "USERMAP_GID": {
                      "isOptional": false,
                      "description": "Linux GID used for files on the Paperless volume.",
                      "defaultValue": "1000"
                    },
                    "USERMAP_UID": {
                      "isOptional": false,
                      "description": "Linux UID used for files on the Paperless volume.",
                      "defaultValue": "1000"
                    },
                    "PAPERLESS_URL": {
                      "isOptional": false,
                      "description": "Public HTTPS URL of this Paperless instance.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "PAPERLESS_PORT": {
                      "isOptional": false,
                      "description": "Paperless web port; keep aligned with PORT.",
                      "defaultValue": "8000"
                    },
                    "PAPERLESS_REDIS": {
                      "isOptional": false,
                      "description": "Redis URL used as the Celery broker.",
                      "defaultValue": "${{Redis.REDIS_URL}}"
                    },
                    "PAPERLESS_DBHOST": {
                      "isOptional": false,
                      "description": "Postgres hostname from the Postgres service.",
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "PAPERLESS_DBNAME": {
                      "isOptional": false,
                      "description": "Postgres database name.",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "PAPERLESS_DBPASS": {
                      "isOptional": false,
                      "description": "Postgres password from the Postgres service.",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "PAPERLESS_DBPORT": {
                      "isOptional": false,
                      "description": "Postgres port from the Postgres service.",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "PAPERLESS_DBUSER": {
                      "isOptional": false,
                      "description": "Postgres username.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "PAPERLESS_DATA_DIR": {
                      "isOptional": false,
                      "description": "Root data directory on the persistent volume.",
                      "defaultValue": "/usr/src/paperless/data"
                    },
                    "PAPERLESS_DBENGINE": {
                      "isOptional": false,
                      "description": "Database engine. Use postgresql on Railway.",
                      "defaultValue": "postgresql"
                    },
                    "PAPERLESS_TIME_ZONE": {
                      "isOptional": false,
                      "description": "Application timezone (e.g. UTC).",
                      "defaultValue": "UTC"
                    },
                    "PAPERLESS_ADMIN_MAIL": {
                      "isOptional": false,
                      "description": "Email for the initial admin user.",
                      "defaultValue": "admin@example.com"
                    },
                    "PAPERLESS_ADMIN_USER": {
                      "isOptional": false,
                      "description": "Initial admin username, created on first boot only.",
                      "defaultValue": "admin"
                    },
                    "PAPERLESS_MEDIA_ROOT": {
                      "isOptional": false,
                      "description": "Path for stored documents and thumbnails.",
                      "defaultValue": "/usr/src/paperless/data/media"
                    },
                    "PAPERLESS_SECRET_KEY": {
                      "isOptional": false,
                      "description": "Django secret key; keep stable across redeploys.",
                      "defaultValue": "{{PAPERLESS_SECRET_KEY}}"
                    },
                    "PAPERLESS_OCR_LANGUAGE": {
                      "isOptional": false,
                      "description": "Tesseract OCR language code (e.g. eng).",
                      "defaultValue": "eng"
                    },
                    "PAPERLESS_TASK_WORKERS": {
                      "isOptional": false,
                      "description": "Number of Celery worker processes.",
                      "defaultValue": "1"
                    },
                    "PAPERLESS_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Initial admin password, created on first boot only.",
                      "defaultValue": "{{PAPERLESS_ADMIN_PASSWORD}}"
                    },
                    "PAPERLESS_CONSUMPTION_DIR": {
                      "isOptional": false,
                      "description": "Drop folder watched for new documents to ingest.",
                      "defaultValue": "/usr/src/paperless/data/consume"
                    },
                    "PAPERLESS_WEBSERVER_WORKERS": {
                      "isOptional": false,
                      "description": "Number of web server worker processes.",
                      "defaultValue": "1"
                    },
                    "PAPERLESS_THREADS_PER_WORKER": {
                      "isOptional": false,
                      "description": "Threads per Celery worker process.",
                      "defaultValue": "1"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "ad4e7de4-4ff4-4310-bd32-bd0ab44d7967": {
                      "mountPath": "/usr/src/paperless/data"
                    }
                  }
                },
                "e76b286d-ed38-4dc7-a61f-c9f347a53e42": {
                  "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": "Redis hostname for private-network clients.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "description": "Redis port (usually 6379).",
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "description": "Redis username, if authentication requires one.",
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Full Redis connection URL for clients.",
                      "defaultValue": "redis://${{REDISUSER}}:${{REDIS_PASSWORD}}@${{REDISHOST}}:${{REDISPORT}}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "description": "Redis password.",
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis password (alternate export name).",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "e76b286d-ed38-4dc7-a61f-c9f347a53e42": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-10-17T04:14:47.046Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-10-17T02:22:36.267Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_0785f61675cb42e29480",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 110,
    "typical_build_seconds": 0,
    "typical_start_seconds": 30,
    "slowest_service": "paperless-ngx"
  }
}
