Skip to content

Instantly share code, notes, and snippets.

@ryardley
Last active April 16, 2020 06:18
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 ryardley/d785201ee1c61b2526a9115b947fcf2b to your computer and use it in GitHub Desktop.
Save ryardley/d785201ee1c61b2526a9115b947fcf2b to your computer and use it in GitHub Desktop.

Setup postgresql for a local blitz site on a mac with docker

  1. Install docker

https://docs.docker.com/get-docker/

  1. Install psql
# https://www.compose.com/articles/postgresql-tips-installing-the-postgresql-client/
brew install libpq  
brew link --force libpq
  1. Run postrgres db in a docker container
# use docker to run a postgres db in a docker container
docker run --name postgres-blitz \
  -e POSTGRES_USER=blitz \
  -e POSTGRES_DB=blitz \
  -e POSTGRES_PASSWORD=blitz \
  -p 5432:5432 \
  -d postgres
  1. Check the connection
# check the connection
psql postgresql://blitz:blitz@localhost:5432/blitz
psql (12.2)
Type "help" for help.

blitz=#\l

                             List of databases
   Name    | Owner | Encoding |  Collate   |   Ctype    | Access privileges 
-----------+-------+----------+------------+------------+-------------------
 blitz     | blitz | UTF8     | en_US.utf8 | en_US.utf8 | 
 postgres  | blitz | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | blitz | UTF8     | en_US.utf8 | en_US.utf8 | =c/blitz         +
           |       |          |            |            | blitz=CTc/blitz
 template1 | blitz | UTF8     | en_US.utf8 | en_US.utf8 | =c/blitz         +
           |       |          |            |            | blitz=CTc/blitz
(4 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment