← How We Work

Postgres-Connect for Mac

Setup postgres-connect on a Mac

Prerequisites

Before starting, you will want to ensure a few things are completed:

  1. In Slack, place a ticket here and make a request for artifactory access, peers will be looked up to match access unless otherwise noted.
  2. Launch Privileges to Enable Admin Rights. You should leave this on during the entire process.
  3. Open a Terminal Window.

Add SSH Key to GitHub

  1. In your Terminal window, run the following command (replace your_email@example.com with your GitHub email address): ssh-keygen -t ed25519 -C your_email@example.com
  2. Press enter when prompted for passphrase and file location
  3. When back at terminal prompt, run command open -a TextEdit .ssh/id_ed25519.pub
  4. 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
  5. Select “Configure SSO” next to your new key and Authenticate.

Set Up Homebrew

  1. Install Homebrew by running following command in Terminal: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Run the following command: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zprofile
  3. Restart Terminal
  4. Run following command to force SSH Authentication: git config --global url.ssh://git@github.com/.insteadOf https://github.com/
  5. Run the following command: brew tap banno/tap

Set Up Artifactory

  1. Log into Artifactory.
  2. Go to Edit Profile.
  3. “generate an identity token”. Give it any name/description you want. Copy the token.
  4. Return to terminal, run the following command replacing with copied key: echo "export HOMEBREW_BANNO_ARTIFACTORY_TOKEN='<TOKEN>'" >> ~/.zshrc
  5. Restart Terminal when finished

Install Postgres-Connect

1.Run command to install postgres-connect and dBeaver: brew install banno/tap/postgres-connect dbeaver-community

  1. Run command to receive URL: postgres-connect configure
  2. The terminal command will provide a URL and request a code. Copy the URL and paste into a browser window.
  3. You will be asked to authenticate. When authentication is completed, you will be taken to an error page.
  4. 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

  1. Run dBeaver from Launchpad.
  2. In dBeaver Menu Bar at the top of the screen, select Database > New Database Connection.
  3. 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.
  4. 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:

  1. Run brew upgrade banno-ca. If you get Error: banno/tap/banno-ca not installed, run brew install banno-ca and enter your laptop admin password when prompted.
  2. 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"

  1. Create a new text file in your Home Directory named “.postgres-connect.json”
  2. In the file, create a blank JSON object {} and save.
  3. Try running the config again.

Setup postgres-connect on Windows or Linux

Yes, it is possible. See this link for the details.