I finally configured Kamal to work with Postgres. It took a few days of trial and error — until now I had only used SQLite, which is great for a tiny MVP, but not enough once things start growing... or this is what I am told myself for learn how to configure it :D
Here’s the accessory config I’m using in deploy.yml:
accessories:
postgres:
image: postgres:15
roles:
- web
env:
clear:
POSTGRES_USER: "postgres"
POSTGRES_DB: retro_production
secret:
- POSTGRES_PASSWORD
- POSTGRES_USER
directories:
- data:/var/lib/postgresql/data
files:
- config/init.sql:/docker-entrypoint-initdb.d/setup.sql
Useful commands:
Boot Postgres
kamal accessory boot postgres
Check if it’s running
kamal accessory details postgres
Few post I used for learn this:
https://deploymentfromscratch.com/kamal/running-postgresql-on-kamal/
https://rameerez.com/kamal-tutorial-how-to-deploy-a-postgresql-rails-app/
Top comments (0)