compose.yaml.j2 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. services:
  2. {{ service_name }}:
  3. image: ghcr.io/open-webui/open-webui:0.7.2
  4. container_name: {{ container_name }}
  5. {#
  6. Set container hostname for identification
  7. #}
  8. hostname: {{ container_hostname }}
  9. {#
  10. Environment variables for OpenWebUI configuration:
  11. - Ollama API URL
  12. - OAuth/OpenID configuration (if Authentik is enabled)
  13. #}
  14. environment:
  15. - TZ={{ container_timezone }}
  16. - OLLAMA_BASE_URL={{ ollama_base_url }}
  17. {% if authentik_enabled %}
  18. - ENABLE_OAUTH_SIGNUP=true
  19. - OAUTH_MERGE_ACCOUNTS_BY_EMAIL={{ oauth_merge_accounts|lower }}
  20. - OAUTH_PROVIDER_NAME=authentik
  21. - OPENID_PROVIDER_URL={{ openid_provider_url }}
  22. - OAUTH_CLIENT_ID={{ authentik_client_id }}
  23. - OAUTH_CLIENT_SECRET={{ authentik_client_secret }}
  24. - OAUTH_SCOPES={{ oauth_scopes }}
  25. - OPENID_REDIRECT_URI={{ openid_redirect_uri }}
  26. {% endif %}
  27. {#
  28. Volume configuration for persistent data
  29. #}
  30. volumes:
  31. - data:/app/backend/data:rw
  32. {#
  33. When traefik is enabled, add traefik network for reverse proxy access
  34. #}
  35. {% if traefik_enabled %}
  36. networks:
  37. {{ traefik_network }}:
  38. {% endif %}
  39. {#
  40. Port mappings for web interface (only when Traefik is disabled)
  41. #}
  42. {% if not traefik_enabled %}
  43. ports:
  44. - "{{ ports_http }}:8080"
  45. {% endif %}
  46. {#
  47. When traefik_enabled is set, add traefik labels
  48. (optionally enable TLS if traefik_tls_enabled is set)
  49. #}
  50. {% if traefik_enabled %}
  51. labels:
  52. - traefik.enable=true
  53. - traefik.docker.network={{ traefik_network }}
  54. - traefik.http.services.{{ service_name }}-web.loadBalancer.server.port=8080
  55. - traefik.http.routers.{{ service_name }}-http.service={{ service_name }}-web
  56. - traefik.http.routers.{{ service_name }}-http.rule=Host(`{{ traefik_host }}.{{ traefik_domain }}`)
  57. - traefik.http.routers.{{ service_name }}-http.entrypoints={{ traefik_entrypoint }}
  58. {% if traefik_tls_enabled %}
  59. - traefik.http.routers.{{ service_name }}-https.service={{ service_name }}-web
  60. - traefik.http.routers.{{ service_name }}-https.rule=Host(`{{ traefik_host }}.{{ traefik_domain }}`)
  61. - traefik.http.routers.{{ service_name }}-https.entrypoints={{ traefik_tls_entrypoint }}
  62. - traefik.http.routers.{{ service_name }}-https.tls=true
  63. - traefik.http.routers.{{ service_name }}-https.tls.certresolver={{ traefik_tls_certresolver }}
  64. {% endif %}
  65. {% endif %}
  66. restart: {{ restart_policy }}
  67. {#
  68. Volume definitions:
  69. - data: Persistent storage for OpenWebUI data
  70. #}
  71. volumes:
  72. data:
  73. driver: local
  74. {#
  75. Network definitions (only when Traefik is enabled):
  76. - Traefik network: always external (managed by Traefik)
  77. #}
  78. {% if traefik_enabled %}
  79. networks:
  80. {{ traefik_network }}:
  81. external: true
  82. {% endif %}