Mercurial > gemma
annotate 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 |
rev | line source |
---|---|
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
1 # Setup dev environment using Docker |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
2 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
3 Run the `build` commands from the root of your checkout, because it is |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
4 assumed as the context! |
36 | 5 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
6 Other example commands, too, assume they are run from the root of your |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
7 checkout. |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
8 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
9 ## Database setup |
36 | 10 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
11 - Build Dockerfile with e.g.: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
12 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
13 docker build -t gemma_db -f docker/Dockerfile.db . |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
14 ``` |
101 | 15 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
16 - Get a running instance with e.g.: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
17 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
18 docker run --name gemma_db -d -p 54321:5432 -v $PWD/schema:/opt/gemma \ |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
19 gemma_db |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
20 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
21 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
22 - Run tests for RLS policies: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
23 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
24 docker exec gemma_db ./run_tests.sh |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
25 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
26 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
27 ## Create ER diagrams |
83 | 28 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
29 Assuming you have installed postgresql_autodoc and graphviz on a machine |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
30 from wich you can reach your docker host, you can use the following: |
83 | 31 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
32 - ER diagram with waterway related tables: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
33 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
34 postgresql_autodoc -p 54321 -h $dockerhost \ |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
35 -d gemma -U sophie --password=so2Phie4 -t dot -l . -s 'waterway' |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
36 dot -Tpdf gemma.dot > gemma_waterway.pdf |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
37 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
38 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
39 Omit the `-s` option to get a diagram with all tables or use any other |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
40 schema name to see other parts of the whole picture. |