Mercurial > gemma
diff docker/README.md @ 524:156a805941b5
Move docker stuff from schema to dedicated docker directory
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 27 Aug 2018 17:24:08 +0200 |
parents | schema/README@68fd656c3d55 |
children | 8f075ae6cf33 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docker/README.md Mon Aug 27 17:24:08 2018 +0200 @@ -0,0 +1,40 @@ +# Setup dev environment using Docker + +Run the `build` commands from the root of your checkout, because it is +assumed as the context! + +Other example commands, too, assume they are run from the root of your +checkout. + +## Database setup + +- Build Dockerfile with e.g.: + ``` + docker build -t gemma_db -f docker/Dockerfile.db . + ``` + +- Get a running instance with e.g.: + ``` + docker run --name gemma_db -d -p 54321:5432 -v $PWD/schema:/opt/gemma \ + gemma_db + ``` + +- Run tests for RLS policies: + ``` + docker exec gemma_db ./run_tests.sh + ``` + +## Create ER diagrams + +Assuming you have installed postgresql_autodoc and graphviz on a machine +from wich you can reach your docker host, you can use the following: + +- ER diagram with waterway related tables: + ``` + postgresql_autodoc -p 54321 -h $dockerhost \ + -d gemma -U sophie --password=so2Phie4 -t dot -l . -s 'waterway' + dot -Tpdf gemma.dot > gemma_waterway.pdf + ``` + +Omit the `-s` option to get a diagram with all tables or use any other +schema name to see other parts of the whole picture.