High-availability reference data platform for a national transport operator in an air-gapped network

A state railway research institute needed a centralized reference data platform for suburban passenger transport management — covering train categories, routes, tariffs, ticket types, and passenger benefit schemes. The platform had to run in an air-gapped enterprise network, maintain high availability for mission-critical data, and synchronize bidirectionally with the national rail ticketing system. We designed and operated the full backend infrastructure: a Patroni-managed PostgreSQL HA cluster on Docker Compose, a WildFly Java EE application tier, and an FTP-based data exchange pipeline — all deployed offline without public internet access.

  • HAPatroni PostgreSQL cluster
  • Air-gapOffline Kubernetes deployment
  • 2-wayNational ticketing integration
  • ZeroSingle point of failure
High-availability reference data platform for a national transport operator in an air-gapped network

Context

Enterprise transport data in an isolated network — no cloud, no public internet

The platform served a state transport research institute operating in a closed enterprise network — no connection to public internet, no cloud registry, no external package sources. The reference data (routes, tariffs, schedules, benefit rules) had to stay available 24/7 because downstream systems — including the national rail ticketing platform — depended on it. A single PostgreSQL instance was not acceptable for this workload.

Challenge

HA database, offline deployment, and legacy FTP integration — simultaneously

Three hard constraints had to be solved together: (1) PostgreSQL had to be highly available with automatic failover and readable replicas — in an environment where managed database services don't exist; (2) the entire stack — Kubernetes, container images, application artifacts — had to be installable from local mirrors with no internet access; (3) data had to flow bidirectionally with the national ticketing system via FTP in CSV format, including tariff tables with complex encoding and date logic.

Solution

Patroni HA on Kubernetes, air-gap tooling, and a Java FTP replication pipeline

We designed and operated the full infrastructure stack: Patroni-managed PostgreSQL cluster on Kubernetes for automatic failover, a custom air-gap deployment procedure for offline environments, and a Java-based FTP replication pipeline for bidirectional data exchange with the national ticketing platform.

Patroni PostgreSQL HA on Docker Compose

Deployed PostgreSQL as a Patroni-managed cluster on Docker Compose — primary/replica topology with automatic leader election, dedicated read replica service, and HTTP readiness probes for zero-downtime restarts. Separate docker-compose configurations for PostgreSQL HA and the application tier (WildFly, Nginx).

Air-gap deployment

Prepared a fully offline installation procedure: pre-pulled container images saved as tarballs, local Docker registry mirror, and scripted bootstrap for CentOS 7 and CentOS 8 target environments. The entire platform could be deployed and updated without any internet connectivity.

FTP-based integration with national ticketing system

Built a Java batch pipeline (running on WildFly) for bidirectional data exchange: NSIExport pushes reference table updates to the ticketing platform via FTP, KOZRVLoader pulls tariff CSV files from the ticketing platform and loads them into PostgreSQL. Handles CP1251 encoding, complex date period logic (monthly, quarterly, weekly), and incremental upsert semantics.

Observability

Configured Prometheus pg_exporter with custom queries for replication lag, postmaster uptime, table-level I/O stats, and pg_stat_statements query performance. Nginx as the application reverse proxy.

Engineering approach

How it was built

01

HA database design

Designed the Patroni cluster topology on Docker Compose: primary/replica setup with automatic leader election, separate read replica service, and readiness probe on the Patroni REST API for zero-downtime restarts.

02

Air-gap packaging

Built the offline deployment kit: saved all required Docker images as tarballs, set up a local registry mirror, and scripted the full environment bootstrap for CentOS 7 and CentOS 8 target servers.

03

FTP replication pipeline

Implemented the Java batch jobs for both directions: export of NSI reference tables to the ticketing platform and import of tariff data from it. Built the encoding conversion (CP1251), date-period normalization functions in PostgreSQL, and incremental upsert logic.

04

Monitoring & operations

Deployed pg_exporter with custom query configuration, set up replication lag alerting, configured Nginx routing, and documented the full operational runbook for the air-gapped environment.

Results

Measured impact

  • HAZero single point of failure
  • 100%Offline deployable
  • 2-wayTicketing platform sync
  • FullReplication observability

Technology

Stack & capabilities

  • PostgreSQL
  • Patroni
  • Docker Compose
  • WildFly
  • Java EE
  • Angular
  • Nginx
  • Prometheus
  • Docker
  • CentOS

Facing a similar challenge?

Start a project