Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting up a Postgres Docker container to run with Barbican
  1. Execute
sudo docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=CHANGEME -d postgres
  1. Execute psql -h localhost -U postgres

  2. Within the psql shell execute the following lines

CREATE USER barbican WITH PASSWORD 'ALLTHEPASS';
CREATE DATABASE barbican_api;
GRANT ALL PRIVILEGES ON DATABASE barbican_api to barbican;
\q
  1. Change DB value in /etc/barbican/barbican_api.conf:
sql_connection = postgresql+psycopg2://barbican:ALLTHEPASS@localhost:5432/barbican_api
  1. Run in another terminal sudo docker exec -it postgres /bin/bash

  2. Within the docker container, execute

printf "\nhost all all 0.0.0.0/0 trust" >> /var/lib/postgresql/data/pg_hba.conf
  1. Restart docker container sudo docker restart postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.