how do I run postgres locally?

I copied this hono/bun/postgres/drizzle template locally https://railway.app/template/hIiRi5 and renamed and cloned the repo locally. How do I run the db migrations/seeding locally using railway up commands? railway up bun run db:generate does not work but if I copy the public db url to a .env file, I'm able to connect to the db via my CLI.
Solution:
you would indeed need to use the public database URL when developing locally
Jump to solution
9 Replies
Percy
Percy4mo ago
Project ID: a2ca1487-d15e-47b9-9817-8cf2ec0824f7
Arti Villa
Arti VillaOP4mo ago
projectID: a2ca1487-d15e-47b9-9817-8cf2ec0824f7
Hys
Hys4mo ago
you have to use railway run not railway up, railway up deploys For example railway run npm start
Arti Villa
Arti VillaOP4mo ago
yep still running into an error.
railway run bun run dev
$ bun run --watch src/index.ts
Started server http://localhost:3000
40 | res = resolve
41 | rej = reject
42 | }).catch((err) => {
43 | // replace the stack trace that leads to `TCP.onStreamRead` with one that leads back to the
44 | // application that created the query
45 | Error.captureStackTrace(err)
^
ECONNREFUSED: Failed to connect
errno: 8
syscall: "connect"

at /Users/artivilla/Documents/figma-extensions/print-shop-server/node_modules/pg-pool/index.js:45:11
at processTicksAndRejections (native:1:1)
railway run bun run dev
$ bun run --watch src/index.ts
Started server http://localhost:3000
40 | res = resolve
41 | rej = reject
42 | }).catch((err) => {
43 | // replace the stack trace that leads to `TCP.onStreamRead` with one that leads back to the
44 | // application that created the query
45 | Error.captureStackTrace(err)
^
ECONNREFUSED: Failed to connect
errno: 8
syscall: "connect"

at /Users/artivilla/Documents/figma-extensions/print-shop-server/node_modules/pg-pool/index.js:45:11
at processTicksAndRejections (native:1:1)
im 'not sure how to make my server service connect to the db service. if the server is running locally i can still make it point to the same public postgres db yeah?
Solution
Brody
Brody4mo ago
you would indeed need to use the public database URL when developing locally
Arti Villa
Arti VillaOP4mo ago
so my guess is you have to create a .env file and set to DATABASE_URL manually to DATABASE_PUBLIC_URL. you can't do railway run here
Brody
Brody4mo ago
correct
Arti Villa
Arti VillaOP4mo ago
ty! getting a hang of this thing. already getting my friends on it.
Brody
Brody4mo ago
love to hear that!
Want results from more Discord servers?
Add your server