{
  "manifest_version": "1.0.0",
  "template": {
    "id": "706fd651-e692-4740-8ccc-07d8d63132d1",
    "slug": "timescale-postgis",
    "name": "TimescaleDB + PostGIS | Open Source Time-Series and Geospatial Postgres",
    "description": "Postgres 18, TimescaleDB and PostGIS — time-series and geospatial in one DB",
    "url": "https://railway.com/deploy/timescale-postgis",
    "upstream": {
      "image": "timescale/timescaledb-ha:pg18.6-ts2.30.0-all"
    }
  },
  "services": [
    {
      "name": "TimescaleDB",
      "source": {
        "image": "timescale/timescaledb-ha:pg18.6-ts2.30.0-all"
      },
      "needs_volume": true,
      "volume_mount_path": "/home/postgres/pgdata",
      "tcp_ports": [
        5432
      ],
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "TimescaleDB",
      "description": "The port Railway routes to. Set explicitly because the image exposes three (5432 plus Patroni's 8008 and pgbackrest's 8081, both unused here).",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGDATA",
      "service": "TimescaleDB",
      "description": "Where the cluster lives — one level below the volume mount, because Railway puts a `lost+found` entry at the mount point and initdb refuses a non-empty directory. Note this image keeps data under the postgres user's home, not the usual /var/lib/postgresql.",
      "secret": false,
      "strategy": "default",
      "default": "/home/postgres/pgdata/data"
    },
    {
      "key": "POSTGRES_DB",
      "service": "TimescaleDB",
      "description": "Database created on the first boot. The timescaledb, timescaledb_toolkit and postgis extensions are created inside it for you.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "POSTGRES_USER",
      "service": "TimescaleDB",
      "description": "Superuser role created by initdb on the first boot.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "TimescaleDB",
      "description": "Runs the container as root. The image declares `USER postgres`, and a non-root process cannot take ownership of a freshly attached Railway volume. Safe here because the entrypoint chowns the data directory and then re-executes itself as postgres via gosu.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "TimescaleDB",
      "description": "Password for the postgres role. Generated at deploy — the database is reachable from the internet through the TCP proxy, so treat it as a production credential.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "TIMESCALEDB_TELEMETRY",
      "service": "TimescaleDB",
      "description": "Turns off TimescaleDB's usage reporting and its background job. Set to `basic` if you would rather report upstream.",
      "secret": false,
      "strategy": "default",
      "default": "off"
    },
    {
      "key": "POSTGRES_HOST_AUTH_METHOD",
      "service": "TimescaleDB",
      "description": "Authentication for remote connections. Do not set this to `trust` — the TCP proxy is a public endpoint.",
      "secret": false,
      "strategy": "default",
      "default": "scram-sha-256"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "timescale-postgis"
      }
    },
    "cli": "railway deploy --template timescale-postgis",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "706fd651-e692-4740-8ccc-07d8d63132d1",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "452e2078-d712-4804-8052-f87753f55c75": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgresql.svg",
                  "name": "TimescaleDB",
                  "deploy": {
                    "startCommand": "sh -c '( for i in $(seq 1 150); do pg_isready -h 127.0.0.1 -q && break; sleep 2; done; PGPASSWORD=\"$POSTGRES_PASSWORD\" psql -h 127.0.0.1 -U \"$POSTGRES_USER\" -d \"$POSTGRES_DB\" -c \"CREATE EXTENSION IF NOT EXISTS postgis;\" ) & exec /docker-entrypoint.sh postgres'",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 2
                  },
                  "source": {
                    "image": "timescale/timescaledb-ha:pg18.6-ts2.30.0-all"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "The port Railway routes to. Set explicitly because the image exposes three (5432 plus Patroni's 8008 and pgbackrest's 8081, both unused here).",
                      "defaultValue": "5432"
                    },
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Where the cluster lives — one level below the volume mount, because Railway puts a `lost+found` entry at the mount point and initdb refuses a non-empty directory. Note this image keeps data under the postgres user's home, not the usual /var/lib/postgresql.",
                      "defaultValue": "/home/postgres/pgdata/data"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created on the first boot. The timescaledb, timescaledb_toolkit and postgis extensions are created inside it for you.",
                      "defaultValue": "railway"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser role created by initdb on the first boot.",
                      "defaultValue": "postgres"
                    },
                    "RAILWAY_RUN_UID": {
                      "isOptional": false,
                      "description": "Runs the container as root. The image declares `USER postgres`, and a non-root process cannot take ownership of a freshly attached Railway volume. Safe here because the entrypoint chowns the data directory and then re-executes itself as postgres via gosu.",
                      "defaultValue": "0"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the postgres role. Generated at deploy — the database is reachable from the internet through the TCP proxy, so treat it as a production credential.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "TIMESCALEDB_TELEMETRY": {
                      "isOptional": false,
                      "description": "Turns off TimescaleDB's usage reporting and its background job. Set to `basic` if you would rather report upstream.",
                      "defaultValue": "off"
                    },
                    "POSTGRES_HOST_AUTH_METHOD": {
                      "isOptional": false,
                      "description": "Authentication for remote connections. Do not set this to `trust` — the TCP proxy is a public endpoint.",
                      "defaultValue": "scram-sha-256"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    }
                  },
                  "volumeMounts": {
                    "452e2078-d712-4804-8052-f87753f55c75": {
                      "mountPath": "/home/postgres/pgdata"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T16:14:49.616Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-19T19:51:42.761Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_7162e3bac247478ab38f",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 106,
    "typical_build_seconds": 0,
    "typical_start_seconds": 56,
    "slowest_service": "TimescaleDB"
  }
}
