Postgres DB "Database Connection" not completing anymore
drmdev
HOBBYOP

a year ago

Last night I was able to access my Postgres DB without problem. I notice my Postgres DB showing "Database Connection" constantly spinning like it never finishes this step. This happened to me a couple days ago too and I deleted and recreated the DB. That also requires setting environment variables across here and Github again so I'd rather not do it again. I tried redeploy and restart but still, the DB is unable to reconnect again.

My project ID: 273a392c-3e4a-4357-ae18-cc2a64a7b4e0

Let me know if you need more details to investigate

Solved

24 Replies

brody
EMPLOYEE

a year ago

I see a few issues -

  1. you had the database public url as a shared variable, should be using a reference variable.

  2. you ran railway up while linked to your database, taking it offline.

  3. you gave your database a service domain, it only should have a TCP proxy.

Fixed all of these for you and your data tab works again.


drmdev
HOBBYOP

a year ago

can you clarify the usage of railway up causing issues? I have as part of my ci/cd for instance:

    - name: Deploy to Railway
      env:
        RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
      run: railway up --ci --service ${{ secrets.RAILWAY_SVC_ID }}

should I not be doing that?


brody
EMPLOYEE

a year ago

im not sure where you ran railway up from be that in CI or locally, but somehow you ran railway up while linked to the database service


drmdev
HOBBYOP

a year ago

I see. I likely ran it locally at one point not thinking it would cause issues. Thanks for your assistance. I can work on it from here.


brody
EMPLOYEE

a year ago

no problem, ill leave this open for now incase you have any more questions


drmdev
HOBBYOP

a year ago

I'm having the same issue again. I'm thinking maybe I need to remove the Railway steps from my CI/CD? I have a Railway service already triggered by changes on my main branch, and just merged a feature branch into main. Maybe that's what's causing excess railway up executions?

- name: Install Railway CLI
  run: |
    npm install -g @railway/cli

- name: Deploy to Railway
  env:
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
  run: railway up --ci --service ${{ secrets.RAILWAY_SVC_ID }}

drmdev
HOBBYOP

a year ago

assuming the Railway service I have associated with my Github deploys also is running railway up


drmdev
HOBBYOP

a year ago

the psql command to connect to the DB is unsuccessful now as well. I don't see a constantly spinning "Database connection" in the Data tab, but "We are unable to connect to the database over the public network.

Can you connect using this command?" (no)

how do I resuscitate the DB from here? And am I correct in that I need to change my CI/CD to not also execute railway up?


brody
EMPLOYEE

a year ago

yep looks like you ran railway up on the database again, you can restore it by redeploying the postgres image from your history.

may i ask why you are using railway up at all?


drmdev
HOBBYOP

a year ago

It was just occurring to me that I don't think I need it at all. At some point I thought I needed it and added it in my ci/cd. That was wrong. I've now removed those steps and letting the Railway Github link take care of the Railway deploy itself.


drmdev
HOBBYOP

a year ago

I am only a Hobby user. In Postgres | Backups I see "Backups are only available for Teams on the Pro plan"


brody
EMPLOYEE

a year ago

yep they are a Pro feature


drmdev
HOBBYOP

a year ago

I clearly am not a Pro. 🙂 Now that I've removed the step from my ci/cd, can you revive it one more time for me? Unless there's another way to restore the image


brody
EMPLOYEE

a year ago

i wasnt using backups to restore it

1321985993410347000


brody
EMPLOYEE

a year ago

i was just redeploying


drmdev
HOBBYOP

a year ago

thanks for clarifying. makes sense. redeployed OK


drmdev
HOBBYOP

a year ago

everything working as expected now. thanks again. I made some dumb mistakes. they've been corrected


brody
EMPLOYEE

a year ago

while i have you, is there any reason you are using the public database url instead of the private?


drmdev
HOBBYOP

a year ago

difficulty trying to test with the private URL


drmdev
HOBBYOP

a year ago

for my local testing


brody
EMPLOYEE

a year ago

use private on railway, use public locally


drmdev
HOBBYOP

a year ago

got it. that makes sense. I'll test that on a branch and then merge that in if all good there too


brody
EMPLOYEE

a year ago

sounds good


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...