view docker/README.md @ 997:26ca04caa330

fix: Setting selected Bottleneck null caused Nullpointer Exception. The computed property "selected Bottleneck" returns null, when no Bottleneck was found. Clicking on the map triggers as of now an "identify" operation. If no bottleneck is selected, the result of the property is null. In turn is referencing selectedBottleneck in templates screwed. For now: the text is only changed, when a new Bottleneck is selected.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 22 Oct 2018 14:53:20 +0200
parents 86725b39b2d2
children ce24990b3d5c
line wrap: on
line source

# 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.

## Network setup

- Create a network to connect containers:
  ```
  docker network create gemma
  ```

## 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 \
          --network gemma gemma_db
  ```
  Use `--network-alias gemma_db` if your container has a different name

- 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.

## GeoServer setup

- Build Dockerfile with e.g.:
  ```
  docker build -t gemma_geoserver -f docker/Dockerfile.geoserv .
  ```

- Get a running instance with e.g.:
  ```
  docker run --name gemma_geoserver -d -p 8280:8080 --network gemma \
         gemma_geoserver
  ```
  Use `--network-alias gemma_geoserver` if you give your container
  a different name.

## Gemma backend setup

- Build Dockerfile with e.g.:
  ```
  docker build -t gemma_backend -f docker/Dockerfile.backend .
  ```

- Get a running instance with e.g.:
  ```
  docker run --name gemma_backend -v $PWD:/opt/gemma -d -p 8200:8000 \
             --network gemma gemma_backend
  ```
  Use `--network-alias gemma_backend` if you give your container
  a different name.

## SPA setup

- Build Dockerfile with e.g.:
  ```
  docker build -t gemma_spa -f docker/Dockerfile.spa .
  ```

- Get a running instance with e.g.:
  ```
  docker run --name gemma_spa -v $PWD/client:/opt/gemma_spa -d -p 8290:8080 \
             --network gemma gemma_spa
  ```

Now you should be able to use the application in your browser by going to
`http://HOST:8290`, with HOST being the hostname of your docker host.