Skip to content

Code to set up a local PostgreSQL database at an HGC MAC

Notifications You must be signed in to change notification settings

cmu-hgc-mac/HGC_DB_postgres

Repository files navigation

HGC_DB_postgres

Code to set up a local PostgreSQL database at an HGC MAC

 git clone https://github.com/cmu-hgc-mac/HGC_DB_postgres.git

Getting started

Each MAC requires the following to replicate this setup:

  1. A database computer with a static IP address or host name with postgreSQL-15 with pgAdmin4 installed.
  2. Ensure port in conn.yaml matches with the port for postgreSQL installed on your computer. Update insitution abbreviation. (Change db_hostname only if database is hosted on a different computer.) Verify the CERN database location.
  3. In the long run, it is preferred that the computers at the other stations have static IPs as well for security reasons.
  4. Decide a postgres superuser password (keep safe), a user password (with write access), and a viewer password (with only read permission; doesn't have to be too complicated.)
  5. Install postgreSQL-15 with pgAdmin4 on your computers. Make sure you add psql to your path. Use the postgres superuser password with pgAdmin4.
  6. Follow instructions to update the two config files to listen for the other computers in the lab and make interconnections.
  7. In a Python virtual environment or Conda environment:
pip install -r housekeeping/requirements.txt
  1. Create database and tables with appropriate passwords:
python3 postgres_control_panel.py

Click on the Modify existing tables button to implement the latest updates to the tables.

Postgres Control Panel

  1. Follow instructions to view tables in pgAdmin4 tool on the database computer. The tables are found under hgcdb -> Schemas -> public -> Tables. Right-click on a selected table to view/edit data for the Last 100 Rows.
  2. Follow instructions to view tables in pgAdmin4 tool on the other stations.

Postgres Control Panel

About

Code to set up a local PostgreSQL database at an HGC MAC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages