Skip to content

Instantly share code, notes, and snippets.

@seanh
Last active October 2, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanh/f2a37f253730a016b526 to your computer and use it in GitHub Desktop.
Save seanh/f2a37f253730a016b526 to your computer and use it in GitHub Desktop.
How to setup your local dev instance of h with a Dockerised PostgreSQL

One-time startup:

docker run -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=pass postgres
echo 'localhost:5432:postgres:postgres:pass' >> ~/.pgpass
chmod go-rwx ~/.pgpass
pip install psycopg2

After this you just have to run docker start postgres to start it (e.g. after rebooting your laptop).

The SQLAlchemy URL in conf/development.ini should be:

sqlalchemy.url: postgresql://postgres:pass@localhost/postgres

To connect to the PostgreSQL database with psql:

sudo apt-get install postgresql-client
psql -h localhost -d postgres -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment