Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ beat:
$(eval export DC_PROFILES=${DC_PROFILES} --profile beat)
@true

.PHONY: otel-collector
otel-collector:
$(eval export DC_PROFILES=${DC_PROFILES} --profile otel-collector)
$(eval export OTEL_EXPORT_TYPE=otlp)
$(eval export OTEL_COLLECTOR_ENDPOINT=otel-collector:4317)
@true

.PHONY: otel-loadbalancer
otel-loadbalancer:
$(eval export DC_PROFILES=${DC_PROFILES} --profile otel-loadbalancer --profile otel-collector)
$(eval export OTEL_EXPORT_TYPE=otlp)
$(eval export OTEL_COLLECTOR_ENDPOINT=otel-loadbalancer:4317)
$(eval export OTEL_COLLECTOR_REPLICAS=2)
@true

.PHONY: otel-console
otel-console:
$(eval export OTEL_EXPORT_TYPE=console)
@true

.PHONY: antivirus
antivirus:
$(eval export DC_ANTIVIRUS=ANTIVIRUS_ENABLED=1)
Expand All @@ -22,7 +42,7 @@ sms-provider-stub:

.PHONY: up
up:
${DC_SMS_PROVIDER_STUB_MMG} ${DC_SMS_PROVIDER_STUB_FIRETEXT} ${DC_ANTIVIRUS} docker compose ${DC_PROFILES} up
${DC_SMS_PROVIDER_STUB_MMG} ${DC_SMS_PROVIDER_STUB_FIRETEXT} ${DC_ANTIVIRUS} docker compose ${DC_PROFILES} up --remove-orphans

.PHONY: stop
stop: beat antivirus sms-provider-stub
Expand Down
104 changes: 87 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ services:
- POSTGRES_USER=notify
- POSTGRES_PASSWORD=notify
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 5s
timeout: 1s
retries: 3
networks:
db:


redis:
image: redis:6.2
container_name: redis
Expand All @@ -26,6 +27,7 @@ services:
networks:
redis:


notify-api:
image: notifications-api
container_name: notify-api
Expand All @@ -38,15 +40,18 @@ services:
target: test
ports:
- "127.0.0.1:6011:6011"
command: ["api-local"]
command: [ "api-local" ]
stdin_open: true
tty: true
env_file:
- private/local-aws-creds.env
- private/notify-api.env
environment:
- ANTIVIRUS_ENABLED
- NOTIFY_APP_NAME=api-web
- FLASK_RUN_EXTRA_FILES=/opt/venv/
- OTEL_EXPORT_TYPE=${OTEL_EXPORT_TYPE:-none}
- OTEL_COLLECTOR_ENDPOINT=${OTEL_COLLECTOR_ENDPOINT:-none}
depends_on:
db:
condition: service_healthy
Expand All @@ -68,7 +73,7 @@ services:
container_name: db-migration
volumes:
- ../notifications-api:/home/vcap/app
command: ["migration"]
command: [ "migration" ]
env_file:
- private/local-aws-creds.env
- private/notify-api.env
Expand All @@ -78,20 +83,24 @@ services:
networks:
db:


notify-api-celery:
image: notifications-api
container_name: notify-api-celery
volumes:
- ../notifications-api:/home/vcap/app
- ../notifications-utils:/home/vcap/utils
command: ["worker"]
command: [ "worker" ]
env_file:
- private/local-aws-creds.env
- private/notify-api.env
environment:
- ANTIVIRUS_ENABLED
- MMG_URL
- FIRETEXT_URL
- NOTIFY_APP_NAME=api-worker
- OTEL_EXPORT_TYPE=${OTEL_EXPORT_TYPE:-none}
- OTEL_COLLECTOR_ENDPOINT=${OTEL_COLLECTOR_ENDPOINT:-none}
depends_on:
db:
condition: service_healthy
Expand All @@ -103,6 +112,7 @@ services:
db:
apps:


notify-api-celery-beat:
image: notifications-api
container_name: notify-api-celery-beat
Expand All @@ -111,12 +121,15 @@ services:
volumes:
- ../notifications-api:/home/vcap/app
- ../notifications-utils:/home/vcap/utils
command: ["celery-beat"]
command: [ "celery-beat" ]
env_file:
- private/local-aws-creds.env
- private/notify-api.env
environment:
- NOTIFY_APP_NAME=api-celery-beat
- ANTIVIRUS_ENABLED
- OTEL_EXPORT_TYPE=${OTEL_EXPORT_TYPE:-none}
- OTEL_COLLECTOR_ENDPOINT=${OTEL_COLLECTOR_ENDPOINT:-none}
depends_on:
db:
condition: service_healthy
Expand All @@ -128,12 +141,13 @@ services:
db:
apps:


notify-admin:
image: notifications-admin
image: docker.io/library/notifications-admin:latest
container_name: notify-admin
volumes:
- ../notifications-admin:/home/vcap/app
- ../notifications-utils:/home/vcap/utils
# volumes:
# - ../notifications-admin:/home/vcap/app
# - ../notifications-utils:/home/vcap/utils
build:
context: ../notifications-admin
dockerfile: docker/Dockerfile
Expand All @@ -142,7 +156,7 @@ services:
- NOTIFY_ENVIRONMENT=development
ports:
- "127.0.0.1:6012:6012"
command: ["web-local"]
command: [ "web-local" ]
stdin_open: true
tty: true
env_file:
Expand All @@ -151,6 +165,9 @@ services:
environment:
- ANTIVIRUS_ENABLED
- FLASK_RUN_EXTRA_FILES=/opt/venv/
- NOTIFY_APP_NAME=admin
- OTEL_EXPORT_TYPE=${OTEL_EXPORT_TYPE:-none}
- OTEL_COLLECTOR_ENDPOINT=${OTEL_COLLECTOR_ENDPOINT:-none}
depends_on:
notify-api:
condition: service_started
Expand All @@ -174,7 +191,7 @@ services:
- NOTIFY_ENVIRONMENT=development
ports:
- "127.0.0.1:7000:7000"
command: ["web-local"]
command: [ "web-local" ]
stdin_open: true
tty: true
env_file:
Expand All @@ -199,7 +216,7 @@ services:
- NOTIFY_ENVIRONMENT=development
ports:
- "127.0.0.1:7001:7001"
command: ["web-local"]
command: [ "web-local" ]
stdin_open: true
tty: true
env_file:
Expand Down Expand Up @@ -238,19 +255,20 @@ services:
- template-preview-api.localhost

template-preview-celery:
image: template-preview-api
image: docker.io/library/notifications-template-preview:latest
container_name: template-preview-celery
volumes:
- ../notifications-template-preview:/home/vcap/app
- ../notifications-utils:/home/vcap/utils
command: ["worker"]
command: [ "worker" ]
env_file:
- private/local-aws-creds.env
- private/template-preview-api.env
restart: always
networks:
apps:


antivirus-api:
image: antivirus-api
container_name: antivirus-api
Expand All @@ -267,7 +285,7 @@ services:
- NOTIFY_ENVIRONMENT=development
ports:
- "127.0.0.1:6016:6016"
entrypoint: ["./scripts/run_app.sh"]
entrypoint: [ "./scripts/run_app.sh" ]
stdin_open: true
tty: true
environment:
Expand All @@ -281,7 +299,7 @@ services:
- antivirus-api.localhost

antivirus-celery:
image: antivirus-api
image: docker.io/library/notifications-antivirus:latest
container_name: antivirus-celery
profiles:
- antivirus
Expand All @@ -293,7 +311,7 @@ services:
target: test
args:
- NOTIFY_ENVIRONMENT=development
entrypoint: ["./scripts/run_celery.sh"]
entrypoint: [ "./scripts/run_celery.sh" ]
stdin_open: true
tty: true
environment:
Expand All @@ -305,6 +323,7 @@ services:
networks:
apps:


sms-provider-stub:
image: sms-provider-stub
container_name: sms-provider-stub
Expand All @@ -325,6 +344,57 @@ services:
aliases:
- notify.localhost

otel-loadbalancer:
image: otel/opentelemetry-collector-contrib:latest
deploy:
mode: replicated
replicas: 2
profiles:
- otel-loadbalancer
volumes:
- ./otel_mapping_loadbalancer.yml:/etc/otel/config.yaml
stdin_open: true
tty: true
command: [ "--config", "/etc/otel/config.yaml" ]
networks:
apps:
aliases:
- otel-loadbalancer.localhost

otel-collector:
image: otel/opentelemetry-collector-contrib:latest
deploy:
mode: replicated
replicas: ${OTEL_COLLECTOR_REPLICAS:-1}
profiles:
- otel-collector
volumes:
- ./otel_mapping.yml:/etc/otel/config.yaml
ports:
- "127.0.0.1:9090-9091:9090" # Prometheus exporter
stdin_open: true
tty: true
command: [ "--config", "/etc/otel/config.yaml" ]
networks:
apps:
aliases:
- otel-collector.localhost

jaeger:
image: jaegertracing/jaeger:latest
container_name: jaeger
ports:
- "16686:16686"
- "4317:4317"
- "4318:4318"
- "5778:5778"
- "9411:9411"
restart: on-failure
networks:
apps:
aliases:
- jaeger.localhost

networks:
db:
redis:
Expand Down
Loading