---
title: "Deploy 🚀 PostgreSQL 18 HA Cluster (AI & GIS Ready)"
description: "🚀 Postgres 18 HA Cluster with AI, GIS, and Cron Extensions. Ready to scale"
category: "Other"
url: https://railway.com/deploy/postgresql-18-ha-cluster-ai-and-gis-read
---

# Deploy 🚀 PostgreSQL 18 HA Cluster (AI & GIS Ready)

🚀 Postgres 18 HA Cluster with AI, GIS, and Cron Extensions. Ready to scale

**[Deploy 🚀 PostgreSQL 18 HA Cluster (AI & GIS Ready) on Railway](https://railway.com/template/postgresql-18-ha-cluster-ai-and-gis-read)**

- **Creator:** iCue
- **Category:** Other
- **Total deploys:** 9

## Template content

### postgres-18-primary https://devicons.railway.app/pos

- **Source:** icueth/railsway-timescaledb-replica

### postgres-18-proxy https://devicons.railway.app/pos

- **Source:** icueth/railsway-timescaledb-replica

### postgres-18-replica https://devicons.railway.app/pos

- **Source:** icueth/railsway-timescaledb-replica

## Documentation

# Deploy and Host PostgreSQL 18 HA Cluster (AI &amp; GIS Ready) on Railway

PostgreSQL 18 HA Cluster is a production-ready, high-availability database setup featuring automatic failover, streaming replication, and load balancing via Pgpool-II. Pre-configured with pgvector for AI/ML embeddings, PostGIS for geospatial data, pg_cron for scheduled jobs, and pg_partman for table partitioning. Zero-config deployment — just set your password and go!

## About Hosting PostgreSQL 18 HA Cluster (AI &amp; GIS Ready)

This template deploys a complete 3-node PostgreSQL cluster: a Primary (read/write), a Replica (read-only with streaming replication), and a Proxy (Pgpool-II for load balancing and automatic failover). All nodes are pre-configured with enterprise-grade extensions and security settings. The setup handles replication slots, user synchronization, and health checks automatically. Simply configure `POSTGRES_PASSWORD`, and optionally `POSTGRES_USER` and `POSTGRES_DB`, then deploy. The cluster initializes itself, creates replication users, and starts streaming data between nodes within seconds.

## Common Use Cases

- **AI/ML Applications**: Store and query vector embeddings with pgvector for similarity search, RAG pipelines, and recommendation systems
- **Geospatial Applications**: Build location-based services, mapping applications, and spatial analytics with PostGIS
- **High-Traffic Production Databases**: Scale read operations across multiple replicas with automatic load balancing
- **Scheduled Data Processing**: Run automated maintenance, ETL jobs, and data cleanup with pg_cron
- **Enterprise Applications**: Handle failover scenarios automatically without application changes

## Dependencies for PostgreSQL 18 HA Cluster (AI &amp; GIS Ready) Hosting

- **POSTGRES_PASSWORD** (Required): Your database password
- **POSTGRES_USER** (Optional): Database username (default: `postgres`)
- **POSTGRES_DB** (Optional): Database name (default: `postgres`)
- **REPLICATION_USER** (Optional): Replication username (default: `replicator`)

### Deployment Dependencies

- [PostgreSQL 18 Official Documentation](https://www.postgresql.org/docs/18/)
- [Pgpool-II Documentation](https://www.pgpool.net/docs/latest/en/html/)
- [pgvector Extension](https://github.com/pgvector/pgvector)
- [PostGIS Extension](https://postgis.net/)
- [pg_cron Extension](https://github.com/citusdata/pg_cron)

### Implementation Details

**Connect via Proxy (Recommended - Load Balanced):**

psql postgresql://postgres:YOUR_PASSWORD@postgres-18-proxy.railway.internal:5432/postgres

**Connect directly to Primary (Read/Write):**

psql postgresql://postgres:YOUR_PASSWORD@postgres-18-primary.railway.internal:5432/postgres

**Connect directly to Replica (Read-Only):**

psql postgresql://postgres:YOUR_PASSWORD@postgres-18-replica.railway.internal:5432/postgres

**Example: Using pgvector for AI embeddings:**

-- Create a table with vector column
CREATE TABLE items (
    id SERIAL PRIMARY KEY,
    content TEXT,
    embedding vector(1536)
);

-- Find similar items
SELECT * FROM items ORDER BY embedding &lt;-&gt; '[0.1, 0.2, ...]' LIMIT 5;

**Example: Schedule a job with pg_cron:**

-- Run a cleanup job every day at 3 AM
SELECT cron.schedule('daily-cleanup', '0 3 * * *', 'DELETE FROM logs WHERE created_at &lt; NOW() - INTERVAL ''30 days''');

### Pre-installed Extensions

| Extension | Purpose |
|-----------|---------|
| pgvector | AI/ML vector similarity search |
| postgis | Geospatial data and queries |
| pg_cron | Scheduled background jobs |
| pg_partman | Automatic table partitioning |
| pg_stat_statements | Query performance monitoring |
| pg_trgm | Fuzzy text search |
| uuid-ossp | UUID generation |

## Why Deploy PostgreSQL 18 HA Cluster (AI &amp; GIS Ready) on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PostgreSQL 18 HA Cluster (AI &amp; GIS Ready) on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Support This Project

If this template saves you time and money, consider supporting its development! ☕

[![Support Me](https://img.shields.io/badge/Support%20Me-Stripe-blue?style=for-the-badge&logo=stripe)](https://buy.stripe.com/14A28sbLa5mJ8SM5qY2VG01)

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/postgresql-18-ha-cluster-ai-and-gis-read
