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 pull mathwave/sprint-repo:sprint
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:
extends:

View File

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