-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
142 lines (134 loc) · 4.1 KB
/
docker-compose.yml
File metadata and controls
142 lines (134 loc) · 4.1 KB
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
services:
# ── PostgreSQL + PostGIS ─────────────────────────────
db:
image: postgis/postgis:16-3.4
environment:
POSTGRES_DB: espalert
POSTGRES_USER: espalert
POSTGRES_PASSWORD: espalert
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U espalert" ]
interval: 5s
timeout: 5s
retries: 5
# ── Redis ────────────────────────────────────────────
redis:
image: redis:7-alpine
command: redis-server --requirepass devpassword
ports:
- "6379:6379"
healthcheck:
test: [ "CMD", "redis-cli", "-a", "devpassword", "ping" ]
interval: 5s
timeout: 5s
retries: 5
# ── Next.js Web Frontend (development mapcn app) ─────
web:
build:
context: ./apps/web
dockerfile: Dockerfile
container_name: espalert_web
ports:
- "3000:3000"
environment:
- API_URL=http://api:8000/api/v1
- NEXT_PUBLIC_WS_URL=ws://localhost:8000/api/v1/ws/events
depends_on:
api:
condition: service_started
volumes:
- ./apps/web:/app
- /app/.next
- /app/node_modules
command: npm run dev
# ── FastAPI Backend ──────────────────────────────────
api:
build:
context: ./apps/api
dockerfile: Dockerfile
ports:
- "8000:8000"
env_file:
- ./apps/api/.env
environment:
DATABASE_URL: postgresql+asyncpg://espalert:espalert@db:5432/espalert
DATABASE_URL_SYNC: postgresql+psycopg2://espalert:espalert@db:5432/espalert
REDIS_URL: redis://:devpassword@redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: >
sh -c "
alembic upgrade head &&
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
"
volumes:
- ./apps/api:/app
# ── Celery Worker ────────────────────────────────────
worker:
build:
context: ./apps/api
dockerfile: Dockerfile
env_file:
- ./apps/api/.env
environment:
DATABASE_URL: postgresql+asyncpg://espalert:espalert@db:5432/espalert
DATABASE_URL_SYNC: postgresql+psycopg2://espalert:espalert@db:5432/espalert
REDIS_URL: redis://:devpassword@redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: celery -A app.tasks.celery_app worker --loglevel=info --concurrency=4
volumes:
- ./apps/api:/app
# ── Celery Beat (scheduler) ──────────────────────────
beat:
build:
context: ./apps/api
dockerfile: Dockerfile
env_file:
- ./apps/api/.env
environment:
DATABASE_URL: postgresql+asyncpg://espalert:espalert@db:5432/espalert
DATABASE_URL_SYNC: postgresql+psycopg2://espalert:espalert@db:5432/espalert
REDIS_URL: redis://:devpassword@redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: celery -A app.tasks.celery_app beat --loglevel=info
volumes:
- ./apps/api:/app
# ── Meshtastic Gateway (LoRa mesh bridge) ────────────
mesh-gw:
build:
context: ./apps/api
dockerfile: Dockerfile
env_file:
- ./apps/api/.env
environment:
REDIS_URL: redis://:devpassword@redis:6379/0
MESHTASTIC_CONNECTION: serial
MESHTASTIC_ADDRESS: /dev/ttyUSB0
depends_on:
redis:
condition: service_healthy
devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"
cap_add:
- SYS_RAWIO
command: python -m app.connectors.meshtastic_gw --type serial --address /dev/ttyUSB0
restart: unless-stopped
profiles:
- mesh
volumes:
pgdata: