jins
jins
Explore posts from servers
RRailway
Created by jins on 7/4/2024 in #✋|help
App logs showing pgBouncer errors
Possiblly an issue with prisma keeping the connections open too long, will test adding timeouts and prisma.$disconnect() to close connection after queries
5 replies
RRailway
Created by jins on 7/4/2024 in #✋|help
App logs showing pgBouncer errors
Last night I added node-cron to run scheduled prisma queries to clean up the db every 5 minutes. It looks like that may have been the cause for some of those connection and login pgBouncer errors in the screenshot. I had set a custom start command in app settings for bun run start:prod. Since I removed it pgBouncer is just logging stats. Here are the package.json scripts:
"scripts": {
"build": "npm run db:deploy && next build",
"cron": "ts-node --compiler-options '{\"module\":\"CommonJS\",\"verbatimModuleSyntax\":false}' src/cron/index.ts",
"dev": "prisma generate && next dev -p 2000",
"start": "next start",
"start:dev": "concurrently \"bun run dev\" \"bun run cron\"",
"start:prod": "concurrently \"bun run start\" \"bun run cron\""
},
"scripts": {
"build": "npm run db:deploy && next build",
"cron": "ts-node --compiler-options '{\"module\":\"CommonJS\",\"verbatimModuleSyntax\":false}' src/cron/index.ts",
"dev": "prisma generate && next dev -p 2000",
"start": "next start",
"start:dev": "concurrently \"bun run dev\" \"bun run cron\"",
"start:prod": "concurrently \"bun run start\" \"bun run cron\""
},
If node-cron was the issue here connecting to prisma, are there any known issues with pgBouncer/prisma/node-cron that would cause those initial log errors?
5 replies
RRailway
Created by jins on 7/4/2024 in #✋|help
App logs showing pgBouncer errors
c0958e3e-4cd8-4f89-9376-7c4003820f57
5 replies
RRailway
Created by jins on 6/28/2024 in #✋|help
Cost of replicas
okay sweet, thanks!
8 replies
RRailway
Created by jins on 6/28/2024 in #✋|help
Cost of replicas
c0958e3e-4cd8-4f89-9376-7c4003820f57
8 replies
RRailway
Created by jins on 6/27/2024 in #✋|help
Connect to public or private DB URL from app?
amazing, that worked. Thanks so much!
12 replies
RRailway
Created by jins on 6/27/2024 in #✋|help
Connect to public or private DB URL from app?
If I change this to DATABASE_URL_DIRECT=${{myapp-db.DATABASE_PRIVATE_URL}} in the variables and deploy I get that error in the build log and it fails But it works with DATABASE_URL_DIRECT=${{myapp-db.DATABASE_URL}}
12 replies
RRailway
Created by jins on 6/27/2024 in #✋|help
Connect to public or private DB URL from app?
okay this is working:
DATABASE_URL=${{PgBouncer.DATABASE_PRIVATE_URL}}?pgbouncer=true
DATABASE_URL_DIRECT=${{myapp-db.DATABASE_URL}}
DATABASE_URL=${{PgBouncer.DATABASE_PRIVATE_URL}}?pgbouncer=true
DATABASE_URL_DIRECT=${{myapp-db.DATABASE_URL}}
I'm using prisma and their pgbouncer docs say to set the pgBouncer URL then connect direct to postgres as directUrl for Prisma Migrate https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer#prisma-migrate-and-pgbouncer-workaround If I try to use the private Url for postgres for Direct I get an error but I think it should be fine connecting to public?
Datasource "db": PostgreSQL database "railway", schema "public" at "dbname.railway.internal:5432"

Error: P1001: Can't reach database server at `dbname.railway.internal:5432`

Please make sure your database server is running at `dbname.railway.internal:5432`.
Datasource "db": PostgreSQL database "railway", schema "public" at "dbname.railway.internal:5432"

Error: P1001: Can't reach database server at `dbname.railway.internal:5432`

Please make sure your database server is running at `dbname.railway.internal:5432`.
12 replies
RRailway
Created by jins on 6/27/2024 in #✋|help
Connect to public or private DB URL from app?
c0958e3e-4cd8-4f89-9376-7c4003820f57
12 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
Success! Thank you
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
SHould I rename the db and redeploy?
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
I noticed my DB name is not Postgres
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
It provisioned the template in my project but these variables are empty strings so it crashes:
PGBOUNCER_DATABASE
POSTGRESQL_DATABASE
POSTGRESQL_HOST
POSTGRESQL_PASSWORD
POSTGRESQL_USERNAME
PGBOUNCER_DATABASE
POSTGRESQL_DATABASE
POSTGRESQL_HOST
POSTGRESQL_PASSWORD
POSTGRESQL_USERNAME
I assume I take the POSTGRESQL variables from my database but then what do I use for PGBOUNCER_DATABASE?
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
ok got it thanks!
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
It looks like this deploys pgBouncer to a new project. Is this correct or should it be deployed to the project I need it for?
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
Would I then use the same connection string and append ?pgbouncer=true ?
19 replies
RRailway
Created by jins on 6/13/2024 in #✋|help
How to add pgBouncer to existing Postgres database
c0958e3e-4cd8-4f89-9376-7c4003820f57
19 replies
RRailway
Created by jins on 2/20/2024 in #✋|help
RAILWAY_PUBLIC_DOMAIN when custom domain is set
awesome, thank you
6 replies
RRailway
Created by jins on 12/19/2023 in #✋|help
Can I specify the bun version to use?
Solid, thank you!
17 replies
RRailway
Created by jins on 12/19/2023 in #✋|help
Can I specify the bun version to use?
c0958e3e-4cd8-4f89-9376-7c4003820f57
17 replies