This repository contains a Docker setup for deploying PostgreSQL on Railway.
The Dockerfile contains default credentials for initial setup:
- Default User: postgres
- Default Password: defaultpassword
- Default Database: railway_db
Make sure to change these in Railway's environment variables for production use!
- Copy the environment file:
cp .env.example .env
- Start the database:
docker-compose up -d
- Connect to the database:
psql postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}
- Install Railway CLI:
npm i -g @railway/cli
- Login to Railway:
railway login
- Link your project:
railway link
- Deploy to Railway:
railway up
- Set Environment Variables in Railway Dashboard:
- Go to your project settings
- Add the following variables:
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_DB
POSTGRES_USER
: Database userPOSTGRES_PASSWORD
: Database passwordPOSTGRES_DB
: Database name
- PostgreSQL 15
- Automatic database initialization
- Health checks
- Persistent volume storage
- Environment variable configuration
- Sample table creation script