dev.yml 4.88 KB
Newer Older
1
version: "3"
2 3 4

services:
  front:
5
    build: front
6 7 8
    env_file:
      - .env.dev
      - .env
9 10
    environment:
      - "HOST=0.0.0.0"
Eliot Berriot's avatar
Eliot Berriot committed
11
      - "VUE_PORT=${VUE_PORT-8080}"
12
    ports:
13
      - "${VUE_PORT-8080}"
14
    volumes:
15 16 17
      - "./front:/app"
      - "/app/node_modules"
      - "./po:/po"
18 19
    networks:
      - internal
20 21

  postgres:
22 23 24
    env_file:
      - .env.dev
      - .env
25
    image: postgres:${POSTGRES_VERSION-11}
Eliot Berriot's avatar
Eliot Berriot committed
26
    command: postgres -c log_min_duration_statement=0
27 28 29 30
    volumes:
      - "./data/${COMPOSE_PROJECT_NAME-node1}/postgres:/var/lib/postgresql/data"
    networks:
      - internal
31 32

  redis:
33 34 35
    env_file:
      - .env.dev
      - .env
36
    image: redis:3.0
37 38 39 40
    volumes:
      - "./data/${COMPOSE_PROJECT_NAME-node1}/redis:/data"
    networks:
      - internal
41

42
  api:
43 44 45
    env_file:
      - .env.dev
      - .env
46
    build: &backend
47
      context: ./api
48 49 50 51
      dockerfile: Dockerfile
      args:
        install_dev_deps: 1
    entrypoint: compose/django/dev-entrypoint.sh
52 53 54
    command: >
      bash -c "python manage.py collectstatic --no-input
      && uvicorn --reload config.asgi:application --host 0.0.0.0 --port 5000  --reload-dir config/ --reload-dir=funkwhale_api/"
55 56
    volumes:
      - ./api:/app
57
      - "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
58
      - "./data/plugins:/srv/funkwhale/plugins"
59
      - "./data/staticfiles:/staticfiles"
60
      - "./data/media:/data/media"
61
    environment:
62 63 64 65
      - "FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-localhost}"
      - "FUNKWHALE_HOSTNAME_SUFFIX=funkwhale.test"
      - "FUNKWHALE_HOSTNAME_PREFIX=${COMPOSE_PROJECT_NAME}"
      - "FUNKWHALE_PROTOCOL=${FUNKWHALE_PROTOCOL-http}"
66 67
      - "DATABASE_URL=postgresql://postgres@postgres/postgres"
      - "CACHE_URL=redis://redis:6379/0"
68
      - "STATIC_ROOT=/staticfiles"
69
      - "MEDIA_ROOT=/data/media"
70

71
    depends_on:
72
      - postgres
73
      # - minio
74
      - redis
75 76
    networks:
      - internal
77 78 79 80
    cap_add:
      - SYS_PTRACE

  celeryworker:
81 82 83
    env_file:
      - .env.dev
      - .env
84
    build: *backend
85
    depends_on:
86
      - postgres
87
      # - minio
88 89
      - redis
    command: celery -A funkwhale_api.taskapp worker -l debug -B
90
    environment:
91 92 93 94
      - "FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-localhost}"
      - "FUNKWHALE_HOSTNAME_SUFFIX=funkwhale.test"
      - "FUNKWHALE_HOSTNAME_PREFIX=${COMPOSE_PROJECT_NAME}"
      - "FUNKWHALE_PROTOCOL=${FUNKWHALE_PROTOCOL-http}"
95 96
      - "DATABASE_URL=postgresql://postgres@postgres/postgres"
      - "CACHE_URL=redis://redis:6379/0"
97
      - "MEDIA_ROOT=/data/media"
98 99
    volumes:
      - ./api:/app
100
      - "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
101
      - "./data/plugins:/srv/funkwhale/plugins"
102
      - "./data/media:/data/media"
103 104
    networks:
      - internal
105
  nginx:
106
    command: /entrypoint.sh
107 108 109
    env_file:
      - .env.dev
      - .env
110
    image: nginx
111 112
    ports:
      - "${NGINX_PORTS_MAPPING-8000:80}"
113
    environment:
114
      - "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}"
115 116 117 118
      - "FUNKWHALE_API_IP=${FUNKHALE_API_IP-api}"
      - "FUNKWHALE_API_PORT=${FUNKWHALE_API_PORT-5000}"
      - "FUNKWHALE_FRONT_IP=${FUNKHALE_FRONT_IP-front}"
      - "FUNKWHALE_FRONT_PORT=${VUE_PORT-8080}"
119 120
      - "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME- }"
      - "FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-localhost}"
121
    depends_on:
122 123 124
      - api
      - front
    volumes:
125
      - ./docker/nginx/conf.dev:/etc/nginx/nginx.conf.template:ro
126
      - ./docker/nginx/entrypoint.sh:/entrypoint.sh:ro
127
      - "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
128
      - ./deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro
129
      - "./front:/frontend:ro"
130
      - "./data/staticfiles:/staticfiles:ro"
131
      - "./data/media:/protected/media:ro"
132
    networks:
133
      - federation
134
      - internal
135 136 137 138 139 140 141 142 143 144

    labels:
      traefik.backend: "${COMPOSE_PROJECT_NAME-node1}"
      traefik.frontend.rule: "Host:${COMPOSE_PROJECT_NAME-node1}.funkwhale.test,${NODE_IP-127.0.0.1}"
      traefik.enable: "true"
      traefik.federation.protocol: "http"
      traefik.federation.port: "80"
      traefik.frontend.passHostHeader: true
      traefik.docker.network: federation

145 146 147 148 149 150
  docs:
    build: docs
    command: python serve.py
    volumes:
      - ".:/app/"
    ports:
151 152
      - "35730:35730"
      - "8001:8001"
153

Eliot Berriot's avatar
Eliot Berriot committed
154
  api-docs:
155
    image: swaggerapi/swagger-ui:v3.21.0
Eliot Berriot's avatar
Eliot Berriot committed
156 157 158
    environment:
      - "API_URL=/swagger.yml"
    ports:
159
      - "8002:8080"
Eliot Berriot's avatar
Eliot Berriot committed
160
    volumes:
161
      - "./docs/swagger.yml:/usr/share/nginx/html/swagger.yml"
Eliot Berriot's avatar
Eliot Berriot committed
162

163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
  # minio:
  #   image: minio/minio
  #   command: server /data
  #   volumes:
  #     - "./data/${COMPOSE_PROJECT_NAME-node1}/minio:/data"
  #   environment:
  #     - "MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID-access_key}"
  #     - "MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY-secret_key}"
  #     - "MINIO_HTTP_TRACE: /dev/stdout"
  #   ports:
  #     - "9000:9000"
  #   networks:
  #     - federation
  #     - internal



180
networks:
181
  ? internal
182 183 184
  federation:
    external:
      name: federation