241 lines
5.6 KiB
YAML
241 lines
5.6 KiB
YAML
version: '3.9'
|
|
|
|
services:
|
|
storage:
|
|
image: alpine:latest
|
|
container_name: file-storage
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 128M
|
|
reservations:
|
|
memory: 64M
|
|
networks:
|
|
- app-network
|
|
volumes:
|
|
- uploads_data:/storage:rw
|
|
command: tail -f /dev/null
|
|
restart: unless-stopped
|
|
|
|
db:
|
|
image: postgres:17
|
|
restart: always
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '1.0'
|
|
memory: 1G
|
|
environment:
|
|
POSTGRES_DB: no_copy_
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_SHARED_BUFFERS: 512MB
|
|
POSTGRES_EFFECTIVE_CACHE_SIZE: 1536MB
|
|
ports:
|
|
- "54320:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
container_name: postgres
|
|
networks:
|
|
app-network:
|
|
aliases:
|
|
- database
|
|
|
|
app:
|
|
build: .
|
|
container_name: app-backend
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.5'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
environment:
|
|
FILE_STORAGE_PATH: /data/uploads
|
|
MAX_FILE_SIZE: 10737418240
|
|
# FILE_CHUNK_SIZE: 1048576
|
|
FILE_CHUNK_SIZE: 1000000
|
|
POSTGRES_DB: no_copy_
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_PORT: 5432
|
|
POSTGRES_HOST: db
|
|
STORAGE_SERVICE_URL: http://storage:8081
|
|
SPRING_PROFILES_ACTIVE: docker
|
|
|
|
JAVA_OPTS: "-DYANDEX_API_KEY=AQVNyaVaUmgUb1GMCtf5zSEqFxy0woXrcMOOB43q -DYANDEX_FOLDER_ID=b1gokpdbm6qfpsou8pcd -DYANDEX_SEARCH_URL='https://searchapi.api.cloud.yandex.net/v2/image/search_by_image'"
|
|
|
|
depends_on:
|
|
- db
|
|
ports:
|
|
- "80:8080"
|
|
networks:
|
|
app-network:
|
|
aliases:
|
|
- app
|
|
- backend
|
|
- api
|
|
volumes:
|
|
- uploads_data:/data/uploads:rw
|
|
|
|
grafana:
|
|
image: grafana/grafana:10.3.1
|
|
container_name: grafana
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
prometheus:
|
|
condition: service_healthy
|
|
loki:
|
|
condition: service_healthy
|
|
tempo:
|
|
condition: service_started
|
|
alloy:
|
|
condition: service_started
|
|
environment:
|
|
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
|
GF_SECURITY_ADMIN_USER: admin
|
|
GF_SECURITY_ADMIN_PASSWORD: admin
|
|
GF_METRICS_ENABLED: "true"
|
|
GF_DATABASE_MAX_IDLE_CONN: "2"
|
|
GF_DATABASE_MAX_OPEN_CONN: "10"
|
|
volumes:
|
|
- ./infrastructure/grafana/provisioning:/etc/grafana/provisioning
|
|
- ./infrastructure/grafana/dashboards:/var/lib/grafana/dashboards
|
|
healthcheck:
|
|
test: [ "CMD", "wget", "--spider", "http://localhost:3000/api/health" ]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
networks:
|
|
- app-network
|
|
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
container_name: prometheus
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 1G
|
|
reservations:
|
|
memory: 512M
|
|
ports:
|
|
- "9090:9090"
|
|
volumes:
|
|
- ./infrastructure/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
- prometheus_data:/prometheus
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
- '--storage.tsdb.retention.time=15d' # Удерживать 15 дней
|
|
- '--web.enable-lifecycle'
|
|
healthcheck:
|
|
test: [ "CMD", "wget", "--spider", "http://localhost:9090/-/healthy" ]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app-network
|
|
|
|
loki:
|
|
image: grafana/loki:2.9.2
|
|
container_name: loki
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 2G
|
|
reservations:
|
|
memory: 1G
|
|
ports:
|
|
- "3100:3100"
|
|
volumes:
|
|
- ./infrastructure/loki/loki-config.yaml:/etc/loki/loki-config.yaml:ro
|
|
- loki_data:/loki
|
|
command:
|
|
- -config.file=/etc/loki/loki-config.yaml
|
|
healthcheck:
|
|
test: [ "CMD", "wget", "--spider", "-q", "http://localhost:3100/ready" ]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app-network
|
|
|
|
tempo:
|
|
image: grafana/tempo:2.4.1
|
|
container_name: tempo
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|
|
command: [ "-config.file=/etc/tempo/tempo.yaml" ]
|
|
volumes:
|
|
- ./infrastructure/tempo/tempo.yaml:/etc/tempo/tempo.yaml
|
|
- tempo_data:/var/tempo
|
|
ports:
|
|
- "3200:3200"
|
|
networks:
|
|
- app-network
|
|
|
|
alloy:
|
|
image: grafana/alloy:latest
|
|
container_name: alloy
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
reservations:
|
|
memory: 128M
|
|
user: root
|
|
ports:
|
|
- "9080:9080"
|
|
- "4317:4317"
|
|
- "4318:4318"
|
|
volumes:
|
|
- ./infrastructure/alloy/config.alloy:/etc/alloy/config.alloy:ro
|
|
- /var/lib/docker/containers:/var/lib/docker/containers:ro
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- /var/log:/var/log:ro
|
|
environment:
|
|
GRAFANA_LOKI_URL: http://loki:3100/loki/api/v1/push
|
|
command:
|
|
- run
|
|
- --server.http.listen-addr=0.0.0.0:9080
|
|
- --storage.path=/var/lib/alloy/data
|
|
- /etc/alloy/config.alloy
|
|
networks:
|
|
- app-network
|
|
|
|
volumes:
|
|
pgdata:
|
|
artifacts:
|
|
tempo_data:
|
|
loki_data:
|
|
loki_chunks:
|
|
loki_index:
|
|
loki_rules:
|
|
uploads_data:
|
|
prometheus_data:
|
|
|
|
networks:
|
|
app-network:
|
|
external: true
|
|
driver: bridge |