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

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

  redis:
    restart: unless-stopped
17
18
    networks:
      - default
19
    env_file: .env
20
    image: redis:5
21
    volumes:
22
      - ./data/redis:/data
23
24
25
26

  celeryworker:
    restart: unless-stopped
    image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
27
28
29
30
31
    networks:
      - default
    depends_on:
      - postgres
      - redis
32
    env_file: .env
33
34
35
36
37
38
39
40
    # 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
41
    command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0}
42
43
44
    environment:
      - C_FORCE_ROOT=true
    volumes:
45
46
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
47
48
49
50

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

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

76
  nginx:
77
    restart: unless-stopped
78
    image: nginx
79
80
81
82
    networks:
      - default
    depends_on:
      - api
83
84
85
86
    env_file:
      - .env
    environment:
      # Override those variables in your .env file if needed
87
      - "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}"
88
89
90
    volumes:
      - "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro"
      - "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro"
91
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
92
93
94
95
96
97
98
99
100
101
102
103
      - "${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;'"
104
105
106

networks:
  default: