5 days ago
Hi everyone,
We're evaluating Railway for a production app: a Next.js web service, a separate worker service, and Postgres, deployed in the Southeast Asia (Singapore) region. The data is business-critical, so backups and restores are our main concern. We have a few questions before we commit and would love to hear from anyone with experience running similar setups here.
Postgres version and extensions
- Can we run Postgres 18 with PostGIS 3.6 on Railway? We also need the btree_gist extension (we use an exclusion constraint). Is that available through the standard PostGIS template, or should we bring our own image (postgis/postgis:18-3.6)?
Point-in-time recovery
- Does Railway's PITR (pgBackRest WAL archiving) work with the PostGIS template, or with a custom Postgres image, or only with the standard Postgres image?
- What is the recovery point objective in practice: how often is WAL archived (per segment, or also on a timer such as archive_timeout), and how much data could we lose in the worst case?
- How long are base backups and WAL retained, and can we change the retention?
- Where is the PITR bucket stored? Can it be in the same region as the database (Singapore), and is it stored separately from the database volume, so that losing the volume or the service doesn't lose the backups?
- How does a restore work: is it in place, or into a new service/volume that we then switch to? Roughly how long does it take for a database of a few GB, and can we restore to a separate service to test without touching production?
- If a project or service is deleted by mistake, what can still be recovered, and for how long?
Availability and operations
- Is Postgres a single container on a single volume, or is there any replication or automatic failover? If a host fails, what happens and how quickly is the database back?
- Does Railway ever move a service or volume to another region or host without the owner's action? We saw a forum report of a database being moved to Southeast Asia. If they do, how are we notified, and is there downtime?
- How are Postgres minor and major version upgrades handled?
- Can we set max_connections and other postgresql.conf settings?
Networking for the app
- Do long-lived connections work? Our app keeps a Postgres connection open with LISTEN/NOTIFY, and serves Server-Sent Events (HTTP responses held open for many minutes, with a heartbeat every 25 seconds). Is there a maximum duration or idle timeout on HTTP responses through the Railway proxy?
- When a service is redeployed or scaled down, how long is the grace period after SIGTERM before SIGKILL?
Support and cost
- For those on the Pro plan, what support response times have you actually experienced, and is there a higher tier for production databases?
- How is PITR storage billed (per GB of WAL and base backups)?
Thanks in advance for any insights!
2 Replies
Status changed to Awaiting Railway Response Railway • 5 days ago
5 days ago
PostGIS runs today through the standalone PostGIS template; it is not in our official Postgres image and cannot be converted to HA. We have not verified btree_gist or Postgres 18 with PostGIS 3.6 in that template, so test it first.
PITR is built into our Postgres image. When enabled, it archives every WAL segment to a separate storage bucket with archive_timeout=60, takes a weekly full and daily differential base backup, and keeps the last 4 fulls, roughly 4 weeks. A restore never touches the source: it creates a new service from the archive, and you cut over manually, so testing restores is safe. PITR is billed as bucket storage plus upload egress on compressed data; restores are free. See Point-in-Time Recovery.
A project deleted from the dashboard can be restored for 48 hours. A deleted service is removed immediately, and a deleted bucket stays restorable for about two days. Beyond those windows, we do not perform data restoration.
Standalone Postgres is one container on one volume. If its host fails, the workload is rescheduled once the host is recovered, so for mission-critical databases we advise HA, which does not support PostGIS.
Server-Sent Events stream through our edge without buffering. After SIGTERM, the old deployment gets a configurable draining time before SIGKILL, set in service settings or RAILWAY_DEPLOYMENT_DRAINING_SECONDS (docs).
We could not confirm HTTP idle limits, Railway-initiated host or region moves, version upgrades, or postgresql.conf access for this setup.
Status changed to Awaiting User Response Railway • 5 days ago
5 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 5 days ago
4 hours ago
Hi @hxkhan — the linked PostGIS template lists postgis/postgis:16-master. For your workload, I'd make a timestamp restore of the exact production image, including your exclusion constraint, the go-live test.
- Versions and extensions. PG18 + PostGIS 3.6 can run on Railway. Marketplace templates offer it. Upstream stopped updating its Debian 3.6 tags in October. If you use the upstream PG18 image, mount its volume at /var/lib/postgresql (the linked PG16 template mounts /var/lib/postgresql/data). Check in staging:
SHOW server_version;
SELECT name, default_version, installed_version
FROM pg_available_extensions WHERE name IN ('postgis','btree_gist');
A missing row means that extension isn't available in the image. A null installed_version means it is available to enable in this database. Enable both and run your exclusion-constraint migration.
- PITR compatibility. Railway's Postgres image includes pgBackRest and the startup logic for both archiving and restoring. Deploying stock postgis/postgis or setting WAL_ARCHIVE_* alone doesn't supply that integration. Daily dumps only recover to the time of a dump. For custom PostGIS, choose an image with a tested base-backup/WAL restore path or operate that backup pipeline yourself.
3–4. RPO and retention. Railway's image sets archive_timeout=60s. Completed WAL segments upload asynchronously. Under light writes the timer prompts a segment switch. Upload lag can still exceed a minute, and a sustained outage can hit the 5 GiB queue cap and break archive continuity. Monitor archiver health with railway postgres pitr status. Defaults are weekly fulls, daily differentials and four retained fulls (~4 weeks). The image README documents WAL_BACKUP_RETENTION_FULL and WAL_BACKUP_RETENTION_DIFF. Let pgBackRest expire the WAL its backups depend on.
5–7. Placement, restores and deletion. Singapore is a bucket region (sin). Verify the actual Postgres-PITR bucket's region before loading production data. It is separate from the DB volume but still in the project. A PITR restore creates a sibling service and fresh volume. You switch clients manually. In staging, commit marker A, record a UTC target, then commit B. Restore to that target when available. Verify A exists, B is absent, a spatial query works and the exclusion constraint still rejects a conflict. Measure restore time through the first successful app query.
Railway's reply gives 48h for dashboard project recovery, immediate service removal and about two days for bucket recovery. A deleted volume has its own emailed recovery link for up to 48h. Keep a tested copy outside the project if whole-project deletion is in scope.
8–9. Availability and moves. Standalone is one node on one volume, with no published host-recovery deadline. Railway's managed HA can promote a replica within seconds on eligible images. Custom PostGIS is excluded. Select Singapore in the service settings. Moving an attached volume across regions causes downtime. Railway staff reported advance emails for the Metal migrations. For a Singapore residency requirement, get the cross-region policy and notice period confirmed in writing.
10–11. Upgrades and settings. With official PITR, track a major image tag for minor rebuilds. A major upgrade needs the supported upgrade flow or a rehearsed migration with compatible extension binaries. For custom PostGIS, test dump/restore on the target version. With sufficient privileges, ALTER SYSTEM persists settings. Check context and pending_restart in pg_settings. Changing max_connections requires a restart.
12–13. Give LISTEN a dedicated database session over the private network. After a disconnect, reconnect, issue LISTEN again and catch up from durable rows. For public SSE, Railway allows 15 minutes total and 5 minutes without data. Your flushed 25s heartbeat covers inactivity. Send event IDs and resume from Last-Event-ID after the 15-minute cap. On redeploy, the documented SIGTERM grace defaults to 0s. Set RAILWAY_DEPLOYMENT_DRAINING_SECONDS on web and worker. Verify scale-down separately before relying on the same grace.
14–15. Railway says Pro support usually responds within 72h, without an SLO. Business Class/Enterprise is the route for a contractual target. PITR costs $0.015/GB-month of compressed archive retained plus $0.05/GB uploaded from the DB service. Bucket downloads are free. The restored service and volume accrue normal usage.
Sources
https://railway.com/deploy/postgis
https://github.com/postgis/docker-postgis
https://github.com/railwayapp-templates/postgres-ssl
https://docs.railway.com/volumes/point-in-time-recovery
https://docs.railway.com/databases/postgresql-ha
https://docs.railway.com/networking/public-networking/specs-and-limits
https://docs.railway.com/platform/support
AI-assisted. I checked the docs and image repositories. I haven't measured your restore time or Pro support latency.