Setup postgres-connect on a Mac
Prerequisites
Before starting, you will want to ensure a few things are completed:
- In Slack, place a ticket here and make a request for artifactory access, peers will be looked up to match access unless otherwise noted.
- Launch Privileges to Enable Admin Rights. You should leave this on during the entire process.
- Open a Terminal Window.
Add SSH Key to GitHub
- In your Terminal window, run the following command (replace
your_email@example.comwith your GitHub email address):ssh-keygen -t ed25519 -C your_email@example.com - Press enter when prompted for passphrase and file location
- When back at terminal prompt, run command
open -a TextEdit .ssh/id_ed25519.pub - Copy text in the TextEdit window. Go to GitHub SSH and GPG Key Settings and select New SSH Key
- Enter “Postgres-Connect” for Key Name
- Paste text copied from TextEdit into key field
- Save and follow prompts. You will be asked to verify 2FA
- Select “Configure SSO” next to your new key and Authenticate.
Set Up Homebrew
- Install Homebrew by running following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Run the following command:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zprofile - Restart Terminal
- Run following command to force SSH Authentication:
git config --global url.ssh://git@github.com/.insteadOf https://github.com/ - Run the following command:
brew tap banno/tap
Set Up Artifactory
- Log into Artifactory.
- Go to Edit Profile.
- “generate an identity token”. Give it any name/description you want. Copy the token.
- Return to terminal, run the following command replacing
with copied key: echo "export HOMEBREW_BANNO_ARTIFACTORY_TOKEN='<TOKEN>'" >> ~/.zshrc - Restart Terminal when finished
Install Postgres-Connect
1.Run command to install postgres-connect and dBeaver:
brew install banno/tap/postgres-connect dbeaver-community
- Run command to receive URL:
postgres-connect configure - The terminal command will provide a URL and request a code. Copy the URL and paste into a browser window.
- You will be asked to authenticate. When authentication is completed, you will be taken to an error page.
- The URL in your browser will now look like
http://localhost/?code=CODEHERE. Copy all text after the “=” and return to the terminal. Paste the code into the prompt to complete postgres-connect configuration.
Launch dBeaver
- Run dBeaver from Launchpad.
- In dBeaver Menu Bar at the top of the screen, select Database > New Database Connection.
- On the New Database screen select PostgreSQL. Press the Test Connection button and follow the prompts to install the PostgreSQL driver. Once this is completed, you may close out of the window and press Cmd+Q to quit dBeaver.
- To launch dBeaver, you will need to use this command. You will need to save this as it will be used each time to connect to the postgres databases.
postgres-connect connect --role implementation --name postgres1 --env production -d public --nopgadmin --show=dbeaver
Troubleshooting
If postgres-connect commands result in certificate signed by unknown authority:
- Run
brew upgrade banno-ca. If you getError: banno/tap/banno-ca not installed, runbrew install banno-caand enter your laptop admin password when prompted. - Run
banno-ca-add.
If postgres-connect config returns FTL error reading config file error="open /Users/USERNAME/.postgres-connect.json: no such file or directory"
- Create a new text file in your Home Directory named “.postgres-connect.json”
- In the file, create a blank JSON object
{}and save. - Try running the config again.
Setup postgres-connect on Windows or Linux
Yes, it is possible. See this link for the details.