{
  "manifest_version": "1.0.0",
  "template": {
    "id": "ecd2f76a-b636-4b98-9336-608841bb2dd5",
    "slug": "postgres-pitr",
    "name": "Postgres PITR",
    "description": "Postgres with WAL archiving to a bucket for PITR",
    "url": "https://railway.com/deploy/postgres-pitr",
    "upstream": {
      "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Railway Private Domain Name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Required variable for the data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Default database created when image is started.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "URL to connect to Postgres database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "User to connect to Postgres DB",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "SSL certificate expiry in days.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "WAL_ARCHIVE_KEY",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_KEY.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "WAL_ARCHIVE_PATH",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_PATH.",
      "secret": false,
      "strategy": "default",
      "default": "/pgbackrest"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password to connect to DB",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "WAL_ARCHIVE_BUCKET",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_BUCKET.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "WAL_ARCHIVE_REGION",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_REGION.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "WAL_ARCHIVE_SECRET",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_SECRET.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "WAL_ARCHIVE_ENDPOINT",
      "service": "Postgres",
      "description": "Provide a value for WAL_ARCHIVE_ENDPOINT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Allow Postgres to cleanly shut down",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "postgres-pitr"
      }
    },
    "cli": "railway deploy --template postgres-pitr",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "ecd2f76a-b636-4b98-9336-608841bb2dd5",
            "serializedConfig": {
              "buckets": {
                "postgres-pitr-wal": {
                  "name": "Postgres-PITR"
                }
              },
              "services": {
                "47373d21-d9e5-41f7-a484-87e6e4006fbc": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "build": {},
                  "deploy": {
                    "requiredMountPath": "/var/lib/postgresql/data"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18",
                    "preserveExisting": true
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Location where the database will be initialized",
                      "defaultValue": "/var/lib/postgresql/data/pgdata",
                      "preserveExisting": true
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}",
                      "preserveExisting": true
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432",
                      "preserveExisting": true
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{ POSTGRES_USER }}",
                      "preserveExisting": true
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}",
                      "preserveExisting": true
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{POSTGRES_PASSWORD}}",
                      "preserveExisting": true
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway",
                      "preserveExisting": true
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}",
                      "preserveExisting": true
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "User to connect to Postgres DB",
                      "defaultValue": "postgres",
                      "preserveExisting": true
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": true,
                      "description": "SSL certificate expiry in days.",
                      "defaultValue": "820",
                      "preserveExisting": true
                    },
                    "WAL_ARCHIVE_KEY": {
                      "defaultValue": "${{Postgres-PITR.ACCESS_KEY_ID}}"
                    },
                    "WAL_ARCHIVE_PATH": {
                      "defaultValue": "/pgbackrest"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password to connect to DB",
                      "defaultValue": "{{POSTGRES_PASSWORD}}",
                      "preserveExisting": true
                    },
                    "WAL_ARCHIVE_BUCKET": {
                      "defaultValue": "${{Postgres-PITR.BUCKET}}"
                    },
                    "WAL_ARCHIVE_REGION": {
                      "defaultValue": "${{Postgres-PITR.REGION}}"
                    },
                    "WAL_ARCHIVE_SECRET": {
                      "defaultValue": "${{Postgres-PITR.SECRET_ACCESS_KEY}}"
                    },
                    "WAL_ARCHIVE_ENDPOINT": {
                      "defaultValue": "${{Postgres-PITR.ENDPOINT}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Allow Postgres to cleanly shut down",
                      "defaultValue": "60",
                      "preserveExisting": true
                    }
                  },
                  "networking": {},
                  "clusterRole": "root",
                  "volumeMounts": {
                    "47373d21-d9e5-41f7-a484-87e6e4006fbc": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  },
                  "adoptionImageEligibility": {
                    "label": "Point-in-time recovery",
                    "repositories": [
                      "ghcr.io/railwayapp-templates/postgres-ssl",
                      "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni"
                    ],
                    "requireImageEntrypoint": true,
                    "requireFloatingMajorTag": true
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-09-13T04:14:39.446Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-11T10:57:21.486Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_e5be8a504595497c8411",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": false,
        "detail": "Your workspace has been restricted. Please contact support to resolve this."
      }
    ]
  }
}
