Deploy GeoServer

Publishes maps and geospatial data as OGC web services

Deploy GeoServer

Just deployed

/var/lib/postgresql

Just deployed

/opt/geoserver_data

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

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

GeoServer rendering a coloured US states map in OpenLayers

GeoServer store list showing the PostGIS JNDI connection

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 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

VariablePurpose
GEOSERVER_ADMIN_USERAdministrator username, admin by default
GEOSERVER_ADMIN_PASSWORDAdministrator password, generated at deploy time
GEOSERVER_MASTER_PASSWORDThe root password, replacing GeoServer's published default
PROXY_BASE_URLPublic base URL written into capabilities documents
POSTGRES_JNDI_ENABLEDPublishes the java:comp/env/jdbc/postgres datasource
SKIP_DEMO_DATAtrue starts from an empty catalog
CORS_ENABLEDLets browser map clients on other origins read the services
EXTRA_JAVA_OPTSOverrides 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.

ResourceMinimumRecommended
CPU1 vCPU2–4 vCPU
RAM2 GB4–8 GB
Storage5 GB volume20 GB+ with tile cache
RuntimeJDK 17JDK 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 && 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.


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
47
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51