Mercurial > gemma
annotate docker/README.md @ 676:bd215c4325ce
Cross sections: Only join point in x/y plane.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 19 Sep 2018 16:09:09 +0200 |
parents | 6d7c0dbf9d21 |
children | 86725b39b2d2 |
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. |
561
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
41 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
42 ## Network setup |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
43 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
44 - Create a network to connect containers: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
45 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
46 docker network create gemma |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
47 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
48 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
49 - Connect database to new network |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
50 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
51 docker network connect gemma gemma_db |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
52 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
53 Use `--alias gemma_db` if your container has a different name |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
54 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
55 ## GeoServer setup |
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 - Build Dockerfile 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 build -t gemma_geoserver -f docker/Dockerfile.geoserv . |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
60 ``` |
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 - Get a running instance with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
63 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
64 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
|
65 gemma_geoserver |
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 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
|
68 a different name. |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
69 |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
70 ## Gemma backend setup |
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 - Build Dockerfile 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 build -t gemma_backend -f docker/Dockerfile.backend . |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
75 ``` |
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 - Get a running instance with e.g.: |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
78 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
79 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
|
80 --network gemma gemma_backend |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
81 ``` |
8f075ae6cf33
Improve docker usage and related docs
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
82 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
|
83 a different name. |
596
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
84 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
85 ## SPA setup |
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 - Build Dockerfile 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 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
|
90 ``` |
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 - 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
|
93 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
94 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
|
95 --network gemma gemma_spa |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
96 ``` |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
97 |
6d7c0dbf9d21
Fix running client container with clean checkout in volume
Tom Gottfried <tom@intevation.de>
parents:
561
diff
changeset
|
98 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
|
99 `http://HOST:8290`, with HOST being the hostname of your docker host. |