File size: 3,226 Bytes
e9d86db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Docker Compose pour FireWatch AI
# Créé par Marino ATOHOUN

version: '3.8'

services:
  # Application Django
  web:
    build: .
    container_name: firewatch_web
    ports:
      - "8000:8000"
    volumes:
      - ./media:/app/media
      - ./models:/app/models
      - ./logs:/app/logs
    environment:
      - DEBUG=False
      - SECRET_KEY=${SECRET_KEY:-django-insecure-change-me-in-production}
      - DATABASE_URL=postgresql://firewatch:firewatch123@db:5432/firewatch_db
      - REDIS_URL=redis://redis:6379/0
      - CELERY_BROKER_URL=redis://redis:6379/0
      - DJANGO_SUPERUSER_USERNAME=admin
      - DJANGO_SUPERUSER_EMAIL=admin@firewatch.ai
      - DJANGO_SUPERUSER_PASSWORD=admin123
    depends_on:
      - db
      - redis
    restart: unless-stopped
    networks:
      - firewatch_network

  # Base de données PostgreSQL
  db:
    image: postgres:15
    container_name: firewatch_db
    environment:
      - POSTGRES_DB=firewatch_db
      - POSTGRES_USER=firewatch
      - POSTGRES_PASSWORD=firewatch123
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped
    networks:
      - firewatch_network

  # Redis pour le cache et Celery
  redis:
    image: redis:7-alpine
    container_name: firewatch_redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    restart: unless-stopped
    networks:
      - firewatch_network

  # Celery Worker pour les tâches asynchrones
  celery:
    build: .
    container_name: firewatch_celery
    command: celery -A firewatch_project worker --loglevel=info
    volumes:
      - ./media:/app/media
      - ./models:/app/models
      - ./logs:/app/logs
    environment:
      - DEBUG=False
      - SECRET_KEY=${SECRET_KEY:-django-insecure-change-me-in-production}
      - DATABASE_URL=postgresql://firewatch:firewatch123@db:5432/firewatch_db
      - REDIS_URL=redis://redis:6379/0
      - CELERY_BROKER_URL=redis://redis:6379/0
    depends_on:
      - db
      - redis
    restart: unless-stopped
    networks:
      - firewatch_network

  # Nginx (optionnel, pour la production)
  nginx:
    image: nginx:alpine
    container_name: firewatch_nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./media:/app/media
      - ./staticfiles:/app/staticfiles
      - ./ssl:/etc/nginx/ssl  # Pour les certificats SSL
    depends_on:
      - web
    restart: unless-stopped
    networks:
      - firewatch_network

volumes:
  postgres_data:
    driver: local
  redis_data:
    driver: local

networks:
  firewatch_network:
    driver: bridge

# Configuration pour le développement
# Utilisez: docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
---
# docker-compose.dev.yml
version: '3.8'

services:
  web:
    environment:
      - DEBUG=True
      - DJANGO_SUPERUSER_USERNAME=dev
      - DJANGO_SUPERUSER_EMAIL=dev@firewatch.local
      - DJANGO_SUPERUSER_PASSWORD=dev123
    volumes:
      - .:/app  # Mount du code source pour le développement
    ports:
      - "8000:8000"
    command: python manage.py runserver 0.0.0.0:8000

  # Désactiver Nginx en développement
  nginx:
    profiles:
      - production