services:
  backend-webapp:
    image: "docker-hosted.nexus.bthlabs.pl/hotpocket/backend:{{ hotpocket_app.backend.image_tag }}"
    command:
      - "/srv/venv/bin/gunicorn"
      - "-c"
      - "/srv/lib/gunicorn.conf.py"
      - "-b"
      - "unix:///srv/run/gunicorn.sock"
      - "hotpocket_backend.wsgi:application"
    logging:
      driver: "loki"
      options:
        loki-url: "{{ hotpocket_app.loki.url }}"
        loki-external-labels: "{{ hotpocket_app.backend.webapp.loki.external_labels }}"
        labels: "node"
    labels:
      node: "{{ hotpocket_app.loki.node }}"
    env_file:
      - "etc/backend_base.env"
      - "etc/backend_webapp.env"
    extra_hosts: [{% for extra_host in hotpocket_app.docker.extra_hosts|default([]) %}"{{ extra_host }}"{% endfor %}]
    restart: "unless-stopped"
    volumes:
      - "{{ hotpocket_app.deployment_directory }}/etc/backend:/srv/etc"
      - "{{ hotpocket_app.deployment_directory }}/lib/backend:/srv/lib/backend"
      - "{{ hotpocket_app.deployment_directory }}/run/backend-webapp:/srv/run"
      - "{{ hotpocket_app.deployment_directory }}/run/uploads:/srv/uploads"
