Skip to content

kunal-bm/postgres-railway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Railway PostgreSQL Docker Setup

This repository contains a Docker setup for deploying PostgreSQL on Railway.

Important Note

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!

Local Development

  1. Copy the environment file:
cp .env.example .env
  1. Start the database:
docker-compose up -d
  1. Connect to the database:
psql postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}

Railway Deployment

  1. Install Railway CLI:
npm i -g @railway/cli
  1. Login to Railway:
railway login
  1. Link your project:
railway link
  1. Deploy to Railway:
railway up
  1. Set Environment Variables in Railway Dashboard:
    • Go to your project settings
    • Add the following variables:
      • POSTGRES_USER
      • POSTGRES_PASSWORD
      • POSTGRES_DB

Environment Variables

  • POSTGRES_USER: Database user
  • POSTGRES_PASSWORD: Database password
  • POSTGRES_DB: Database name

Features

  • PostgreSQL 15
  • Automatic database initialization
  • Health checks
  • Persistent volume storage
  • Environment variable configuration
  • Sample table creation script

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published