Mercurial > gemma
annotate docker/README.md @ 1741:44398a8bdf94
Approved gauge measurements: Added a stub to upload a CSV file for parsing.
TODO: Implement the parsing and store the values in the DB.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 09 Jan 2019 18:26:52 +0100 |
parents | ce24990b3d5c |
children | a7e47a9d890b |
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 |
712
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
9 ## Network setup |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
10 |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
11 - Create a network to connect containers: |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
12 ``` |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
13 docker network create gemma |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
14 ``` |
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
15 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
16 ## Database setup |
36 | 17 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
18 - Build Dockerfile with e.g.: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
19 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
20 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
|
21 ``` |
101 | 22 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
23 - 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
|
24 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
25 docker run --name gemma_db -d -p 54321:5432 -v $PWD/schema:/opt/gemma \ |
712
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
26 --network gemma gemma_db |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
27 ``` |
712
86725b39b2d2
Improve reproducability of documented docker commands
Tom Gottfried <tom@intevation.de>
parents:
596
diff
changeset
|
28 Use `--network-alias gemma_db` if your container has a different name |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
29 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
30 - Run tests for RLS policies: |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
31 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
32 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
|
33 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
34 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
35 ## Create ER diagrams |
83 | 36 |
1356
ce24990b3d5c
add licensing hint to docker files
Bernhard Reiter <bernhard@intevation.de>
parents:
712
diff
changeset
|
37 Assuming you have installed `postgresql_autodoc` and `graphviz` on a machine |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
38 from wich you can reach your docker host, you can use the following: |
83 | 39 |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
40 - 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
|
41 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
42 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
|
43 -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
|
44 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
|
45 ``` |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
46 |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
174
diff
changeset
|
47 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
|
48 schema name to see other parts of the whole picture. |
561
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
49 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
50 ## GeoServer setup |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
51 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
52 - Build Dockerfile with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
53 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
54 docker build -t gemma_geoserver -f docker/Dockerfile.geoserv . |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
55 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
56 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
57 - Get a running instance with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
58 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
59 docker run --name gemma_geoserver -d -p 8280:8080 --network gemma \ |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
60 gemma_geoserver |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
61 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
62 Use `--network-alias gemma_geoserver` if you give your container |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
63 a different name. |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
64 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
65 ## Gemma backend setup |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
66 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
67 - Build Dockerfile with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
68 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
69 docker build -t gemma_backend -f docker/Dockerfile.backend . |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
70 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
71 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
72 - Get a running instance with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
73 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
74 docker run --name gemma_backend -v $PWD:/opt/gemma -d -p 8200:8000 \ |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
75 --network gemma gemma_backend |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
76 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
77 Use `--network-alias gemma_backend` if you give your container |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
78 a different name. |
596
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
79 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
80 ## SPA setup |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
81 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
82 - Build Dockerfile with e.g.: |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
83 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
84 docker build -t gemma_spa -f docker/Dockerfile.spa . |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
85 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
86 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
87 - Get a running instance with e.g.: |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
88 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
89 docker run --name gemma_spa -v $PWD/client:/opt/gemma_spa -d -p 8290:8080 \ |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
90 --network gemma gemma_spa |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
91 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
92 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
93 Now you should be able to use the application in your browser by going to |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
94 `http://HOST:8290`, with HOST being the hostname of your docker host. |