Skip to content

Commit

Permalink
Add details on backing up the database using the pg_dump tool and the…
Browse files Browse the repository at this point in the history
… Railway CLI.
  • Loading branch information
tedyoung committed Jan 22, 2024
1 parent 1510adc commit 5544a32
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backup-database-from-railway.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Backing up the Railway Postgres Database

### Pre-requisites

* Railway CLI is installed, so we can get the environment variables pointing to the database. See https://docs.railway.app/guides/cli
* Postgres binaries 15 or later (or at least as current as Railway's version) are installed (for pg_dump). See https://blog.railway.app/p/postgre-backup

### Railway Shell

1. railway link
* Link to the Ensembler project
2. railway service
* Use the Ensembler service
3. railway shell
4. echo $PGPASSWORD
5. pg_dump -U $PGUSER -h $PGHOST -p $PGPORT -W -F t $PGDATABASE > database-railway-<today's date>.dump
6. exit

0 comments on commit 5544a32

Please sign in to comment.