service-volumes-v1.j2 767 B

1234567891011121314151617181920212223242526
  1. {#
  2. Archetype: service-volumes-v1
  3. Description:
  4. Service volume mounts supporting standalone and swarm modes.
  5. Approach:
  6. - Standalone mode: Uses named volumes
  7. - Swarm mount mode: Uses bind mounts from swarm_volume_mount_path
  8. - Swarm local/nfs mode: Uses named volumes
  9. Usage:
  10. Use for services that need persistent storage.
  11. Follows the pattern from pihole template.
  12. Uses volume_name variable for named volumes.
  13. #}
  14. volumes:
  15. {% if not swarm_enabled %}
  16. - {{ volume_name }}:/data
  17. {% else %}
  18. {% if swarm_volume_mode == 'mount' %}
  19. - {{ swarm_volume_mount_path }}/data:/data:rw
  20. {% elif swarm_volume_mode in ['local', 'nfs'] %}
  21. - {{ volume_name }}:/data
  22. {% endif %}
  23. {% endif %}