From 01ae2c3b38dd285d3e54f023012a8d8819451ace Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 4 Feb 2025 23:49:38 +0100 Subject: [PATCH] solved environment variable bug --- .../templates/docker-compose.yml.j2 | 28 +++++++++---------- roles/docker-funkwhale/templates/env.j2 | 19 +++++++------ roles/docker-funkwhale/vars/main.yml | 6 +++- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index 46d8d703..8b529e5d 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -14,30 +14,30 @@ services: # flag: # celery -A funkwhale_api.taskapp worker -l INFO --concurrency=4 {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - image: funkwhale/api:${FUNKWHALE_VERSION} - command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} + image: funkwhale/api:{{applications.funkwhale.version}} + command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency={{celeryd_concurrency}} environment: - C_FORCE_ROOT=true volumes: - - "data:${MEDIA_ROOT}" - - "music:${MUSIC_DIRECTORY_PATH}:ro" + - "data:{{media_root}}" + - "music:{{music_directory_path}}:ro" {% include 'templates/docker/container/depends-on-database-redis.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %} celerybeat: {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - image: funkwhale/api:${FUNKWHALE_VERSION} + image: funkwhale/api:{{applications.funkwhale.version}} command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO {% include 'templates/docker/container/depends-on-database-redis.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %} api: {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - image: funkwhale/api:${FUNKWHALE_VERSION} + image: funkwhale/api:{{applications.funkwhale.version}} volumes: - - "music:${MUSIC_DIRECTORY_PATH}:ro" - - "data:${MEDIA_ROOT}" - - "static_root:${STATIC_ROOT}" + - "music:{{music_directory_path}}:ro" + - "data:{{media_root}}" + - "static_root:{{static_root}}" ports: - "5000" {% include 'templates/docker/container/depends-on-database-redis.yml.j2' %} @@ -45,18 +45,18 @@ services: front: {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - image: funkwhale/front:${FUNKWHALE_VERSION} + image: funkwhale/front:{{applications.funkwhale.version}} depends_on: - api environment: # Override those variables in your .env file if needed - - "NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE-100M}" + - "NGINX_MAX_BODY_SIZE=100M" volumes: - - "data:${MEDIA_ROOT}:ro" - #- "${STATIC_ROOT}:${STATIC_ROOT}:ro" + - "data:{{media_root}}:ro" + #- "{{static_root}}:{{static_root}}:ro" ports: # override those variables in your .env file if needed - - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" + - "127.0.0.1:{{http_port}}:80" {% include 'templates/docker/container/networks.yml.j2' %} typesense: diff --git a/roles/docker-funkwhale/templates/env.j2 b/roles/docker-funkwhale/templates/env.j2 index 1955b265..76e87a71 100644 --- a/roles/docker-funkwhale/templates/env.j2 +++ b/roles/docker-funkwhale/templates/env.j2 @@ -16,17 +16,23 @@ # # Docker only # ----------- -MUSIC_DIRECTORY_PATH=/music +MUSIC_DIRECTORY_PATH={{music_directory_path}} +# Assuming that the following variable isn't used anymore. +# @todo remove it if this is true FUNKWHALE_VERSION={{applications.funkwhale.version}} # End of docker-only configuration # General configuration # --------------------- - +# Assuming that the following variable isn't used anymore. +# @todo remove it if this is true FUNKWHALE_API_IP=127.0.0.1 +# Assuming that the following variable isn't used anymore. +# @todo remove it if this is true FUNKWHALE_API_PORT={{http_port}} + # The number of web workers to start in parallel. Higher means you can handle # more concurrent requests, but also leads to higher CPU/Memory usage FUNKWHALE_WEB_WORKERS=4 @@ -74,17 +80,17 @@ REVERSE_PROXY_TYPE=nginx # messaging). The more processes a worker gets, the more tasks # can be processed in parallel. However, more processes also means # a bigger memory footprint. -CELERYD_CONCURRENCY=1 +CELERYD_CONCURRENCY={{celeryd_concurrency}} # Where media files (such as album covers or audio tracks) should be stored # on your system? # (Ensure this directory actually exists) -MEDIA_ROOT=/srv/funkwhale/data/ +MEDIA_ROOT={{media_root}} # Where static files (such as API css or icons) should be compiled # on your system? # (Ensure this directory actually exists) -STATIC_ROOT=/srv/funkwhale/data/static +STATIC_ROOT={{static_root}} # which settings module should django use? # You don't have to touch this unless you really know what you're doing @@ -109,7 +115,4 @@ DJANGO_SECRET_KEY={{funkwhale_django_secret}} FUNKWHALE_FRONTEND_PATH=/srv/funkwhale/front/dist -# Nginx related configuration -NGINX_MAX_BODY_SIZE=100M - DATABASE_URL = postgresql://{{database_username}}:{{database_password}}@{{database_host}}:{{database_port}}/{{ database_name }} \ No newline at end of file diff --git a/roles/docker-funkwhale/vars/main.yml b/roles/docker-funkwhale/vars/main.yml index 4e0971f4..655ed1b0 100644 --- a/roles/docker-funkwhale/vars/main.yml +++ b/roles/docker-funkwhale/vars/main.yml @@ -2,4 +2,8 @@ application_id: "funkwhale" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" database_password: "{{funkwhale_database_password}}" database_type: "postgres" -ldap_network_enabled: true # Activate LDAP network \ No newline at end of file +ldap_network_enabled: true # Activate LDAP network +media_root: "/srv/funkwhale/data/" +static_root: "{{media_root}}static" +celeryd_concurrency: 1 +music_directory_path: "/music" \ No newline at end of file