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

services:
  front:
Agate's avatar
Agate committed
5
    build: front
6 7 8
    env_file:
      - .env.dev
      - .env
9 10
    environment:
      - "HOST=0.0.0.0"
Agate's avatar
Agate 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}
Agate's avatar
Agate committed
26 27
    environment:
      - "POSTGRES_HOST_AUTH_METHOD=trust"
28
    command: postgres ${POSTGRES_ARGS-}
29 30 31 32
    volumes:
      - "./data/${COMPOSE_PROJECT_NAME-node1}/postgres:/var/lib/postgresql/data"
    networks:
      - internal
33 34

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

44
  api:
45 46 47
    env_file:
      - .env.dev
      - .env
48
    build: &backend
49
      context: ./api
50 51 52 53
      dockerfile: Dockerfile
      args:
        install_dev_deps: 1
    entrypoint: compose/django/dev-entrypoint.sh
54 55 56
    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/"
57 58
    volumes:
      - ./api:/app
59
      - "${MUSIC_DIRECTORY_SERVE_PATH-./data/music}:/music:ro"
60
      - "./data/plugins:/srv/funkwhale/plugins"
61
      - "./data/staticfiles:/staticfiles"
62
      - "./data/media:/data/media"
63
    environment:
64 65 66 67
      - "FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-localhost}"
      - "FUNKWHALE_HOSTNAME_SUFFIX=funkwhale.test"
      - "FUNKWHALE_HOSTNAME_PREFIX=${COMPOSE_PROJECT_NAME}"
      - "FUNKWHALE_PROTOCOL=${FUNKWHALE_PROTOCOL-http}"
68 69
      - "DATABASE_URL=postgresql://postgres@postgres/postgres"
      - "CACHE_URL=redis://redis:6379/0"
70
      - "STATIC_ROOT=/staticfiles"
71
      - "MEDIA_ROOT=/data/media"
Agate's avatar
Agate committed
72

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

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

    labels:
      traefik.backend: "${COMPOSE_PROJECT_NAME-node1}"
Agate's avatar
Agate committed
140
      traefik.frontend.rule: "Host:${COMPOSE_PROJECT_NAME-node1}.funkwhale.test,${NODE_IP-127.0.0.1},${DJANGO_ALLOWED_HOSTS}"
141 142 143 144 145 146
      traefik.enable: "true"
      traefik.federation.protocol: "http"
      traefik.federation.port: "80"
      traefik.frontend.passHostHeader: true
      traefik.docker.network: federation

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

Agate's avatar
Agate committed
156
  api-docs:
Agate's avatar
Agate committed
157
    image: swaggerapi/swagger-ui:v3.26.0
Agate's avatar
Agate committed
158 159 160
    environment:
      - "API_URL=/swagger.yml"
    ports:
161
      - "8002:8080"
Agate's avatar
Agate committed
162
    volumes:
163
      - "./docs/swagger.yml:/usr/share/nginx/html/swagger.yml"
Agate's avatar
Agate committed
164
      - "./docs/api:/usr/share/nginx/html/api"
Agate's avatar
Agate committed
165

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
  # 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



183
networks:
184
  ? internal
185 186 187
  federation:
    external:
      name: federation