From b5cdfd362e03ed227cf190570e53c1725245f12e Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sat, 13 Nov 2021 17:02:00 +0300 Subject: [PATCH] host --- .gitlab-ci.yml | 5 +---- Sprint/settings.py | 7 +++++-- docker-compose.yaml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f990870..2becd12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,6 @@ stages: variables: SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" build: stage: build @@ -36,8 +34,7 @@ deploy-dev: variables: PORT: 80 SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" + HOST: "http://dev.sprinthub.ru/" deploy-prod: extends: diff --git a/Sprint/settings.py b/Sprint/settings.py index 4ea8baa..217c26e 100644 --- a/Sprint/settings.py +++ b/Sprint/settings.py @@ -16,6 +16,9 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +HOST = os.getenv("HOST", "0.0.0.0") + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ @@ -83,7 +86,7 @@ DATABASES = { "NAME": "sprint", "USER": "postgres", "PASSWORD": os.getenv("DB_PASSWORD", "password"), - "HOST": os.getenv("DB_HOST", "0.0.0.0"), + "HOST": HOST, "PORT": 5432, } } @@ -140,7 +143,7 @@ for root in DATA_ROOT, EXTRA_FILES_ROOT, MEDIA_ROOT: SOLUTIONS_ROOT = os.path.join(DATA_ROOT, "solutions") -RABBIT_HOST = os.getenv("RABBIT_HOST", "0.0.0.0") +RABBIT_HOST = HOST RABBIT_PORT = 5672 STATICFILES_DIRS = [ diff --git a/docker-compose.yaml b/docker-compose.yaml index 0eaa7eb..9a99246 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,8 +22,7 @@ services: restart: always environment: PORT: $PORT - DB_HOST: $DB_HOST - RABBIT_HOST: $RABBIT_HOST + HOST: $HOST command: scripts/runserver.sh ports: - "${PORT}:${PORT}" @@ -37,6 +36,8 @@ services: bot: image: mathwave/sprint-repo:sprint restart: always + environment: + HOST: $HOST command: python manage.py bot depends_on: - web @@ -57,8 +58,7 @@ services: command: scripts/create_worker.sh environment: SOLUTIONS_ROOT_EXTERNAL: "${SOLUTIONS_ROOT_EXTERNAL}" - DB_HOST: "${DB_HOST}" - RABBIT_HOST: "${RABBIT_HOST}" + HOST: $HOST depends_on: - web - rabbitmq