From 06e73e018eca3d09ed2c425e5f91440ec4e68602 Mon Sep 17 00:00:00 2001 From: mboudet Date: Wed, 28 Aug 2024 13:46:25 +0200 Subject: [PATCH] Update docker-compose.yml --- docker-compose.yml | 221 +++++++++++++++++++++++++-------------------- 1 file changed, 123 insertions(+), 98 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6d6a5c1..f9716a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,42 @@ version: '2' services: + + traefik: + # In production, port 8080 should not be open + image: traefik:1.7 + ports: + - "8080:8080" + - "5000:80" + volumes: + - ${BIOMAJ_DOCKER}/proxy/traefik/traefik.toml:/etc/traefik/traefik.toml + - /var/run/docker.sock:/var/run/docker.sock + + biomaj-internal-proxy: + # In production, ports should not be open + image: traefik:1.7 + ports: + - "8082:8080" + - "8081:80" + volumes: + - ${BIOMAJ_DOCKER}/proxy/traefik/traefik-int.toml:/etc/traefik/traefik.toml + biomaj-mongo: image: mongo:3.2 volumes: - - ${BIOMAJ_DIR}/mongo:/data/db + - ${BIOMAJ_DOCKER}/mongo:/data/db biomaj-redis: image: redis volumes: - - ${BIOMAJ_DIR}/redis:/data + - ${BIOMAJ_DOCKER}/redis:/data biomaj-elasticsearch: image: "elasticsearch:2" command: "elasticsearch -Des.cluster.name='biomaj'" + volumes: + - ${BIOMAJ_DOCKER}/elasticsearch:/usr/share/elasticsearch/data + biomaj-rabbitmq: image: rabbitmq @@ -21,14 +44,14 @@ command: rabbitmq-server entrypoint: "" volumes: - - ${BIOMAJ_DIR}/rabbitmq:/var/lib/rabbitmq - - ${BIOMAJ_DIR}/biomaj-config/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro + - ${BIOMAJ_DOCKER}/rabbitmq:/var/lib/rabbitmq + - ${BIOMAJ_DOCKER}/biomaj-config/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro environment: - RABBITMQ_DEFAULT_USER=biomaj - RABBITMQ_DEFAULT_PASS=biomaj biomaj-consul: - image: hashicorp/consul:1.17 + image: consul hostname: consulnode1 ports: - "8400:8400" @@ -37,157 +60,162 @@ command: agent -dev -client 0.0.0.0 -log-level info biomaj-prometheus: - image: prom/prometheus:v2.45.6 + image: prom/prometheus:v1.8.2 ports: - "9090:9090" volumes: - - ${BIOMAJ_DIR}/biomaj-config/prometheus.yml:/etc/prometheus/prometheus.yml + - ${BIOMAJ_DOCKER}/biomaj-config/prometheus.yml:/etc/prometheus/prometheus.yml depends_on: - biomaj-consul command: - - '--storage.tsdb.retention.time=720h' - - '--config.file=/etc/prometheus/prometheus.yml' + - '-storage.local.retention=720h' + - '-config.file=/etc/prometheus/prometheus.yml' biomaj-influxdb: image: influxdb + ports: + - "8086:8086" volumes: - - ${BIOMAJ_DIR}/influxdb:/var/lib/influxdb + - ${BIOMAJ_DOCKER}/influxdb:/var/lib/influxdb environment: - INFLUXDB_DB=biomaj - INFLUXDB_USER=biomaj - INFLUXDB_PASSWORD=biomaj - biomaj-public-proxy: - # In production, port 8080 should not be open - image: traefik:1.7 - ports: - # - "8080:8080" - - "5000:80" - volumes: - - ${BIOMAJ_DIR}/proxy/traefik/traefik.toml:/etc/traefik/traefik.toml - - /var/run/docker.sock:/var/run/docker.sock - depends_on: - - biomaj-consul + #biomaj-internal-proxy: + # image: osallou/biomaj-proxy + # # To be deleted in production + # ports: + # - "5080:80" + # volumes: + # - ${BIOMAJ_DIR}/proxy/internal:/proxy:ro + # - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj + # depends_on: + # - biomaj-consul - biomaj-internal-proxy: - # In production, ports should not be open - image: traefik:1.7 - #ports: - # - "8082:8080" - # - "8081:80" - volumes: - - ${BIOMAJ_DIR}/proxy/traefik/traefik-int.toml:/etc/traefik/traefik.toml - depends_on: - - biomaj-consul + #biomaj-public-proxy: + # image: osallou/biomaj-proxy + # volumes: + # - ${BIOMAJ_DIR}/proxy/public:/proxy:ro + # - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + # ports: + # - "5000:80" + # depends_on: + # - biomaj-consul biomaj-user-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajuser - - WAIT_HOSTS=biomaj-mongo:27017, biomaj-consul:8500 + - RABBITMQ_USER=biomaj + - RABBITMQ_PASSWORD=biomaj depends_on: - biomaj-mongo - biomaj-consul + - biomaj-rabbitmq - biomaj-redis - command: ["/startup.sh", "gunicorn", "-b", "0.0.0.0:5000", "--log-config", "/etc/biomaj/production.ini biomaj_user.wsgi:app"] + - biomaj-elasticsearch + command: bash -c "sleep 10 ; gunicorn -b 0.0.0.0:5000 --log-config /etc/biomaj/production.ini biomaj_user.wsgi:app" + biomaj-download-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajdownload - - WAIT_HOSTS=biomaj-mongo:27017, biomaj-consul:8500 + - RABBITMQ_USER=biomaj + - RABBITMQ_PASSWORD=biomaj depends_on: - biomaj-mongo - biomaj-consul + - biomaj-rabbitmq - biomaj-redis - command: ["/startup.sh", "gunicorn", "-c", "/etc/biomaj/gunicorn_conf.py", "-b", "0.0.0.0:5000", "--log-config", "/etc/biomaj/production.ini biomaj_download.biomaj_download_web:app"] + - biomaj-elasticsearch + command: bash -c "sleep 10 ; gunicorn -c /etc/biomaj/gunicorn_conf.py -b 0.0.0.0:5000 --log-config /etc/biomaj/production.ini biomaj_download.biomaj_download_web:app" biomaj-download-message: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db + - /groups:/groups:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajdownload - RABBITMQ_USER=biomaj - RABBITMQ_PASSWORD=biomaj - - WAIT_HOSTS=biomaj-rabbitmq:5672, biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-mongo - biomaj-consul - biomaj-rabbitmq - biomaj-redis - command: ["/startup.sh", "biomaj_download_consumer.py"] + - biomaj-elasticsearch + command: bash -c "sleep 10 ; python3 /root/biomaj-download/bin/biomaj_download_consumer.py" biomaj-process-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data - - ${BIOMAJ_DIR}/biomaj/process:/opt/conda/envs + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajprocess - - WAIT_HOSTS=biomaj-mongo:27017, biomaj-consul:8500 + - RABBITMQ_USER=biomaj + - RABBITMQ_PASSWORD=biomaj depends_on: - biomaj-mongo - biomaj-consul + - biomaj-rabbitmq - biomaj-redis - command: ["/startup.sh", "gunicorn", "-c", "/etc/biomaj/gunicorn_conf.py", "-b", "0.0.0.0:5000", "--log-config", "/etc/biomaj/production.ini biomaj_process.biomaj_process_web:app"] + - biomaj-elasticsearch + command: bash -c "sleep 10 ; gunicorn -c /etc/biomaj/gunicorn_conf.py -b 0.0.0.0:5000 --log-config /etc/biomaj/production.ini biomaj_process.biomaj_process_web:app" biomaj-process-message: - image: quay.io/genouest/biomaj - build: - context: . + #image: quay.io/osallou/biomaj + image: osallou/biomaj-process volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data - - ${BIOMAJ_DIR}/biomaj/process:/opt/conda/envs + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db + - /softs/local:/softs/local:ro + - /local:/local:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajprocess - RABBITMQ_USER=biomaj - RABBITMQ_PASSWORD=biomaj + - BIOMAJ_DIR=${BIOMAJ_DATA_DIR} - DOCKER_URL=${DOCKER_URL} - - WAIT_HOSTS=biomaj-rabbitmq:5672, biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-mongo - biomaj-consul - biomaj-rabbitmq - biomaj-redis - biomaj-elasticsearch - command: ["/startup.sh", "biomaj_process_consumer.py"] + command: bash -c "sleep 10 ; python3 /root/biomaj-process/bin/biomaj_process_consumer.py" biomaj-daemon-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajdaemon - RABBITMQ_USER=biomaj - RABBITMQ_PASSWORD=biomaj - - WAIT_HOSTS=biomaj-redis:6379, biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-mongo - biomaj-consul @@ -198,21 +226,20 @@ - biomaj-user-web - biomaj-download-web - biomaj-process-web - command: ["/startup.sh", "gunicorn", "-c", "/etc/biomaj/gunicorn_conf.py", "-b", "0.0.0.0:5000", "--log-config", "/etc/biomaj/production.ini biomaj_daemon.daemon.biomaj_daemon_web:app"] + command: bash -c "sleep 10 ; gunicorn -c /etc/biomaj/gunicorn_conf.py -b 0.0.0.0:5000 --log-config /etc/biomaj/production.ini biomaj_daemon.daemon.biomaj_daemon_web:app" biomaj-daemon-message: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db + - /groups:/groups:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajdaemon - RABBITMQ_USER=biomaj - RABBITMQ_PASSWORD=biomaj - - WAIT_HOSTS=biomaj-redis:6379, biomaj-mongo:27017, biomaj-consul:8500, biomaj-rabbitmq:5672 depends_on: - biomaj-mongo - biomaj-consul @@ -222,40 +249,40 @@ - biomaj-user-web - biomaj-download-web - biomaj-process-web - command: ["/startup.sh", "biomaj_daemon_consumer.py"] + command: bash -c "sleep 10 ; python3 /root/biomaj-daemon/bin/biomaj_daemon_consumer.py" biomaj-watcher-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj + - ${BIOMAJ_DIR}:/db environment: - BIOMAJ_CONFIG=/etc/biomaj/config.yml - - WAIT_HOSTS=biomaj-redis:6379, biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-mongo - biomaj-consul + - biomaj-rabbitmq + - biomaj-redis - biomaj-user-web - biomaj-daemon-web - biomaj-elasticsearch - command: ["/startup.sh", "/root/watcher.sh"] + command: bash -c "sleep 10 ; /root/watcher.sh" biomaj-cron: - image: quay.io/genouest/biomaj-cron + image: osallou/biomaj-cron volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db:ro environment: - BIOMAJ_CONFIG=/etc/biomaj/config.yml depends_on: - biomaj-daemon-web biomaj-ftp: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db:ro environment: - BIOMAJ_USER_PASSWORD=${BIOMAJ_USER_PASSWORD} - BIOMAJ_CONFIG=/etc/biomaj/config.yml @@ -263,7 +290,6 @@ - RABBITMQ_USER=biomaj - RABBITMQ_PASSWORD=biomaj - MASQUERADE_ADDRESS=${MASQUERADE_ADDRESS} - - WAIT_HOSTS=biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-mongo - biomaj-consul @@ -271,28 +297,26 @@ - biomaj-elasticsearch ports: - "2121:21" - command: ["/startup.sh", "biomaj_ftp_service.py"] + command: bash -c "sleep 10 ; python3 /root/biomaj-ftp/bin/biomaj_ftp_service.py" biomaj-release-web: - image: quay.io/genouest/biomaj - build: - context: . + image: quay.io/osallou/biomaj volumes: - - ${BIOMAJ_DIR}/biomaj:/var/lib/biomaj/data + - ${BIOMAJ_DOCKER}/biomaj-config:/etc/biomaj:ro + - ${BIOMAJ_DIR}:/db environment: - BIOMAJ_CONFIG=/etc/biomaj/config.yml - REDIS_PREFIX=biomajrelease - REDIS_DAEMON_PREFIX=biomajdaemon - - WAIT_HOSTS=biomaj-redis:6379, biomaj-mongo:27017, biomaj-consul:8500 depends_on: - biomaj-consul - biomaj-redis - biomaj-daemon-web - biomaj-daemon-message - command: ["/startup.sh", "biomaj_release.py"] + command: bash -c "sleep 10 ; python3 /root/biomaj-release/bin/biomaj_release.py" biomaj-expose: - image: quay.io/genouest/biomaj-expose + image: quay.io/osallou/biomaj-expose labels: - traefik.enable=true - traefik.frontend.rule=PathPrefix:/db @@ -303,6 +327,7 @@ build: context: proxy/nginx volumes: - - ./proxy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro - - ${BIOMAJ_DIR}/biomaj/db:/db:ro + - ${BIOMAJ_DOCKER}/proxy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro + #- ${BIOMAJ_DIR}:/usr/share/nginx/html/db:ro + - ${BIOMAJ_DIR}:/db:ro command: [nginx-debug, '-g', 'daemon off;']