diff --git a/roles/caddy/defaults/main.yml b/roles/caddy/defaults/main.yml index 58d1881..22c82a4 100644 --- a/roles/caddy/defaults/main.yml +++ b/roles/caddy/defaults/main.yml @@ -7,6 +7,7 @@ website_path: /srv/http gitea_domain: "git.{{ domain }}" +navidrome_domain: "mus.{{ domain }}" ## send renewal reminders to this address email: null diff --git a/roles/caddy/templates/Caddyfile.j2 b/roles/caddy/templates/Caddyfile.j2 index d24d330..1ceecaf 100644 --- a/roles/caddy/templates/Caddyfile.j2 +++ b/roles/caddy/templates/Caddyfile.j2 @@ -16,3 +16,9 @@ http://{{ gitea_domain }} { reverse_proxy {{ groups["gitea"][0] }}:3000 } {% endif %} + +{% if groups["navidrome"] | length > 0 %} +http://{{ navidrome_domain }} { + reverse_proxy {{ groups["navidrome"][0] }}:4533 +} +{% endif %} diff --git a/roles/containers/defaults/main.yml b/roles/containers/defaults/main.yml index 6d5b203..48564f1 100644 --- a/roles/containers/defaults/main.yml +++ b/roles/containers/defaults/main.yml @@ -11,3 +11,8 @@ gitea_domain: "git.{{ domain }}" vault_path: "{{ dataroot }}/syncthing/vault" archive_path: "{{ dataroot }}/syncthing/vault_a" syncthing_conf_dir: "{{ dataroot }}/syncthing/config" + +# navidrome (music) path +music_path: "{{ dataroot }}/music" + +navidrome_domain: "mus.{{ domain }}" diff --git a/roles/containers/tasks/main.yml b/roles/containers/tasks/main.yml index f75d83a..702a323 100644 --- a/roles/containers/tasks/main.yml +++ b/roles/containers/tasks/main.yml @@ -17,6 +17,23 @@ register: user_gitea when: '"gitea" in groups' +- name: Create Navidrome user + user: + name: navidrome + register: user_navidrome + when: '"navidrome" in groups' + +- name: Create Navidrome directories + file: + path: "{{ item }}" + state: directory + owner: navidrome + group: navidrome + mode: "u=rwX,g=rwX,o=" + with_items: + - "{{ music_path }}" + - "{{ dataroot }}/navidrome" + - name: Create Syncthing group group: name: vault diff --git a/roles/containers/templates/docker-compose.yml.j2 b/roles/containers/templates/docker-compose.yml.j2 index b9c816e..a7f4fb2 100644 --- a/roles/containers/templates/docker-compose.yml.j2 +++ b/roles/containers/templates/docker-compose.yml.j2 @@ -6,6 +6,8 @@ version: "3" networks: gitea: driver: bridge + navidrome: + driver: bridge services: {% if "gitea" in group_names %} @@ -45,3 +47,20 @@ services: - {{ syncthing_conf_dir }}/:/var/syncthing/config {% endif %} +{% if "navidrome" in group_names %} + navidrome: + container_name: navidrome + image: deluan/navidrome:latest + user: {{ user_navidrome.uid }}:{{ user_navidrome.group }} + environment: + ND_LISTENBRAINZ_ENABLED: true + restart: unless-stopped + volumes: + - "{{ dataroot }}/navidrome:/data" + - "{{ music_path }}/:/music:ro" + networks: + - navidrome + ports: + - "4533:4533" + +{% endif %}