From 8af31ac7e9859789d9ae5645a65dee6a298ad56d Mon Sep 17 00:00:00 2001 From: Reza Shokri Date: Mon, 8 Jul 2019 17:31:04 +0200 Subject: [PATCH] DONE: deployment --- docker-compose.staging.yml | 168 +++++++++++++++++++++++++++++++++++++ s_backend/s_b_core | 2 +- 2 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 docker-compose.staging.yml diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml new file mode 100644 index 0000000..8078e59 --- /dev/null +++ b/docker-compose.staging.yml @@ -0,0 +1,168 @@ +version: "3.7" + +services: + + docker-socket-proxy-ro: + image: tecnativa/docker-socket-proxy + networks: + - private-docker-socks-proxy-ro + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - EVENTS=1 + - PING=1 + - VERSION=1 + - CONTAINERS=1 + - INFO=1 + - POST=0 + - BUILD=0 + - COMMIT=0 + - CONFIGS=0 + - DISTRIBUTION=0 + - EXEC=0 + - IMAGES=0 + - NETWORKS=0 + - NODES=0 + - PLUGINS=0 + - SERVICES=0 + - SESSION=0 + - SWARM=0 + - SYSTEM=0 + - TASKS=0 + - VOLUMES=0 + - AUTH=0 + - SECRETS=0 + + docker-socket-proxy-rw: + image: tecnativa/docker-socket-proxy + networks: + - private-docker-socks-proxy-rw + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - EVENTS=1 + - PING=1 + - VERSION=1 + - CONTAINERS=1 + - INFO=1 + - POST=1 #TODO: Due tue the letsencrypt container, we have to set write permissions (reloading the nginx settings). On the long run, we need another solution likehttps://github.com/adferrand/docker-letsencrypt-dns. Or kubernetes! + - BUILD=0 + - COMMIT=0 + - CONFIGS=0 + - DISTRIBUTION=0 + - EXEC=1 + - IMAGES=0 + - NETWORKS=0 + - NODES=0 + - PLUGINS=0 + - SERVICES=0 + - SESSION=0 + - SWARM=0 + - SYSTEM=0 + - TASKS=0 + - VOLUMES=0 + - AUTH=0 + - SECRETS=0 + + nginx-proxy: + deploy: + replicas: 1 + image: jwilder/nginx-proxy:alpine + environment: + - DOCKER_HOST=tcp://docker-socket-proxy-ro:2375 + - DHPARAM_GENERATION=false #We have to set this recording to: https://github.com/jwilder/nginx-proxy. + volumes: + - nginx-certs:/etc/nginx/certs #read only? + - nginx-vhosts:/etc/nginx/vhost.d + - nginx-html:/usr/share/nginx/html + ports: + - "80:80" + - "443:443" + networks: + - private-docker-socks-proxy-ro + - web + labels: + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen." + depends_on: + - docker-socket-proxy-ro + + #TODO: Due to the capabilities of ACME v2(wildcard support), we should consider switching to: https://github.com/adferrand/docker-letsencrypt-dns + #However, only certain DNS server provider are supported at this moment. + letsencrypt: + deploy: + replicas: 1 + image: jrcs/letsencrypt-nginx-proxy-companion + environment: + - DOCKER_HOST=tcp://docker-socket-proxy-rw:2375 + volumes: + - nginx-certs:/etc/nginx/certs + - nginx-vhosts:/etc/nginx/vhost.d + - nginx-html:/usr/share/nginx/html + networks: + - private-docker-socks-proxy-rw + depends_on: + - nginx-proxy + - docker-socket-proxy-rw + + database: + deploy: + replicas: 1 + image: mongo + volumes: + - database:/data/db + networks: + - database + # environment: + # MONGO_INITDB_ROOT_USERNAME: root + # MONGO_INITDB_ROOT_PASSWORD: changeme + + backend_core: + deploy: + replicas: 1 + image: registry.gitlab.com/wavect/backend/backend_core:latest + restart: unless-stopped + networks: + - web + - database + build: + dockerfile: ./Dockerfile + context: ./s_backend/s_b_core/ + depends_on: + - database + environment: + VIRTUAL_HOST: api.${AC_HOSTNAME:-dev.wavect.io} + LETSENCRYPT_HOST: api.${AC_HOSTNAME:-dev.wavect.io} + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-kevin.riedl.privat@gmail.com} + DATABASE_NAME: wavect + DATABASE_URI: mongodb://database:27017 + + coming-soon-page: + deploy: + replicas: 1 + image: registry.gitlab.com/wavect/coming-soon-page/coming-soon-page:latest + restart: unless-stopped + networks: + - web + build: + dockerfile: ./Dockerfile + context: ./s_frontend/s_web/s_f_comingsoon + environment: + VIRTUAL_HOST: wavect.io,www.wavect.io + LETSENCRYPT_HOST: wavect.io,www.wavect.io + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-kevin.riedl.privat@gmail.com} + + +networks: + private-docker-socks-proxy-ro: + private-docker-socks-proxy-rw: + web: + database: + +volumes: + database: + nginx-certs: + nginx-vhosts: + nginx-html: + + diff --git a/s_backend/s_b_core b/s_backend/s_b_core index 776764f..0bfcb79 160000 --- a/s_backend/s_b_core +++ b/s_backend/s_b_core @@ -1 +1 @@ -Subproject commit 776764fa1b8b134cab4b91e430a1c61cc4790408 +Subproject commit 0bfcb792f2069507b2d67fc755413e1a85d89a82