Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export postgresql db doesnt work #12

Open
1 task
rahearn opened this issue Mar 6, 2023 · 4 comments
Open
1 task

export postgresql db doesnt work #12

rahearn opened this issue Mar 6, 2023 · 4 comments

Comments

@rahearn
Copy link

rahearn commented Mar 6, 2023

When running an export using cg-manage-rds export -o "-F c" -f ./backup.pg SERVICE_NAME I'm consistently getting the following error:

Retrieving Service Key...
Processing.... Command Failed!
Error: 

Notes

  • cf --version is cf version 7.6.0+d1110f2.2023-02-27
  • installed cg-manage-rds today (3/6/2023) via homebrew

Acceptance Criteria

  • Determine next steps and acceptance criteria
@rbogle
Copy link
Contributor

rbogle commented Mar 6, 2023

I can't replicate it. I was able to import a test db and export with your options.
Couple of things to try:

  • is the key being created already exist? its named key by default but you can pass another name with the -k option
  • can you update cg-manage-rds to the newest version v0.2.4.
    you may have to force the tap to update itself brew update or by doing:
    cd $(brew --repo cloud-gov/cloudgov); brew update if you still dont get the latest.

@rahearn
Copy link
Author

rahearn commented Mar 7, 2023

Still having this issue today with cg-manage-rds v0.2.5

Before running this, I deleted all service keys from the database, so it's not an issue of the key already existing.

└─> cg-manage-rds export -o "-F c" -f ./backup.pg notify-api-rds-staging
Exporting notify-api-rds-staging to file: ./backup.pg
Checking for CF version
Processing.... /
cf version 7 found!
Retrieving Service Info...
Processing.... Checking Prerequisites for pgsql
Checking for locally installed postgres utilities
Processing.... |
psql found!
Processing.... /
pg_dump found!
Processing.... -
pg_restore found!
Prerequisites present

Configuring CF space for SSH to Service
Retrieving Service Info...
Processing.... Pushing App to space
Processing.... Command Succeeded!
App Running

Enabling SSH on App
Processing.... Command Succeeded!
SSH enabled

Creating Service Key...
Processing.... Command Succeeded!
Service Key Created

Retrieving Service Key...
Processing.... Command Failed!
Error: 

@rahearn
Copy link
Author

rahearn commented Mar 7, 2023

I was able to get past that point by being on the VPN, which makes me think that maybe the blank error on retrieving the service key is a timeout issue? But, being on the VPN it looks like the local port access is blocked 😭

└─> cg-manage-rds export -o "-F c" -f ./backup.pg notify-api-rds-staging
Exporting notify-api-rds-staging to file: ./backup.pg
Checking for CF version
Processing.... -
cf version 7 found!
Retrieving Service Info...
Processing.... Checking Prerequisites for pgsql
Checking for locally installed postgres utilities
Processing.... -
psql found!
Processing.... |
pg_dump found!
Processing.... \
pg_restore found!
Prerequisites present

Configuring CF space for SSH to Service
Retrieving Service Info...
Processing.... Pushing App to space
Processing.... Command Succeeded!
App Running

Enabling SSH on App
Processing.... Command Succeeded!
SSH enabled

Creating Service Key...
Processing.... Command Succeeded!
Service Key Created

Retrieving Service Key...
Processing.... Command Succeeded!
Service Key Created.

Starting SSH Tunnel via App
Processing... Command Succeeded!
SSH Tunnel Running with PID 90310

Config complete

Performing export
Exporting Postgres DB: notify-api-rds-staging
Exporting up with:
        pg_dump -d postgres://u1q1r447bi26p0sw:REDACTED@localhost:65432/cgawsbrokerprodwa8p8h9yapocnww -f ./backup.pg -F c -O -c --if-exists
Processing.... Command Failed!
Error: pg_dump: error: connection to server at "localhost" (::1), port 65432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 65432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

@rbogle
Copy link
Contributor

rbogle commented Mar 7, 2023

I see this fail sometimes ( inconsistently ) on my side too. Usually the tunnel is still running and I can C&P the command output to run it. I suspect that the tunnel isn't fully stable by the time the import/export command runs.

Not sure why VPN would make a difference for your key. I can run it successfully with or without vpn. So perhaps it is also a timeout issue.

ill look at putting in some polling checks to wait for the key and tunnel to be ready before moving on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants