File size: 1,277 Bytes
19d59ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
version: '3.8'

services:
  web:
    build: .
    command: gunicorn --config gunicorn_config.py app:app --reload
    ports:
      - "8000:8000"
    volumes:
      - .:/app
      - /app/__pycache__
    depends_on:
      - redis
    environment:
      - FLASK_ENV=development
      - FLASK_DEBUG=1
      - REDIS_URL=redis://redis:6379/0
    # build: .
    # command: python -m flask run --host=0.0.0.0 --port=8000 --debug
    # ports:
    #   - "3000:8000"
    # volumes:
    #   - .:/app
    #   - /app/__pycache__
    # environment:
    #   - FLASK_ENV=development
    #   - FLASK_DEBUG=1
    #   - REDIS_URL=redis://redis:6379/0

  celery_worker:
    build: .
    command: celery -A app.celery worker --loglevel=info
    volumes:
      - .:/app
      - /app/__pycache__
    depends_on:
      - redis
    deploy:
      replicas: 8
      resources:
        limits:
          cpus: '1'
          memory: 1G

  celery_flower:
    build: .
    command: celery -A app.celery flower
    ports:
      - "5555:5555"
    depends_on:
      - redis
      - celery_worker

  redis:
    image: redis:latest
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 256M

volumes:
  redis_data: