From 3c1259889ad6eeabd769417b3d439c7f940056da Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 19 Aug 2022 14:17:17 +0300 Subject: [PATCH] envs --- .deploy/deploy-dev.yaml | 310 ++++++++++++++++++ .../{prod/deploy.yaml => deploy-prod.yaml} | 0 .deploy/dev/.env | 11 - .deploy/dev/deploy.yaml | 214 ------------ .deploy/prod/.env | 11 - .gitlab-ci.yml | 4 +- 6 files changed, 312 insertions(+), 238 deletions(-) create mode 100644 .deploy/deploy-dev.yaml rename .deploy/{prod/deploy.yaml => deploy-prod.yaml} (100%) delete mode 100644 .deploy/dev/.env delete mode 100644 .deploy/dev/deploy.yaml delete mode 100644 .deploy/prod/.env diff --git a/.deploy/deploy-dev.yaml b/.deploy/deploy-dev.yaml new file mode 100644 index 0000000..0ec3dc8 --- /dev/null +++ b/.deploy/deploy-dev.yaml @@ -0,0 +1,310 @@ +version: "3.4" + + +services: + + nginx: + image: mathwave/sprint-repo:sprint-nginx + volumes: + - /sprint-data/static:/var/www/html/static + networks: + - net + ports: + - "1235:80" + deploy: + mode: replicated + restart_policy: + condition: any + placement: + constraints: [node.role == manager] + update_config: + parallelism: 1 + order: start-first + + migrations: + image: mathwave/sprint-repo:sprint + command: ./manage.py migrate + networks: + - net + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + restart_policy: + condition: on-failure + + web: + image: mathwave/sprint-repo:sprint + networks: + - net + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + volumes: + - /sprint-data/static:/usr/src/app/static + command: ./manage.py runserver 0.0.0.0:8000 --noreload --insecure + deploy: + mode: replicated + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + polling: + image: mathwave/sprint-repo:sprint + networks: + - net + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + command: ./manage.py runserver 0.0.0.0:7998 --noreload + deploy: + mode: replicated + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + storage: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py storage + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + volumes: + - /sprint-data/data:/usr/src/app/data + deploy: + mode: replicated + restart_policy: + condition: any + placement: + constraints: [node.role == manager] + update_config: + parallelism: 1 + order: start-first + + bot: + image: mathwave/sprint-repo:sprint + networks: + - net + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + command: ./manage.py bot + deploy: + mode: replicated + restart_policy: + condition: any + update_config: + parallelism: 1 + order: stop-first + + checker_cleaner: + image: mathwave/sprint-repo:sprint + networks: + - net + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + command: ./manage.py checker_cleaner + deploy: + mode: replicated + restart_policy: + condition: any + update_config: + parallelism: 1 + order: stop-first + + worker: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py receive + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + volumes: + - /tmp:/tmp + - /var/run/docker.sock:/var/run/docker.sock + deploy: + mode: replicated + replicas: 2 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + file_generator: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py file_generator + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + notification_manager: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py notification_manager + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + telegram_sender: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py telegram_sender + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + email_sender: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py email_sender + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: any + update_config: + parallelism: 1 + order: start-first + + apply-languages: + image: mathwave/sprint-repo:sprint + networks: + - net + command: ./manage.py apply_languages + environment: + DB_HOST: "pg.develop.sprinthub.ru" + FS_HOST: "storage" + RABBIT_HOST: "rabbitmq.develop.sprinthub.ru" + REDIS_HOST: "redis.develop.sprinthub.ru" + RABBIT_PASSWORD: $RABBITMQ_PASSWORD_DEV + REDIS_PASSWORD: $REDIS_PASSWORD_DEV + DB_PASSWORD: $DB_PASSWORD_DEV + DEBUG: "true" + TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV + deploy: + mode: replicated + restart_policy: + condition: on-failure + +networks: + net: + driver: overlay diff --git a/.deploy/prod/deploy.yaml b/.deploy/deploy-prod.yaml similarity index 100% rename from .deploy/prod/deploy.yaml rename to .deploy/deploy-prod.yaml diff --git a/.deploy/dev/.env b/.deploy/dev/.env deleted file mode 100644 index a0c56bd..0000000 --- a/.deploy/dev/.env +++ /dev/null @@ -1,11 +0,0 @@ -DB_HOST=pg.develop.sprinthub.ru -FS_HOST=storage -RABBIT_HOST=rabbitmq.develop.sprinthub.ru -REDIS_HOST=redis.develop.sprinthub.ru -RABBIT_PASSWORD=${RABBIT_PASSWORD_DEV} -REDIS_PASSWORD=${REDIS_PASSWORD_DEV} -DB_PASSWORD=${DB_PASSWORD_DEV} -DEBUG=true -TELEGRAM_TOKEN=${TELEGRAM_TOKEN_DEV} -SENTRY_TOKEN=${SENTRY_TOKEN} -EMAIL_PASSWORD=${EMAIL_PASSWORD} \ No newline at end of file diff --git a/.deploy/dev/deploy.yaml b/.deploy/dev/deploy.yaml deleted file mode 100644 index 0de8e0d..0000000 --- a/.deploy/dev/deploy.yaml +++ /dev/null @@ -1,214 +0,0 @@ -version: "3.4" - - -services: - - nginx: - image: mathwave/sprint-repo:sprint-nginx - volumes: - - /sprint-data/static:/var/www/html/static - networks: - - net - ports: - - "1235:80" - deploy: - mode: replicated - restart_policy: - condition: any - placement: - constraints: [node.role == manager] - update_config: - parallelism: 1 - order: start-first - - migrations: - image: mathwave/sprint-repo:sprint - command: ./manage.py migrate - networks: - - net - env_file: - - .env - deploy: - mode: replicated - restart_policy: - condition: on-failure - - web: - image: mathwave/sprint-repo:sprint - networks: - - net - env_file: - - .env - volumes: - - /sprint-data/static:/usr/src/app/static - command: ./manage.py runserver 0.0.0.0:8000 --noreload --insecure - deploy: - mode: replicated - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - polling: - image: mathwave/sprint-repo:sprint - networks: - - net - env_file: - - .env - command: ./manage.py runserver 0.0.0.0:7998 --noreload - deploy: - mode: replicated - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - storage: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py storage - env_file: - - .env - volumes: - - /sprint-data/data:/usr/src/app/data - deploy: - mode: replicated - restart_policy: - condition: any - placement: - constraints: [node.role == manager] - update_config: - parallelism: 1 - order: start-first - - bot: - image: mathwave/sprint-repo:sprint - networks: - - net - env_file: - - .env - command: ./manage.py bot - deploy: - mode: replicated - restart_policy: - condition: any - update_config: - parallelism: 1 - order: stop-first - - checker_cleaner: - image: mathwave/sprint-repo:sprint - networks: - - net - env_file: - - .env - command: ./manage.py checker_cleaner - deploy: - mode: replicated - restart_policy: - condition: any - update_config: - parallelism: 1 - order: stop-first - - worker: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py receive - env_file: - - .env - volumes: - - /tmp:/tmp - - /var/run/docker.sock:/var/run/docker.sock - deploy: - mode: replicated - replicas: 2 - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - file_generator: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py file_generator - env_file: - - .env - deploy: - mode: replicated - replicas: 1 - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - notification_manager: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py notification_manager - env_file: - - .env - deploy: - mode: replicated - replicas: 1 - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - telegram_sender: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py telegram_sender - env_file: - - .env - deploy: - mode: replicated - replicas: 1 - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - email_sender: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py email_sender - env_file: - - .env - deploy: - mode: replicated - replicas: 1 - restart_policy: - condition: any - update_config: - parallelism: 1 - order: start-first - - apply-languages: - image: mathwave/sprint-repo:sprint - networks: - - net - command: ./manage.py apply_languages - env_file: - - .env - deploy: - mode: replicated - restart_policy: - condition: on-failure - -networks: - net: - driver: overlay diff --git a/.deploy/prod/.env b/.deploy/prod/.env deleted file mode 100644 index 802fbf8..0000000 --- a/.deploy/prod/.env +++ /dev/null @@ -1,11 +0,0 @@ -DB_HOST=pg.sprinthub.ru -FS_HOST=storage -RABBIT_HOST=rabbitmq.sprinthub.ru -REDIS_HOST=redis.sprinthub.ru -RABBIT_PASSWORD=$RABBIT_PASSWORD_PROD -REDIS_PASSWORD=$REDIS_PASSWORD_PROD -DB_PASSWORD=$DB_PASSWORD_PROD -DEBUG=true -TELEGRAM_TOKEN=$TELEGRAM_TOKEN_PROD -SENTRY_TOKEN=$SENTRY_TOKEN -EMAIL_PASSWORD=$EMAIL_PASSWORD \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a64ef2e..f6bfc33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,7 @@ deploy-dev: when: on_success - when: manual script: - - docker stack deploy -c ./.deploy/dev/deploy.yaml sprint + - docker stack deploy -c ./.deploy/deploy-dev.yaml sprint deploy-prod: extends: @@ -43,7 +43,7 @@ deploy-prod: - master when: manual script: - - docker stack deploy -c ./.deploy/prod/deploy.yaml sprint + - docker stack deploy -c ./.deploy/deploy-prod.yaml sprint push-runner: extends: