---
title: "Deploy GeoServer"
description: "Publishes maps and geospatial data as OGC web services"
category: "Other"
url: https://railway.com/deploy/geoserver
---

# Deploy GeoServer

Publishes maps and geospatial data as OGC web services

**[Deploy GeoServer on Railway](https://railway.com/template/geoserver)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/geoserver/manifest.json

- **Creator:** A3A
- **Category:** Other
- **Total deploys:** 1

## Template content

### postgis https://postgis.net/brand.svg

- **Image:** postgis/postgis:18-3.6
- **Start command:** `/bin/sh -c 'M=$(cat /sys/fs/cgroup/memory.max 2>/dev/null); case "$M" in ""|max|*[!0-9]*) M=2147483648;; esac; SB=$((M/4/1048576)); EC=$((M*3/5/1048576)); MW=$((M/16/1048576)); [ "$MW" -gt 1024 ] && MW=1024; [ "$SB" -lt 128 ] && SB=128; echo "[railway] shared_buffers=${SB}MB effective_cache_size=${EC}MB maintenance_work_mem=${MW}MB"; exec docker-entrypoint.sh postgres -c shared_buffers=${SB}MB -c effective_cache_size=${EC}MB -c maintenance_work_mem=${MW}MB -c work_mem=16MB -c dynamic_shared_memory_type=mmap -c random_page_cost=1.1 -c effective_io_concurrency=200 -c wal_compression=on -c max_connections=100'`

### geoserver https://cdn.jsdelivr.net/gh/gridalpha/geoserver-railway@main/brand/geoserver-icon.png

- **Source:** https://github.com/gridalpha/geoserver-railway
- **Health check:** /geoserver/gwc
- **Public domain:** Yes

## Documentation

# Deploy and Host GeoServer on Railway

GeoServer is the open-source server that turns spatial data into web services. Point it at a PostGIS table, a GeoTIFF, a Shapefile or a GeoPackage and it publishes that data as OGC-standard endpoints — WMS and WMTS for rendered maps and tiles, WFS for raw features, WCS for coverages, WPS for geoprocessing — which QGIS, ArcGIS, OpenLayers and MapLibre already consume. Mapping agencies, utilities and researchers run it between their geodatabase and everything that needs a map.

Deploy GeoServer 3.0.1 on Tomcat 11 and JDK 21 in the `geoserver` service, with a `postgis` service beside it running PostgreSQL 18 and PostGIS 3.6. Requests arrive at the public GeoServer domain; GeoServer reads and writes spatial tables over a pooled JNDI connection on the private network, so the database is never exposed. Each service keeps a volume — GeoServer's holds the catalog, styles, uploads and the tile cache. Self-host GeoServer and the whole stack sits behind one URL.

![Diagram of the GeoServer and PostGIS services on Railway](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789575587/geoserver-architecture.webp)

## Getting Started with GeoServer on Railway

Open the deployed URL and you land on the welcome page listing every OGC service the instance publishes. Sign in at the top right as `admin` with the password in `GEOSERVER_ADMIN_PASSWORD`, generated at deploy time and visible in the Railway dashboard. It ships with GeoServer's sample workspaces — `topp`, `tiger`, `ne`, `sf`, `nurc` — so there is something to look at before you add data; `SKIP_DEMO_DATA=true` starts from an empty catalog.

The fastest check that it works is Data → Layer Preview: pick `topp:states` and open the OpenLayers preview, which renders through the full WMS pipeline. To publish your own data, go to Data → Stores → Add new Store and choose **PostGIS (JNDI)**; the reference name is `java:comp/env/jdbc/postgres`, already wired to the database, so no host or password is needed. Any spatial table there becomes a layer served over WMS, WFS and WMTS, and `/geoserver/rest` does the same for scripts. Before sharing the URL, change the master password under Security → Passwords and use Security → Data to decide what anonymous visitors may read.

![GeoServer admin dashboard listing six workspaces and 29 layers](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789575589/geoserver-welcome-dashboard.webp)

![GeoServer rendering a coloured US states map in OpenLayers](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789575591/geoserver-states-map-preview.webp)

![GeoServer store list showing the PostGIS JNDI connection](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789575592/geoserver-postgis-store-list.webp)

## About Hosting GeoServer

GeoServer solves a specific problem: your spatial data lives in a database or a pile of files, and everything that wants to draw it — a web map, a desktop GIS, a partner agency — speaks OGC standards instead. Publish once and the standards do the integration. Teams self-host it when the data cannot leave their infrastructure, when per-request pricing stops adding up, or when they need styling a tile product does not offer.

- **Standards** — WMS 1.1.1/1.3.0, WMTS, TMS, WFS 1.0/1.1/2.0 with WFS-T, WCS 2.0.1, WPS 1.0.0, CSW 2.0.2
- **Data sources** — PostGIS, GeoPackage, Shapefile, GeoTIFF, image mosaics
- **Styling** — SLD plus the CSS, YSLD and MapBox Style languages
- **Vector tiles** — MVT, GeoJSON and TopoJSON for MapLibre and OpenLayers
- **Tile cache** — GeoWebCache serves pre-rendered tiles from the volume
- **Security** — per-layer and per-service rules, plus API-key auth via `authkey`

Two services do the work. `geoserver` renders maps, answers feature requests, runs the admin UI at `/geoserver/web` and the REST API, and caches tiles on its volume. `postgis` is the spatial database: it adds geometry types, spatial indexes and hundreds of spatial functions to PostgreSQL, and holds your vector data.

## Why Deploy GeoServer on Railway

Railway removes the setup that usually surrounds a GeoServer install:

- PostGIS provisioned and connected over the private network, not the public internet
- Persistent volumes for the data directory and the database, so the catalog survives redeploys
- HTTPS and a public domain issued automatically, with capabilities documents pointing at it
- Eighteen extensions built into the image, so no cold-boot downloads
- Vertical scaling from the dashboard

## Common Use Cases

- **Public map portals** — publish planning, zoning or environmental layers as WMS and WMTS
- **Feeding desktop GIS** — hand QGIS or ArcGIS a WFS endpoint so analysts work on live data
- **Vector tile backends** — serve MVT tiles from PostGIS to MapLibre, no separate pipeline
- **Editable field data** — accept edits from mobile and web clients over WFS-T

## Dependencies for GeoServer

- **GeoServer 3.0.1** — built from [gridalpha/geoserver-railway](https://github.com/gridalpha/geoserver-railway) on the official `docker.osgeo.org/geoserver:3.0.1` image, adding the extension set, a proxy-aware Tomcat configuration and a first-boot entrypoint.
- **PostGIS 3.6 on PostgreSQL 18** — the `postgis/postgis:18-3.6` image, storing vector data and answering the spatial queries GeoServer issues when rendering.

### Environment Variables Reference

| Variable | Purpose |
|---|---|
| `GEOSERVER_ADMIN_USER` | Administrator username, `admin` by default |
| `GEOSERVER_ADMIN_PASSWORD` | Administrator password, generated at deploy time |
| `GEOSERVER_MASTER_PASSWORD` | The `root` password, replacing GeoServer's published default |
| `PROXY_BASE_URL` | Public base URL written into capabilities documents |
| `POSTGRES_JNDI_ENABLED` | Publishes the `java:comp/env/jdbc/postgres` datasource |
| `SKIP_DEMO_DATA` | `true` starts from an empty catalog |
| `CORS_ENABLED` | Lets browser map clients on other origins read the services |
| `EXTRA_JAVA_OPTS` | Overrides the heap and processor count |

### Deployment Dependencies

- Source repository: 
- Upstream project: 
- Official image:  · Docs: 
- Runtime: Tomcat 11, Temurin JDK 21

## Hardware Requirements for Self-Hosting GeoServer

GeoServer is a JVM application and rendering is memory-hungry; the tile cache grows disk use.

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2–4 vCPU |
| RAM | 2 GB | 4–8 GB |
| Storage | 5 GB volume | 20 GB+ with tile cache |
| Runtime | JDK 17 | JDK 21, Tomcat 11 |

The entrypoint reads the container's memory and CPU limits and sets the JVM heap to roughly 70% of the memory ceiling, so raising the service's resources raises the heap.

## Self-Hosting GeoServer

To run the official image locally, give it an admin password and a data directory:

```
docker run -d --name geoserver -p 8080:8080 \
  -e GEOSERVER_ADMIN_USER=admin \
  -e GEOSERVER_ADMIN_PASSWORD=change-me \
  -v geoserver_data:/opt/geoserver_data \
  docker.osgeo.org/geoserver:3.0.1
```

GeoServer is then at `http://localhost:8080/geoserver/web`. To build this template's image, with the extensions and proxy configuration:

```
git clone https://github.com/gridalpha/geoserver-railway.git
cd geoserver-railway &amp;&amp; docker build -t geoserver-railway .
docker run -d -p 8080:8080 -e GEOSERVER_ADMIN_PASSWORD=change-me \
  -e ROOT_WEBAPP_REDIRECT=true -v geoserver_data:/opt/geoserver_data geoserver-railway
```

Point it at a database with `POSTGRES_JNDI_ENABLED=true` plus `POSTGRES_HOST`, `POSTGRES_DB`, `POSTGRES_USERNAME` and `POSTGRES_PASSWORD`.

## How Much Does GeoServer Cost to Self-Host?

GeoServer is free and open source under the GPL 2.0 licence — no paid tier, no seat limits, no usage metering, and every extension here belongs to the same project. PostGIS and PostgreSQL are likewise free. The only cost is the infrastructure the two services consume on Railway, billed on the CPU, memory, storage and egress you use. That is why teams move off per-request mapping APIs: a tile endpoint costs the compute it burns.

## FAQ

**What is GeoServer?**
An open-source Java server that publishes geospatial data from databases and files as OGC-standard web services — WMS, WMTS, WFS, WCS, WPS and CSW — so any standards-aware client can read it.

**What does this Railway template deploy?**
Two services: `geoserver`, running GeoServer 3.0.1 with a persistent data directory and a public HTTPS domain, and `postgis`, running PostgreSQL 18 with PostGIS 3.6 on its own volume, reachable only privately.

**Why does the template include a PostGIS database?**
GeoServer renders and filters data but does not store vector data itself. PostGIS gives it geometry types, spatial indexing and spatial SQL, which is what makes attribute filters and edits fast.

**How do I connect GeoServer to PostGIS on Railway?**
In the admin UI go to Data → Stores → Add new Store, choose **PostGIS (JNDI)**, and enter `java:comp/env/jdbc/postgres` as the reference name. The pool comes from the database service's own variables, so there is nothing else to enter.

**How do I serve vector tiles from self-hosted GeoServer?**
The `vectortiles` extension is built in. Add `application/vnd.mapbox-vector-tile` to a layer's formats under Tile Caching, then point MapLibre at the WMTS endpoint — no tile server needed.

**Is the admin interface protected?**
Yes. `/geoserver/web` and `/geoserver/rest` both require the administrator account, and REST answers 401 anonymously. OGC endpoints are readable anonymously by default, which is usually the point of a map server; tighten that per layer under Security → Data.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — 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/geoserver
