generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Connecting to TEST Postgres DB locally with DBeaver
Ricardo Campos edited this page Nov 24, 2023
·
3 revisions
These steps provide you with simple guide on how you can connect to the running Postgres database instance on the TEST OpenShift namespace through port forwarding.
- oc (OpenShift Command Line Interface. Instructions here)
- VPN (Cisco AnyConnect is a usual choice. Instructions for Gov. folks here and Linux users here)
- Database tool like DBeaver or SquirrelSQL
- Start the VPN connection
- Authenticate your
oc
on the TEST namespace
- Go to the OpenShift Console. For SPAR TEST: https://console.apps.silver.devops.gov.bc.ca/project-details/ns/b9d53b-test/
- Once there, head to the top right corner, click your username, and then click "Copy login command"
- Open up a terminal on your computer and paste the command you copied.
- Now you're logged in!
- Set the test project locally
- Run the command:
oc project b9d53b-test
- Note that
b9d53b-test
is the SPAR TEST namespace code
- Find the running database pod (container)
- Run the command:
oc get pods | grep nr-spar-test-database | grep Running
- Where
nr-spar-test-database
is the database container name - You should see an output similar to nr-spar-test-database-36-4qgbl
- Start the Port Forwarding
- Run the command:
oc port-forward nr-spar-test-database-36-4qgbl 15432:5432
- Where
nr-spar-backend-test-database-36-4qgbl
is the container name and15432:5432
is the port mapping. We'll be mapping the port 15432 locally to the container port 5432. (If you like, you can map to5432:5432
).
- Open up your Database tool, let's say DBeaver, and create a new connection
- Hostname:
localhost
- Port:
15432
- Database name (schema):
nr-spar
- Database username:
nr-spar
- Database password: auto-generated. You'll need to grab it every time you need it. See the next step.
- You can extract the database secret with
oc extract secret/nr-spar-test-database -n b9d53b-test --to=-
, a sample output will be like this (note that there are three secrets and its values right below):
# database-name
nr-spar
# database-password
123456789abcdefgh
# database-user
nr-spar
- Hit "Test connection". It should succeed.
- Hit Save.
- That's it.
- If you're a Linux users, is likely that Cisco AnyConnect will give you extra work with BC Gov 2FA. Please take a look here on how to get it working: SPAR GitHub Wiki - VPN-Certificate-for-Oracle-on-Linux
Welcome to Evergreen Team Wiki page.
- Problem Statement and Goals
- Architecture
- Pull Request Guideline
- Cypress testing Documentation
- Sysdig integration