compose.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. name: "Grafana Alloy"
  3. description: "A lightweight and flexible service mesh"
  4. version: "0.0.1"
  5. date: "2023-10-01"
  6. author: "Christian Lempa"
  7. tags:
  8. - "grafana"
  9. - "alloy"
  10. - "monitoring"
  11. - "http"
  12. - "traefik"
  13. ---
  14. {% variables %}
  15. container_hostname:
  16. description: "Sets the container's internal hostname (this will show up in the collected logs)"
  17. {% endvariables %}
  18. services:
  19. {{ service_name | default("alloy")}}:
  20. image: grafana/alloy:v1.10.2
  21. container_name: {{ container_name | default("alloy") }}
  22. hostname: {{ container_hostname }}
  23. command:
  24. - run
  25. - --server.http.listen-addr=0.0.0.0:12345
  26. - --storage.path=/var/lib/alloy/data
  27. - /etc/alloy/config.alloy
  28. ports:
  29. - "12345:12345"
  30. volumes:
  31. - ./config.alloy:/etc/alloy/config.alloy
  32. - alloy_data:/var/lib/alloy/data
  33. - /:/rootfs:ro
  34. - /run:/run:ro
  35. - /var/log:/var/log:ro
  36. - /sys:/sys:ro
  37. - /var/lib/docker/:/var/lib/docker/:ro
  38. - /run/udev/data:/run/udev/data:ro
  39. networks:
  40. - {{ docker_network | default("bridge")}}
  41. {% if traefik %}
  42. labels:
  43. - traefik.enable={{ traefik_enable | default(true) }}
  44. - traefik.http.services.{{ service_name }}.loadbalancer.server.port=12345
  45. - traefik.http.services.{{ service_name }}.loadbalancer.server.scheme=http
  46. - traefik.http.routers.{{ service_name }}.service={{ service_name }}
  47. - traefik.http.routers.{{ service_name }}.rule=Host(`{{ traefik_host }}`)
  48. {% if traefik_tls %}
  49. - traefik.http.routers.{{ service_name }}.tls={{ traefik_tls | default(true) }}
  50. - traefik.http.routers.{{ service_name }}.entrypoints={{ traefik_entrypoint | default("websecure") }}
  51. - traefik.http.routers.{{ service_name }}.tls.certresolver={{ traefik_certresolver | default("cloudflare") }}
  52. {% else %}
  53. - traefik.http.routers.{{ service_name }}.entrypoints={{ traefik_entrypoint | default("websecure") }}
  54. {% endif %}
  55. {% endif %}
  56. restart: {{ restart_policy | default("unless-stopped") }}
  57. volumes:
  58. alloy_data:
  59. driver: local
  60. networks:
  61. {{ docker_network | default("bridge")}}:
  62. external: true