diff --git a/ops/docker-compose/nomad-oasis/gunicorn.conf b/gunicorn.conf similarity index 100% rename from ops/docker-compose/nomad-oasis/gunicorn.conf rename to gunicorn.conf diff --git a/ops/docker-compose/nomad-oasis/README.md b/ops/docker-compose/nomad-oasis/README.md index bbc1396444f09cf385961f0824b53997a3562f85..eecb3579c04be18190c5e02a3c4f6e9c695f70f9 100644 --- a/ops/docker-compose/nomad-oasis/README.md +++ b/ops/docker-compose/nomad-oasis/README.md @@ -86,6 +86,8 @@ services: restart: always image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 container_name: nomad_oasis_elastic + environment: + - discovery.type=single-node volumes: - nomad_oasis_elastic:/usr/share/elasticsearch/data @@ -133,8 +135,6 @@ services: volumes: - ./nomad.yaml:/app/nomad.yaml - ./env.js:/app/gui/build/env.js - - ./gunicorn.log.conf:/app/gunicorn.log.conf - - ./gunicorn.conf:/app/gunicorn.conf - nomad_oasis_files:/app/.volumes/fs command: ["./run.sh", "/nomad-oasis"] @@ -162,7 +162,7 @@ There are no mandatory changes necessary. A few things to notice: - All services use docker volumes for storage. This could be changed to host mounts. -- It mounts three configuration files that need to be provided (see below): `nomad.yaml`, `nginx.conf`, `env.js`, `gunicorn.conf`, `gunicorn.log.conf`. +- It mounts three configuration files that need to be provided (see below): `nomad.yaml`, `nginx.conf`, `env.js`. - The only exposed port is `80`. This could be changed to a desired port if necessary. - The NOMAD images are pulled from our gitlab in Garching, the other services use images from a public registry (*dockerhub*). - All container will be named `nomad_oasis_*`. These names can be used to later reference the container with the `docker` cmd. @@ -289,13 +289,19 @@ A few things to notice: ### gunicorn -Simply create empty `gunicorn.conf` and `gunicorn.log.conf` in the beginning. Gunicorn -is the WSGI-server that runs the nomad app. Consult the [gunicorn documentation](https://docs.gunicorn.org/en/stable/configure.html) -for configuration options. +Gunicorn is the WSGI-server that runs the nomad app. Consult the +[gunicorn documentation](https://docs.gunicorn.org/en/stable/configure.html) for +configuration options. ## Starting and stopping If you prepared the above files, simply use the usual `docker-compose` commands to start everything. + +To make sure you have the latest docker images for everything run this first: +``` +docker-compose pull +``` + In the beginning and for debugging problems, it is recommended to start services separately: ``` docker-compose up -d mongodb elastic rabbitmq diff --git a/ops/docker-compose/nomad-oasis/docker-compose.yml b/ops/docker-compose/nomad-oasis/docker-compose.yml index 56b51d96decfe12d41e7f9781b31b4e89199ba18..62316a72c5193abcf1f5bb3d79bf4faef96afc35 100644 --- a/ops/docker-compose/nomad-oasis/docker-compose.yml +++ b/ops/docker-compose/nomad-oasis/docker-compose.yml @@ -24,6 +24,8 @@ services: restart: always image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 container_name: nomad_oasis_elastic + environment: + - discovery.type=single-node volumes: - nomad_oasis_elastic:/usr/share/elasticsearch/data @@ -42,7 +44,7 @@ services: # nomad worker (processing) worker: restart: always - image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:oasis-migration + image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:stable container_name: nomad_oasis_worker environment: <<: *nomad_backend_env @@ -59,7 +61,7 @@ services: # nomad app (api + gui) app: restart: always - image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:oasis-migration + image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:stable container_name: nomad_oasis_app environment: <<: *nomad_backend_env @@ -71,8 +73,6 @@ services: volumes: - ./nomad.yaml:/app/nomad.yaml - ./env.js:/app/gui/build/env.js - - ./gunicorn.log.conf:/app/gunicorn.log.conf - - ./gunicorn.conf:/app/gunicorn.conf - nomad_oasis_files:/app/.volumes/fs command: ["./run.sh", "/nomad-oasis"] diff --git a/ops/docker-compose/nomad-oasis/gunicorn.log.conf b/ops/docker-compose/nomad-oasis/gunicorn.log.conf deleted file mode 100644 index 00f47379ea08ee00735f7f888d8b13ab4858630e..0000000000000000000000000000000000000000 --- a/ops/docker-compose/nomad-oasis/gunicorn.log.conf +++ /dev/null @@ -1,42 +0,0 @@ -[loggers] -keys=root, gunicorn.error, gunicorn.access - -[handlers] -keys=console, access, error - -[formatters] -keys=generic - -[logger_root] -level=INFO -handlers=console - -[logger_gunicorn.error] -level=INFO -handlers=error -qualname=gunicorn.error - -[logger_gunicorn.access] -level=INFO -handlers=access -qualname=gunicorn.access - -[handler_console] -class=StreamHandler -formatter=generic -args=(sys.stdout, ) - -[handler_access] -class=StreamHandler -formatter=generic -args=(sys.stdout, ) - -[handler_error] -class=StreamHandler -formatter=generic -args=(sys.stdout, ) - -[formatter_generic] -format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s -datefmt=%Y-%m-%d %H:%M:%S -class=logging.Formatter diff --git a/run.sh b/run.sh index d2355df51486f949aa4fdfd84e108b8095afb7c7..ce2668b1a4d40db1659d31075b5ac25389414960 100644 --- a/run.sh +++ b/run.sh @@ -1,4 +1,6 @@ -#!/bin/sh - -find gui/build -type f -exec sed -i "s_/fairdi/nomad/latest/gui_$1/gui_g" {} \; -python -m gunicorn.app.wsgiapp --config gunicorn.conf --log-config gunicorn.log.conf -b 0.0.0.0:8000 nomad.app:app \ No newline at end of file +#!/bin/bash +find gui/build -type f | xargs -L1 bash -c 'sed "s_/fairdi/nomad/latest/gui_$1/gui_g" $2 > /tmp/temp_file; cp /tmp/temp_file $2;' -- $1 +params=() +[ -e gunicorn.conf ] && params+=(--config gunicorn.conf) +[ -e gunicorn.log.conf ] && params+=(--log-config, gunicorn.log.conf) +python -m gunicorn.app.wsgiapp "${params[@]}" -b 0.0.0.0:8000 nomad.app:app \ No newline at end of file