-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
156 lines (146 loc) · 5.56 KB
/
docker-compose.yml
File metadata and controls
156 lines (146 loc) · 5.56 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# docker-compose.yml — Runs the entire AstraShield stack with one command.
#
# What this does:
# Starts ALL services: FastAPI, Celery worker, Redis, MongoDB, PostgreSQL, MinIO
#
# How to use:
# 1. Make sure Docker Desktop is installed: https://www.docker.com/products/docker-desktop/
# 2. Copy backend/.env.example to backend/.env and fill in values
# 3. Run: docker compose up --build
# 4. Open: http://localhost:3000 (frontend)
# http://localhost:8000/docs (API docs)
# http://localhost:9001 (MinIO dashboard — login: minioadmin/minioadmin)
version: "3.9"
services:
# ── PostgreSQL database ──────────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: astrashield_postgres
restart: unless-stopped
environment:
POSTGRES_DB: astrashield
POSTGRES_USER: astrashield
POSTGRES_PASSWORD: astrashield_secret
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U astrashield"]
interval: 5s
timeout: 5s
retries: 5
# ── MongoDB database ─────────────────────────────────────────────────────────
mongo:
image: mongo:7
container_name: astrashield_mongo
restart: unless-stopped
volumes:
- mongo_data:/data/db
ports:
- "27017:27017"
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 5
# ── Redis (message queue for Celery) ────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: astrashield_redis
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# ── MinIO (file storage) ─────────────────────────────────────────────────────
minio:
image: minio/minio:latest
container_name: astrashield_minio
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
volumes:
- minio_data:/data
ports:
- "9000:9000" # API port
- "9001:9001" # Web dashboard port
# ── FastAPI backend ──────────────────────────────────────────────────────────
api:
build:
context: ./backend
dockerfile: ../docker/Dockerfile.backend
container_name: astrashield_api
restart: unless-stopped
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
environment:
DATABASE_URL: postgresql://astrashield:astrashield_secret@postgres:5432/astrashield
MONGO_URL: mongodb://mongo:27017
MONGO_DB: astrashield
REDIS_URL: redis://redis:6379/0
MINIO_ENDPOINT: minio:9000
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
MINIO_BUCKET: astrashield-uploads
MINIO_SECURE: "false"
SECRET_KEY: "change-this-in-production-make-it-long-and-random"
ALLOWED_ORIGINS: "http://localhost:3000"
DEBUG: "true"
volumes:
- ./backend:/app # Mount code for live reloading
- ./models:/app/models # Mount AI model files
ports:
- "8000:8000"
depends_on:
postgres: { condition: service_healthy }
mongo: { condition: service_healthy }
redis: { condition: service_healthy }
# ── Celery worker (runs AI analysis tasks) ───────────────────────────────────
worker:
build:
context: ./backend
dockerfile: ../docker/Dockerfile.backend
container_name: astrashield_worker
restart: unless-stopped
command: celery -A celery_app worker --loglevel=info --concurrency=2
environment:
DATABASE_URL: postgresql://astrashield:astrashield_secret@postgres:5432/astrashield
MONGO_URL: mongodb://mongo:27017
MONGO_DB: astrashield
REDIS_URL: redis://redis:6379/0
MINIO_ENDPOINT: minio:9000
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
MINIO_BUCKET: astrashield-uploads
MINIO_SECURE: "false"
volumes:
- ./backend:/app
- ./models:/app/models
depends_on:
- redis
- postgres
- mongo
# ── Next.js frontend ─────────────────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: ../docker/Dockerfile.frontend
container_name: astrashield_frontend
restart: unless-stopped
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000
ports:
- "3000:3000"
depends_on:
- api
# ── Persistent data volumes ──────────────────────────────────────────────────
# Data in these volumes survives container restarts
volumes:
postgres_data:
mongo_data:
minio_data: