{% include 'roles/docker-compose/templates/base.yml.j2' %}
  celeryworker:
    # 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
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ applications | get_docker_image(application_id,'api') }}"
    command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency={{celeryd_concurrency}}
    environment:
      - C_FORCE_ROOT=true
    volumes:
      - "data:{{funkwhale_media_root}}"
      - "music:{{funkwhale_music_directory_path}}:ro"
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}

  celerybeat:
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ applications | get_docker_image(application_id,'api') }}"
    command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}

  api:
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ applications | get_docker_image(application_id,'api') }}"
    volumes:
      - "music:{{funkwhale_music_directory_path}}:ro"
      - "data:{{funkwhale_media_root}}"
      - "funkwhale_static_root:{{funkwhale_static_root}}"
    ports:
      - "{{ funkwhale_docker_api_port }}"
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}

  front:
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ applications | get_docker_image(application_id,'front') }}"
    depends_on:
      - api
    environment:
      - "NGINX_MAX_BODY_SIZE=100M"
    volumes:
      - "data:{{funkwhale_media_root}}:ro"
      #- "{{funkwhale_static_root}}:{{funkwhale_static_root}}:ro"
    ports:
      - "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
  
  typesense:
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ applications | get_app_conf(application_id, 'docker.images.typesense', True) }}"
    volumes:
      - ./typesense/data:/data
    command: --data-dir /data --enable-cors
    profiles:
      - typesense

{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
  data:
  funkwhale_static_root:
  music:

{% include 'roles/docker-compose/templates/networks.yml.j2' %}