{
  "manifest_version": "1.0.0",
  "template": {
    "id": "1d32c989-3d29-4a9e-8b6c-33c34c6b1cb6",
    "slug": "postgresql-with-extensions",
    "name": "PostgreSQL with Extensions",
    "description": "PostgreSQL with SSL and dynamic extensions.",
    "url": "https://railway.com/deploy/postgresql-with-extensions",
    "upstream": {
      "repo_url": "https://github.com/ncontiero/postgres-ssl"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "repo": "https://github.com/ncontiero/postgres-ssl"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql",
      "tcp_ports": [
        5432
      ],
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/18/docker"
    },
    {
      "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": "SSL_REQUIRE",
      "service": "Postgres",
      "description": "Set to true to reject plaintext TCP database and replication connections.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "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": "Server certificate validity in days.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_VERSION",
      "service": "Postgres",
      "description": "Specifies the base PostgreSQL version to use when building the image.",
      "secret": false,
      "strategy": "default",
      "default": "18.6"
    },
    {
      "key": "SSL_CA_CERT_DAYS",
      "service": "Postgres",
      "description": "Private Certificate Authority validity in days.",
      "secret": false,
      "strategy": "default",
      "default": "3650"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password to connect to DB.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public URL to connect to Postgres database, used by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RUNTIME_LOCK_WAIT_SECONDS",
      "service": "Postgres",
      "description": "Maximum time to wait for a previous deployment to release the volume.",
      "secret": false,
      "strategy": "default",
      "default": "300"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Allow PostgreSQL to shut down cleanly.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "postgresql-with-extensions"
      }
    },
    "cli": "railway deploy --template postgresql-with-extensions",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "1d32c989-3d29-4a9e-8b6c-33c34c6b1cb6",
            "serializedConfig": {
              "services": {
                "a892eb7c-6c6b-4ae1-80aa-38876dd0d916": {
                  "icon": "https://devicons.railway.app/postgres",
                  "name": "Postgres",
                  "source": {
                    "repo": "ncontiero/postgres-ssl",
                    "branch": null,
                    "rootDirectory": "with-extensions"
                  },
                  "variables": {
                    "PGDATA": {
                      "description": "Location where the database will be initialized.",
                      "defaultValue": "/var/lib/postgresql/18/docker"
                    },
                    "PGHOST": {
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "description": "Required variable for Data panel.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "description": "Required variable for Data panel.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway"
                    },
                    "SSL_REQUIRE": {
                      "description": "Set to true to reject plaintext TCP database and replication connections.",
                      "defaultValue": "false"
                    },
                    "DATABASE_URL": {
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "description": "User to connect to Postgres DB.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "description": "Server certificate validity in days.",
                      "defaultValue": "820"
                    },
                    "PG_APT_PACKAGES": {
                      "isOptional": true,
                      "description": "A comma-separated list of APT package names for the extensions (e.g., postgresql-18-postgis-3,timescaledb-2-postgresql-18).",
                      "defaultValue": ""
                    },
                    "PG_DB_EXTENSIONS": {
                      "isOptional": true,
                      "description": "A comma-separated list of extension names to enable in the database (e.g., postgis,pg_cron,timescaledb).",
                      "defaultValue": ""
                    },
                    "POSTGRES_VERSION": {
                      "isOptional": true,
                      "description": "Specifies the base PostgreSQL version to use when building the image.",
                      "defaultValue": "18.6"
                    },
                    "SSL_CA_CERT_DAYS": {
                      "description": "Private Certificate Authority validity in days.",
                      "defaultValue": "3650"
                    },
                    "POSTGRES_PASSWORD": {
                      "description": "Password to connect to DB.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "PG_EXTENSION_REPOS": {
                      "isOptional": true,
                      "description": "A comma-separated list of APT repository URLs to add (e.g., https://packagecloud.io/timescale/timescaledb/debian/ trixie main).",
                      "defaultValue": ""
                    },
                    "DATABASE_PUBLIC_URL": {
                      "description": "Public URL to connect to Postgres database, used by the Data panel.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "PG_EXTENSION_REPO_KEYS": {
                      "isOptional": true,
                      "description": "A comma-separated list of GPG key URLs corresponding to PG_EXTENSION_REPOS.",
                      "defaultValue": ""
                    },
                    "RUNTIME_LOCK_WAIT_SECONDS": {
                      "description": "Maximum time to wait for a previous deployment to release the volume.",
                      "defaultValue": "300"
                    },
                    "PG_SHARED_PRELOAD_LIBRARIES": {
                      "isOptional": true,
                      "description": "A comma-separated list of shared libraries to preload (e.g., timescaledb).",
                      "defaultValue": ""
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "description": "Allow PostgreSQL to shut down cleanly.",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    }
                  },
                  "volumeMounts": {
                    "a892eb7c-6c6b-4ae1-80aa-38876dd0d916": {
                      "mountPath": "/var/lib/postgresql"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T10:14:37.339Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-20T10:40:18.903Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_2b9c9f5d01ec48a18a35",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 119,
    "typical_build_seconds": 51,
    "typical_start_seconds": 10,
    "slowest_service": "Postgres"
  }
}
