Spaces:
Sleeping
Sleeping
File size: 4,719 Bytes
8e77663 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
version: '3.8'
services:
ocr-api:
build:
context: .
dockerfile: Dockerfile
image: persian-ocr-api
container_name: persian-ocr-service
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- ./app:/app
- ./logs:/app/logs
- ./models:/app/models
- ./temp_uploads:/app/temp_uploads
environment:
- ENVIRONMENT=production
- MAX_WORKERS=4
- WORKER_TIMEOUT=300
- MODEL_CACHE_SIZE=1024
- REDIS_URL=redis://redis:6379
- MONGODB_URL=mongodb://mongodb:27017/ocr_db
- LOG_LEVEL=INFO
- ENABLE_METRICS=true
depends_on:
- redis
- mongodb
- elasticsearch
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '2'
memory: 4G
reservations:
cpus: '1'
memory: 2G
networks:
- ocr-network
redis:
image: redis:alpine
container_name: ocr-redis
command: redis-server --appendonly yes
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
networks:
- ocr-network
mongodb:
image: mongo:latest
container_name: ocr-mongodb
restart: unless-stopped
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=secret
- MONGO_INITDB_DATABASE=ocr_db
ports:
- "27017:27017"
volumes:
- mongodb-data:/data/db
- ./mongo-init:/docker-entrypoint-initdb.d
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '1'
memory: 2G
networks:
- ocr-network
elasticsearch:
image: elasticsearch:8.8.0
container_name: ocr-elasticsearch
restart: unless-stopped
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false
ports:
- "9200:9200"
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -q 'status.*green\\|status.*yellow'"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '1'
memory: 2G
networks:
- ocr-network
kibana:
image: kibana:8.8.0
container_name: ocr-kibana
restart: unless-stopped
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
depends_on:
- elasticsearch
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
networks:
- ocr-network
prometheus:
image: prom/prometheus:latest
container_name: ocr-prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
networks:
- ocr-network
grafana:
image: grafana/grafana:latest
container_name: ocr-grafana
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
- prometheus
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
networks:
- ocr-network
traefik:
image: traefik:v2.10
container_name: ocr-traefik
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./traefik.yml:/etc/traefik/traefik.yml
- ./acme.json:/acme.json
- /var/run/docker.sock:/var/run/docker.sock:ro
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
networks:
- ocr-network
volumes:
redis-data:
mongodb-data:
elasticsearch-data:
prometheus-data:
grafana-data:
networks:
ocr-network:
driver: bridge |