This commit is contained in:
Egor Matveev 2022-03-02 20:44:50 +03:00
parent 9297b0605f
commit 44b2b38dc2
3 changed files with 54 additions and 47 deletions

View File

@ -22,7 +22,8 @@ build:
# - docker image rm mathwave/sprint-repo:sprint # - docker image rm mathwave/sprint-repo:sprint
# - docker pull mathwave/sprint-repo:sprint # - docker pull mathwave/sprint-repo:sprint
script: script:
- docker-compose up -d --scale worker=4 - docker-compose up -d -f docker-compose-infra.yaml
- docker stack deploy -c ./docker-compose-deploy.yaml sprint
deploy-dev: deploy-dev:
extends: extends:

View File

@ -1,27 +1,13 @@
version: "3" version: "3.2"
services: services:
postgres:
restart: always
build:
context: .
dockerfile: dockerfiles/postgres/Dockerfile
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: sprint
volumes:
- /sprint-data/postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
migrations: migrations:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
command: ./manage.py migrate command: ./manage.py migrate
depends_on: deploy:
- postgres mode: replicated
web: web:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
@ -33,19 +19,8 @@ services:
command: ./manage.py runserver 0.0.0.0:$PORT --noreload command: ./manage.py runserver 0.0.0.0:$PORT --noreload
ports: ports:
- "${PORT}:${PORT}" - "${PORT}:${PORT}"
depends_on: deploy:
- migrations mode: replicated
- rabbitmq
- storage
storage:
restart: always
image: mathwave/sprint-repo:sprint
command: ./manage.py storage
ports:
- "5555:5555"
volumes:
- /sprint-data/data:/usr/src/app/data
bot: bot:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
@ -55,6 +30,8 @@ services:
command: ./manage.py bot command: ./manage.py bot
depends_on: depends_on:
- web - web
deploy:
mode: replicated
loop: loop:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
@ -64,15 +41,8 @@ services:
command: ./manage.py loop command: ./manage.py loop
depends_on: depends_on:
- web - web
deploy:
rabbitmq: mode: replicated
restart: always
build:
context: .
dockerfile: dockerfiles/rabbitmq/Dockerfile
ports:
- "15672:15672"
- "5672:5672"
worker: worker:
restart: always restart: always
@ -84,20 +54,21 @@ services:
HOST: $HOST HOST: $HOST
depends_on: depends_on:
- web - web
- rabbitmq
- migrations - migrations
- storage
volumes: volumes:
- /sprint-data/solutions:/usr/src/app/solutions - /sprint-data/solutions:/usr/src/app/solutions
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 4
apply-languages: apply-languages:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
command: ./manage.py apply_languages command: ./manage.py apply_languages
depends_on: depends_on:
- migrations - migrations
- web deploy:
- postgres mode: replicated
notify-admin: notify-admin:
image: mathwave/sprint-repo:sprint image: mathwave/sprint-repo:sprint
@ -106,9 +77,8 @@ services:
- migrations - migrations
- web - web
- worker - worker
- storage
- rabbitmq
- bot - bot
- postgres
- apply-languages - apply-languages
- loop - loop
deploy:
mode: replicated

36
docker-compose-infra.yaml Normal file
View File

@ -0,0 +1,36 @@
version: "3"
services:
postgres:
restart: always
build:
context: .
dockerfile: dockerfiles/postgres/Dockerfile
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: sprint
volumes:
- /sprint-data/postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
storage:
restart: always
image: mathwave/sprint-repo:sprint
command: ./manage.py storage
ports:
- "5555:5555"
volumes:
- /sprint-data/data:/usr/src/app/data
rabbitmq:
restart: always
build:
context: .
dockerfile: dockerfiles/rabbitmq/Dockerfile
ports:
- "15672:15672"
- "5672:5672"