Mercurial > gemma
view docker/README.md @ 2581:5466800da970
Fix conditional rendering of file/URL import form elements
Once import via file was chosen for an import type, the file upload
field appeared also for import types that do not support file upload.
Indentation will be fixed in another commit to keep the diff readable
here.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 11 Mar 2019 16:35:07 +0100 |
parents | b6b699385302 |
children | 7ebd4154894e |
line wrap: on
line source
# Build and run your dev environment using Docker - [Build and run your dev environment using Docker](#build-and-run-your-dev-environment-using-docker) - [Build and run your gemma application with Docker Compose in one step](#build-and-run-your-gemma-application-with-docker-compose-in-one-step) - [Hints and tricks](#hints-and-tricks) - [Build and run the gemma application with Docker manually](#build-and-run-the-gemma-application-with-docker-manually) - [Network setup](#network-setup) - [Database setup](#database-setup) - [Create ER diagrams](#create-er-diagrams) - [GeoServer setup](#geoserver-setup) - [Gemma backend setup](#gemma-backend-setup) - [SPA setup](#spa-setup) 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. ## Build and run your gemma application with Docker Compose in one step Requires at least Docker Engine release 17.12.0+. Because of Compose file format 3.5 for named networks. If you fiddle around with the following error message: `Version in "./docker-compose.yml" is unsupported` take a look at the comments in the head of the `docker-compose.yml` file. From your docker directory, start up your gemma application by running `docker-compose up`. Here an example for build and running the gemma application: ```shell cd docker docker-compose -p gemma up ``` Note: The `-p` flag specifies an alternate project name (default: directory name). Now you should be able to use the application in your browser by going to `http://HOSTNAME:8290`, with `HOSTNAME` being the hostname of your docker host. Stop the application, either by running `docker-compose down` from within your docker directory in the second terminal, or by hitting `CTRL+C` in the original terminal where you started the gemma application. ### Hints and tricks If you want to run your services in the background, you can pass the `-d` flag (for `detached` mode) to `docker-compose up` and use `docker-compose ps` to see what is currently running. Take a look at the following example. ```shell docker-compose up -d Starting gemma_db ... Starting gemma_db ... done Starting gemma_geoserver ... Starting gemma_geoserver ... done Starting gemma_backend ... Starting gemma_backend ... done Starting gemma_spa ... Starting gemma_spa ... done ``` ```shell docker-compose ps Name Command State Ports ---------------------------------------------------------------------------------- gemma_backend /usr/local/bin/gemma -c /o ... Up 0.0.0.0:8200->8000/tcp gemma_db /usr/lib/postgresql/11/bin ... Up 0.0.0.0:54321->5432/tcp gemma_geoserver /usr/share/tomcat8/bin/cat ... Up 0.0.0.0:8280->8080/tcp gemma_spa /bin/sh -c make -f Makefil ... Up 0.0.0.0:8290->8080/tcp ``` For more infos about Docker Compose take a look at: https://docs.docker.com/compose/ ## Build and run the gemma application with Docker manually Or build and run your dev enviroment manually by the following steps. ### Network setup Create a network to connect containers: ```shell docker network create gemma ``` ### Database setup Build `gemma_db` docker image with e.g.: ```shell docker build -t gemma_db -f docker/Dockerfile.db . ``` Get a running instance with e.g.: ```shell 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 [Row-Level Security](https://www.postgresql.org/docs/11/ddl-rowsecurity.html) (RLS) policies: ```shell docker exec gemma_db ./run_tests.sh ``` ### Create ER diagrams Assuming you have installed `postgresql-autodoc` and [graphviz](http://graphviz.org/) on a machine from which you can reach your docker host, you can use the following: ER diagram with waterway related tables: ```shell 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 `gemma_geoserver` docker image with e.g.: ```shell docker build -t gemma_geoserver -f docker/Dockerfile.geoserv . ``` Get a running instance with e.g.: ```shell 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 `gemma_backend` docker image with e.g.: ```shell docker build -t gemma_backend -f docker/Dockerfile.backend . ``` Get a running instance with e.g.: ```shell 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 `gemma_spa` docker image with e.g.: ```shell docker build -t gemma_spa -f docker/Dockerfile.spa . ``` Get a running instance with e.g.: ```shell docker run --name gemma_spa -v $PWD/client:/opt/gemma/client -d -p 8290:8080 \ --network gemma gemma_spa ``` Now you should be able to use the application in your browser by going to `http://HOSTNAME:8290`, with `HOSTNAME` being the hostname of your docker host.