1
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
services:
|
||||
# Database: PostgreSQL + PostGIS
|
||||
# قاعدة البيانات: تخزين البيانات الجغرافية
|
||||
db:
|
||||
image: postgis/postgis:15-3.3
|
||||
container_name: map-db
|
||||
platform: linux/amd64 # Ensure compatibility on Mac Silicon
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./infrastructure/osm-data:/infrastructure/osm-data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Cache: Redis
|
||||
# التخزين المؤقت: تخزين البيانات السريعة ومواقع السائقين اللحظية
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: map-redis
|
||||
platform: linux/arm64
|
||||
ports:
|
||||
- "6380:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Routing Engine: GraphHopper
|
||||
routing:
|
||||
image: israelhikingmap/graphhopper:latest
|
||||
container_name: map-routing
|
||||
platform: linux/amd64
|
||||
ports:
|
||||
- "8989:8080"
|
||||
volumes:
|
||||
- ./infrastructure/osm-data:/data
|
||||
- ./infrastructure/docker/graphhopper/config.yml:/graphhopper/config.yml
|
||||
command: ["-i", "/data/jordan-latest.osm.pbf", "-c", "config.yml"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
# Tile Server: Tileserver-GL
|
||||
# خادم الخرائط: عرض طبقات الخريطة للمتصفح وتطبيق الموبايل
|
||||
#tileserver:
|
||||
# image: maptiler/tileserver-gl:latest
|
||||
# container_name: map-tileserver
|
||||
# platform: linux/amd64
|
||||
# ports:
|
||||
# - "8080:80"
|
||||
# volumes:
|
||||
# - ./infrastructure/osm-data:/data
|
||||
# - ./infrastructure/docker/tileserver:/config
|
||||
# command: ["-c", "/config/config.json"]
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "http://localhost/"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 3
|
||||
|
||||
# Backend API: NestJS
|
||||
# البرمجية الخلفية: إدارة الطلبات والبيانات اللحظية
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./infrastructure/docker/api/Dockerfile
|
||||
container_name: map-api
|
||||
platform: linux/arm64
|
||||
ports:
|
||||
- "3200:3200"
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- API_PORT=${API_PORT}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
routing:
|
||||
condition: service_healthy
|
||||
|
||||
# Tile Server: Martin (Vector Tiles from PostGIS)
|
||||
# خادم الخرائط: توليد مربعات الخرائط مباشرة من قاعدة البيانات
|
||||
martin:
|
||||
image: maplibre/martin:latest
|
||||
container_name: map-martin
|
||||
platform: linux/amd64
|
||||
ports:
|
||||
- "3001:3000"
|
||||
environment:
|
||||
- WATCH_DB=true
|
||||
command: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
# OSM Import Tool: osm2pgsql
|
||||
# أداة استيراد البيانات: لاستيراد ملف OSM إلى قاعدة البيانات
|
||||
osm-import:
|
||||
image: iboates/osm2pgsql:latest
|
||||
container_name: map-import
|
||||
platform: linux/amd64
|
||||
volumes:
|
||||
- ./infrastructure/osm-data:/data
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
- PGPASSWORD=${POSTGRES_PASSWORD}
|
||||
command: ["osm2pgsql", "--create", "--slim", "--cache", "1000", "--database", "${POSTGRES_DB}", "--host", "db", "--user", "${POSTGRES_USER}", "/data/jordan-latest.osm.pbf"]
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
profiles:
|
||||
- import # Run only with --profile import
|
||||
|
||||
# Web Frontend: React (Map Dashboard)
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./infrastructure/docker/web/Dockerfile
|
||||
container_name: map-web
|
||||
platform: linux/arm64
|
||||
ports:
|
||||
- "3201:5173"
|
||||
depends_on:
|
||||
- api
|
||||
- martin
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
Reference in New Issue
Block a user