Skip to content

Instantly share code, notes, and snippets.

@jmvrbanac
Last active August 29, 2015 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmvrbanac/5fbbfdc15db9c7c9efd0 to your computer and use it in GitHub Desktop.
Save jmvrbanac/5fbbfdc15db9c7c9efd0 to your computer and use it in GitHub Desktop.
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