docker-compose.yml 3.03 KB
Newer Older
1
version: "3"
2
3
4
5

services:
  postgres:
    restart: unless-stopped
6
7
    networks:
      - default
8
    env_file: .env
9
    image: postgres:11
10
11
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
12
13
14

  redis:
    restart: unless-stopped
15
16
    networks:
      - default
17
18
19
    env_file: .env
    image: redis:3
    volumes:
20
      - ./data/redis:/data
21
22
23
24

  celeryworker:
    restart: unless-stopped
    image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
25
26
27
28
29
    networks:
      - default
    depends_on:
      - postgres
      - redis
30
    env_file: .env
31
32
33
34
35
36
37
38
    # Celery workers handle background tasks (such file imports or federation
    # messaging). The more processes a worker gets, the more tasks
    # can be processed in parallel. However, more processes also means
    # a bigger memory footprint.
    # By default, a worker will span a number of process equal to your number
    # of CPUs. You can adjust this, by explicitly setting the --concurrency
    # flag:
    #   celery -A funkwhale_api.taskapp worker -l INFO --concurrency=4
39
    command: celery -A funkwhale_api.taskapp worker -l INFO
40
41
42
    environment:
      - C_FORCE_ROOT=true
    volumes:
43
44
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
45
46
47
48

  celerybeat:
    restart: unless-stopped
    image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
49
50
51
    networks:
      - default
    depends_on:
52
53
      - postgres
      - redis
54
55
    env_file: .env
    command: celery -A funkwhale_api.taskapp beat -l INFO
56
57
58
59

  api:
    restart: unless-stopped
    image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
60
61
62
63
64
    networks:
      - default
    depends_on:
      - postgres
      - redis
65
66
    env_file: .env
    volumes:
67
68
69
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
      - "${STATIC_ROOT}:${STATIC_ROOT}"
70
      - "${FUNKWHALE_FRONTEND_PATH}:/frontend"
71
    ports:
72
      - "5000"
73

74
  nginx:
75
    restart: unless-stopped
76
    image: nginx
77
78
79
80
    networks:
      - default
    depends_on:
      - api
81
82
83
84
    env_file:
      - .env
    environment:
      # Override those variables in your .env file if needed
85
      - "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}"
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    volumes:
      - "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro"
      - "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro"
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}:ro"
      - "${STATIC_ROOT}:${STATIC_ROOT}:ro"
      - "${FUNKWHALE_FRONTEND_PATH}:/frontend:ro"
    ports:
      # override those variables in your .env file if needed
      - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80"
    command: >
        sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\"
        < /etc/nginx/conf.d/funkwhale.template
        > /etc/nginx/conf.d/default.conf
        && cat /etc/nginx/conf.d/default.conf
        && nginx -g 'daemon off;'"
102
103
104

networks:
  default: