Mercurial > gemma
comparison docker/README.md @ 2142:70471052f6b0
docker/README.md: Formatting, typos and concretizations.
author | Bjoern Schilberg <bjoern@intevation.de> |
---|---|
date | Thu, 07 Feb 2019 13:45:43 +0100 |
parents | a7e47a9d890b |
children | b6b699385302 |
comparison
equal
deleted
inserted
replaced
2141:3f58809d2beb | 2142:70471052f6b0 |
---|---|
1 # Setup dev environment using Docker | 1 # Setup dev environment using Docker |
2 | |
3 - [Setup dev environment using Docker](#setup-dev-environment-using-docker) | |
4 - [Network setup](#network-setup) | |
5 - [Database setup](#database-setup) | |
6 - [Create ER diagrams](#create-er-diagrams) | |
7 - [GeoServer setup](#geoserver-setup) | |
8 - [Gemma backend setup](#gemma-backend-setup) | |
9 - [SPA setup](#spa-setup) | |
2 | 10 |
3 Run the `build` commands from the root of your checkout, because it is | 11 Run the `build` commands from the root of your checkout, because it is |
4 assumed as the context! | 12 assumed as the context! |
5 | 13 |
6 Other example commands, too, assume they are run from the root of your | 14 Other example commands, too, assume they are run from the root of your |
7 checkout. | 15 checkout. |
8 | 16 |
9 ## Network setup | 17 ## Network setup |
10 | 18 |
11 - Create a network to connect containers: | 19 Create a network to connect containers: |
12 ``` | 20 |
13 docker network create gemma | 21 ```shell |
14 ``` | 22 docker network create gemma |
23 ``` | |
15 | 24 |
16 ## Database setup | 25 ## Database setup |
17 | 26 |
18 - Build Dockerfile with e.g.: | 27 Build `gemma_db` docker image with e.g.: |
19 ``` | |
20 docker build -t gemma_db -f docker/Dockerfile.db . | |
21 ``` | |
22 | 28 |
23 - Get a running instance with e.g.: | 29 ```shell |
24 ``` | 30 docker build -t gemma_db -f docker/Dockerfile.db . |
25 docker run --name gemma_db -d -p 54321:5432 -v $PWD/schema:/opt/gemma \ | 31 ``` |
26 --network gemma gemma_db | |
27 ``` | |
28 Use `--network-alias gemma_db` if your container has a different name | |
29 | 32 |
30 - Run tests for RLS policies: | 33 Get a running instance with e.g.: |
31 ``` | 34 |
32 docker exec gemma_db ./run_tests.sh | 35 ```shell |
33 ``` | 36 docker run --name gemma_db -d -p 54321:5432 -v $PWD/schema:/opt/gemma \ |
37 --network gemma gemma_db | |
38 ``` | |
39 | |
40 Use `--network-alias gemma_db` if your container has a different name | |
41 | |
42 Run tests for [Row-Level Security](https://www.postgresql.org/docs/11/ddl-rowsecurity.html) (RLS) | |
43 policies: | |
44 | |
45 ```shell | |
46 docker exec gemma_db ./run_tests.sh | |
47 ``` | |
34 | 48 |
35 ## Create ER diagrams | 49 ## Create ER diagrams |
36 | 50 |
37 Assuming you have installed `postgresql_autodoc` and `graphviz` on a machine | 51 Assuming you have installed `postgresql-autodoc` and |
38 from wich you can reach your docker host, you can use the following: | 52 [graphviz](http://graphviz.org/) on a machine from which you can reach your |
53 docker host, you can use the following: | |
39 | 54 |
40 - ER diagram with waterway related tables: | 55 ER diagram with waterway related tables: |
41 ``` | 56 |
42 postgresql_autodoc -p 54321 -h $dockerhost \ | 57 ```shell |
43 -d gemma -U sophie --password=so2Phie4 -t dot -l . -s 'waterway' | 58 postgresql_autodoc -p 54321 -h $dockerhost \ |
44 dot -Tpdf gemma.dot > gemma_waterway.pdf | 59 -d gemma -U sophie --password=so2Phie4 \ |
45 ``` | 60 -t dot -l . -s 'waterway' |
61 dot -Tpdf gemma.dot > gemma_waterway.pdf | |
62 ``` | |
46 | 63 |
47 Omit the `-s` option to get a diagram with all tables or use any other | 64 Omit the `-s` option to get a diagram with all tables or use any other |
48 schema name to see other parts of the whole picture. | 65 schema name to see other parts of the whole picture. |
49 | 66 |
50 ## GeoServer setup | 67 ## GeoServer setup |
51 | 68 |
52 - Build Dockerfile with e.g.: | 69 Build `gemma_geoserver` docker image with e.g.: |
53 ``` | |
54 docker build -t gemma_geoserver -f docker/Dockerfile.geoserv . | |
55 ``` | |
56 | 70 |
57 - Get a running instance with e.g.: | 71 ```shell |
58 ``` | 72 docker build -t gemma_geoserver -f docker/Dockerfile.geoserv . |
59 docker run --name gemma_geoserver -d -p 8280:8080 --network gemma \ | 73 ``` |
60 gemma_geoserver | 74 |
61 ``` | 75 Get a running instance with e.g.: |
62 Use `--network-alias gemma_geoserver` if you give your container | 76 |
63 a different name. | 77 ```shell |
78 docker run --name gemma_geoserver -d -p 8280:8080 --network gemma \ | |
79 gemma_geoserver | |
80 ``` | |
81 | |
82 Use `--network-alias gemma_geoserver` if you give your container | |
83 a different name. | |
64 | 84 |
65 ## Gemma backend setup | 85 ## Gemma backend setup |
66 | 86 |
67 - Build Dockerfile with e.g.: | 87 Build `gemma_backend` docker image with e.g.: |
68 ``` | |
69 docker build -t gemma_backend -f docker/Dockerfile.backend . | |
70 ``` | |
71 | 88 |
72 - Get a running instance with e.g.: | 89 ```shell |
73 ``` | 90 docker build -t gemma_backend -f docker/Dockerfile.backend . |
74 docker run --name gemma_backend -v $PWD:/opt/gemma -d -p 8200:8000 \ | 91 ``` |
75 --network gemma gemma_backend | 92 |
76 ``` | 93 Get a running instance with e.g.: |
77 Use `--network-alias gemma_backend` if you give your container | 94 |
78 a different name. | 95 ```shell |
96 docker run --name gemma_backend -v $PWD:/opt/gemma -d -p 8200:8000 \ | |
97 --network gemma gemma_backend | |
98 ``` | |
99 | |
100 Use `--network-alias gemma_backend` if you give your container | |
101 a different name. | |
79 | 102 |
80 ## SPA setup | 103 ## SPA setup |
81 | 104 |
82 - Build Dockerfile with e.g.: | 105 Build `gemma_spa` docker image with e.g.: |
83 ``` | |
84 docker build -t gemma_spa -f docker/Dockerfile.spa . | |
85 ``` | |
86 | 106 |
87 - Get a running instance with e.g.: | 107 ```shell |
88 ``` | 108 docker build -t gemma_spa -f docker/Dockerfile.spa . |
89 docker run --name gemma_spa -v $PWD/client:/opt/gemma/client -d -p 8290:8080 \ | 109 ``` |
90 --network gemma gemma_spa | 110 |
91 ``` | 111 Get a running instance with e.g.: |
112 | |
113 ```shell | |
114 docker run --name gemma_spa -v $PWD/client:/opt/gemma/client -d -p 8290:8080 \ | |
115 --network gemma gemma_spa | |
116 ``` | |
92 | 117 |
93 Now you should be able to use the application in your browser by going to | 118 Now you should be able to use the application in your browser by going to |
94 `http://HOST:8290`, with HOST being the hostname of your docker host. | 119 `http://HOSTNAME:8290`, with `HOSTNAME` being the hostname of your docker host. |