[FW] Use Compose module rather than shell for importing music

This is because for no reason, the shell module will just hang, never launching the container. This is also a bit cleaner...
master
Quentin Duchemin 2021-10-17 13:34:06 +02:00
parent 499770ef34
commit 9ed4e33a7d
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
3 changed files with 33 additions and 2 deletions

View File

@ -25,11 +25,25 @@
- name: Import music into Funkwhale
shell:
# funkwhale_import_music_directory is the mounted version of tagged
# files at previous step
cmd: "docker-compose run --rm api python manage.py import_files {{ funkwhale_import_library_id }} {{ funkwhale_import_music_directory }} --recursive --noinput --prune"
chdir: "{{ funkwhale_folder_name }}"
- name: Run funkwhale import container
community.docker.docker_compose:
project_src: "{{ funkwhale_folder_name }}"
files: ["import.yml"]
remove_orphans: yes
pull: yes
recreate: smart
state: present
- name: Remove funkwhale import container
community.docker.docker_compose:
project_src: "{{ funkwhale_folder_name }}"
files: ["import.yml"]
state: absent
- name: Delete files once imported
shell:
cmd: "rm -rf {{ funkwhale_import_music_directory_host }}/*"

View File

@ -41,6 +41,7 @@
mode: 0644
loop:
- docker-compose.yml.j2
- import.yml.j2
- conf.env.j2
- nginx.conf.j2

View File

@ -0,0 +1,16 @@
version: "{{ compose_version }}"
services:
api:
image: "funkwhale/funkwhale:{{ funkwhale_version }}"
container_name: funkwhale_import
env_file:
- ./conf.env
volumes:
- "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro"
- "static:{{ funkwhale_static_root }}"
- "frontend:{{ funkwhale_frontend }}"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
command: ["python", "manage.py", "import_files", "{{ funkwhale_import_library_id }}", "{{ funkwhale_import_music_directory }}", "--recursive", "--noinput", "--prune"]
restart: no