From 544783955a62afe326de6906014c68b10607ffb9 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Feb 2025 18:01:37 -0300 Subject: [PATCH 1/4] fix: refactor env --- .env.sample | 31 +++++++++++++++++-------------- compose.yml | 23 ++++++++++++++--------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.env.sample b/.env.sample index a417322..1a86ab3 100644 --- a/.env.sample +++ b/.env.sample @@ -12,20 +12,9 @@ SECRET_DJANGO_SECRET_KEY_VERSION=v1 # more concurrent requests, but also leads to higher CPU/Memory usage FUNKWHALE_WEB_WORKERS=4 -# Replace this by the definitive, public domain you will use for -# your instance. It cannot be changed after initial deployment -# without breaking your instance. -FUNKWHALE_HOSTNAME=funkwhale.example.com -FUNKWHALE_PROTOCOL=https - # Log level (debug, info, warning, error, critical) LOGLEVEL=error -# Depending on the reverse proxy used in front of your funkwhale instance, -# the API will use different kind of headers to serve audio files -# Allowed values: nginx, apache2 -REVERSE_PROXY_TYPE=nginx - # Number of worker processes to execute. Defaults to 0, in which case it uses # your number of CPUs Celery workers handle background tasks (such file imports # or federation messaging). The more processes a worker gets, the more tasks @@ -33,6 +22,20 @@ REVERSE_PROXY_TYPE=nginx # memory footprint. # CELERYD_CONCURRENCY=0 -# which settings module should django use? -# You don't have to touch this unless you really know what you're doing -DJANGO_SETTINGS_MODULE=config.settings.production +# Max upload size +NGINX_MAX_BODY_SIZE=100M + +# Insert e-mail secret like this: +# +# abra app secret insert APP email_config v1 "URL" +# +# Where URL is +# smtp+ssl://user:password@youremail.host:465 +# smtp://user:password@youremail.host:25 +# smtp+tls://user:password@youremail.host:587 +SECRET_EMAIL_CONFIG_VERSION=v1 + +# DEFAULT_FROM_EMAIL=noreply@yourdomain + +# Make e-mail verification mandatory before using the service +ACCOUNT_EMAIL_VERIFICATION_ENFORCE=true diff --git a/compose.yml b/compose.yml index 53bc41d..5eadec9 100644 --- a/compose.yml +++ b/compose.yml @@ -2,23 +2,28 @@ version: "3.8" x-environment: &default-env + - FUNKWHALE_HOSTNAME=${HOSTNAME} + - FUNKWHALE_PROTOCOL=https + - REVERSE_PROXY_TYPE=nginx + - DJANGO_SETTINGS_MODULE=config.settings.production + - FUNKWHALE_API_IP=127.0.0.1 + - FUNKWHALE_API_PORT=5000 - CACHE_URL=redis://cache:6379/0 + - DEFAULT_FROM_EMAIL=noreply@${DOMAIN} + - FUNKWHALE_WEB_WORKERS + - LOGLEVEL + - ACCOUNT_EMAIL_VERIFICATION_ENFORCE - CELERYD_CONCURRENCY - C_FORCE_ROOT=true - DATABASE_PASSWORD_FILE=/run/secrets/db_password - DJANGO_SECRET_KEY_FILE=/run/secrets/django_secret_key - - DJANGO_SETTINGS_MODULE - DOMAIN - - FUNKWHALE_FRONTEND_PATH=/srv/funkwhale/front/dist - - FUNKWHALE_HOSTNAME - - FUNKWHALE_WEB_WORKERS - - LOGLEVEL + - NGINX_MAX_BODY_SIZE - MEDIA_ROOT=/srv/funkwhale/data/media - - MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music - - MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music - - REVERSE_PROXY_TYPE - - STACK_NAME - STATIC_ROOT=/srv/funkwhale/data/static + - MUSIC_DIRECTORY_PATH=/music + - MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music + - STACK_NAME x-secrets: &default-secrets - db_password -- 2.49.0 From 9d20909ae404b7cf337d9e67cecc5279d1b27d1e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Feb 2025 18:02:50 -0300 Subject: [PATCH 2/4] feat: upgrade to 1.4.0 #8 --- compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compose.yml b/compose.yml index 5eadec9..4bd5aee 100644 --- a/compose.yml +++ b/compose.yml @@ -37,7 +37,7 @@ x-volumes: &default-volumes services: api: - image: funkwhale/funkwhale:1.2 + image: funkwhale/api:1.4.0 environment: *default-env secrets: *default-secrets volumes: @@ -57,7 +57,7 @@ services: networks: - internal app: - image: nginx:1.27.1 + image: funkwhale/front:1.4.0 environment: *default-env volumes: *default-volumes configs: @@ -78,7 +78,7 @@ services: - "coop-cloud.${STACK_NAME}.version=0.1.1+1.27.1" celeryworker: - image: funkwhale/funkwhale:1.2 + image: funkwhale/api:1.4.0 depends_on: - db - cache @@ -95,7 +95,7 @@ services: - internal celerybeat: - image: funkwhale/funkwhale:1.2 + image: funkwhale/funkwhale:1.4.0 environment: *default-env secrets: *default-secrets volumes: *default-volumes -- 2.49.0 From 05680cd23597039830b027de3499e6b5d7629964 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Feb 2025 18:03:10 -0300 Subject: [PATCH 3/4] fix: mount volumes --- compose.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/compose.yml b/compose.yml index 4bd5aee..afd1f4a 100644 --- a/compose.yml +++ b/compose.yml @@ -29,22 +29,15 @@ x-secrets: &default-secrets - db_password - django_secret_key -x-volumes: &default-volumes - - music-data:/srv/funkwhale/data/music:ro - - media-data:/srv/funkwhale/data/media - - static-data:/srv/funkwhale/data/static - - frontend-data:/srv/funkwhale/front/dist:ro - services: api: image: funkwhale/api:1.4.0 environment: *default-env secrets: *default-secrets volumes: - - music-data:/srv/funkwhale/data/music:ro - - media-data:/srv/funkwhale/data/media - - static-data:/srv/funkwhale/data/static - - frontend-data:/app/frontend:ro + - music-data:/music:ro + - media-data:/srv/funkwhale/data/media + - static-data:/srv/funkwhale/data/static depends_on: - db - cache @@ -59,7 +52,10 @@ services: app: image: funkwhale/front:1.4.0 environment: *default-env - volumes: *default-volumes + volumes: + - music-data:/music:ro + - media-data:/srv/funkwhale/data/media:ro + - static-data:/usr/share/nginx/html/staticfiles:ro configs: - source: nginx_config target: /etc/nginx/nginx.conf @@ -84,7 +80,9 @@ services: - cache environment: *default-env secrets: *default-secrets - volumes: *default-volumes + volumes: + - music-data:/music:ro + - media-data:/srv/funkwhale/data/media configs: - source: app_entrypoint target: /docker-entrypoint.sh @@ -98,7 +96,6 @@ services: image: funkwhale/funkwhale:1.4.0 environment: *default-env secrets: *default-secrets - volumes: *default-volumes depends_on: - db - cache -- 2.49.0 From 977984baf57650abcd6a8ed3545e2a6589c0723b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 Feb 2025 18:03:23 -0300 Subject: [PATCH 4/4] fix: celery --- compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compose.yml b/compose.yml index afd1f4a..25a9459 100644 --- a/compose.yml +++ b/compose.yml @@ -88,7 +88,12 @@ services: target: /docker-entrypoint.sh mode: 0555 entrypoint: /docker-entrypoint.sh - command: celery -A funkwhale_api.taskapp worker -l INFO + command: + - celery + - --app=funkwhale_api.taskapp + - worker + - --loglevel=${LOGLEVEL} + - --concurrency=${CELERYD_CONCURRENCY:-0} networks: - internal -- 2.49.0