schon/docker-compose.yml
Egor fureunoir Gorbunov 304608adc4 feat(elasticsearch): add scripts for cleaning Elasticsearch data
Introduce `delete-elasticsearch` scripts for both Windows and Unix to stop, remove containers, and delete data volumes. Updated `Makefile` to include this command for easier management. Upgraded `django-elasticsearch-dsl` and related dependencies to their latest versions for compatibility.

Breaking change: Updated Elasticsearch image and configuration to enable xpack security. Ensure environment variables are properly set.
2026-03-03 01:44:51 +03:00

229 lines
5.5 KiB
YAML

x-logging:
&default-logging
options:
max-size: "10m"
max-file: "3"
services:
app:
container_name: app
build:
context: .
dockerfile: ./Dockerfiles/app.Dockerfile
restart: always
volumes:
- .:/app
- static-data:/app/static
- media-data:/app/media
ports:
- "8000:8000"
env_file:
- .env
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
condition: service_healthy
logging: *default-logging
database:
container_name: database
image: postgis/postgis:17-3.5
restart: always
volumes:
- postgres-data:/var/lib/postgresql/data/
env_file:
- .env
logging: *default-logging
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U \"$POSTGRES_USER\" -d \"$POSTGRES_DB\" -h localhost" ]
interval: 30s
timeout: 10s
retries: 5
database_exporter:
container_name: postgres_exporter
image: quay.io/prometheuscommunity/postgres-exporter:v0.17.0
restart: always
profiles: ["monitoring"]
env_file:
- .env
environment:
- DATA_SOURCE_NAME=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database:5432/${POSTGRES_DB}?sslmode=disable
depends_on:
database:
condition: service_healthy
logging: *default-logging
redis:
container_name: redis
image: redis:7.4
restart: always
command: redis-server --save "" --appendonly no --slave-read-only no --requirepass "$REDIS_PASSWORD"
volumes:
- redis-data:/data
env_file:
- .env
logging: *default-logging
healthcheck:
test: [ "CMD", "redis-cli", "-a", "$REDIS_PASSWORD", "ping" ]
interval: 30s
timeout: 10s
retries: 5
redis_exporter:
container_name: redis_exporter
image: oliver006/redis_exporter:v1.73.0
restart: always
profiles: ["monitoring"]
env_file:
- .env
environment:
- REDIS_ADDR=redis:6379
- REDIS_PASSWORD=${REDIS_PASSWORD}
depends_on:
redis:
condition: service_healthy
logging: *default-logging
elasticsearch:
container_name: elasticsearch
image: git.wiseless.xyz/fureunoir/schon-elasticsearch:9.3.1
restart: always
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
env_file:
- .env
volumes:
- es-data:/usr/share/elasticsearch/data
logging: *default-logging
healthcheck:
test: [ "CMD", "curl", "-f", "-u", "elastic:${ELASTIC_PASSWORD}", "http://localhost:9200/_cluster/health" ]
interval: 10s
timeout: 5s
retries: 5
elasticsearch_exporter:
container_name: elasticsearch_exporter
image: quay.io/prometheuscommunity/elasticsearch-exporter:v1.9.0
restart: always
profiles: ["monitoring"]
env_file:
- .env
command:
- "--es.uri=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200"
depends_on:
elasticsearch:
condition: service_healthy
logging: *default-logging
worker:
container_name: worker
build:
context: .
dockerfile: Dockerfiles/worker.Dockerfile
restart: always
volumes:
- .:/app
- media-data:/app/media
env_file:
- .env
environment:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
condition: service_healthy
logging: *default-logging
healthcheck:
test: [ "CMD-SHELL", "celery -A schon status | grep -q 'OK'" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 15s
stock_updater:
container_name: stock_updater
build:
context: .
dockerfile: Dockerfiles/stock_updater.Dockerfile
restart: always
volumes:
- .:/app
- media-data:/app/media
env_file:
- .env
environment:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
condition: service_healthy
logging: *default-logging
healthcheck:
test: [ "CMD-SHELL", "celery -A schon status | grep -q 'OK'" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 15s
beat:
container_name: beat
build:
context: .
dockerfile: Dockerfiles/beat.Dockerfile
restart: always
volumes:
- .:/app
- media-data:/app/media
env_file:
- .env
environment:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
logging: *default-logging
prometheus:
container_name: prometheus
image: prom/prometheus:v3.4.1
restart: always
user: "root"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/web.yml:/etc/prometheus/web.yml:ro
- prometheus-data:/prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --web.config.file=/etc/prometheus/web.yml
logging: *default-logging
ports:
- "9090:9090"
volumes:
postgres-data:
redis-data:
es-data:
prometheus-data:
static-data:
media-data: