From 4a23db3e9230ae0d10be84ea9297bf39a27a08e4 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Mon, 24 Aug 2020 23:06:35 +0200 Subject: [PATCH] Removed some variables from celerybeat service and changed the network stack --- .env.example | 18 +++++++++++------- all.env.example | 41 ----------------------------------------- docker-compose.yml | 40 ++++++++++++++++++++++++---------------- 3 files changed, 35 insertions(+), 64 deletions(-) diff --git a/.env.example b/.env.example index 1a1a259..e2a8ad9 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,17 @@ # Global Settings TZ=Etc/UTC LOCAL_STACK_DIR=/srv/docker/volumes/funkwhale +HOST_MUSIC_DIRECTORY_SERVE_PATH=/srv/docker/volumes/funkwhale/media/import_music +HOST_MEDIA_ROOT=/srv/docker/volumes/funkwhale/media/media +HOST_STATIC_ROOT=/srv/docker/volumes/funkwhale/api/static +HOST_FUNKWHALE_FRONTEND_PATH=/srv/docker/volumes/funkwhale/api/front/dist # 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= # Global Settings (optional) +# The tag of the image we should use FUNKWHALE_VERSION= # Networks @@ -30,12 +35,11 @@ WB_TAG= WB_CONTAINER_NAME= WB_RESTART= - +# celeryworker (optional) +# 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 +# can be processed in parallel. However, more processes also means +# a bigger memory footprint. CELERYD_CONCURRENCY= - -MUSIC_DIRECTORY_PATH=/music -MUSIC_DIRECTORY_SERVE_PATH=/srv/docker/volumes/funkwhale/media/import_music -MEDIA_ROOT=/srv/docker/volumes/funkwhale/media/media -STATIC_ROOT=/srv/docker/volumes/funkwhale/api/static -FUNKWHALE_FRONTEND_PATH=/srv/docker/volumes/funkwhale/api/front/dist diff --git a/all.env.example b/all.env.example index b26abfc..54ae345 100644 --- a/all.env.example +++ b/all.env.example @@ -16,15 +16,6 @@ # - MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH if you plan to use # in-place import # -# Docker only -# ----------- - -# The tag of the image we should use -# (it will be interpolated in docker-compose file) -# You can comment or ignore this if you're not using docker -FUNKWHALE_VERSION=latest - -# End of Docker-only configuration # General configuration # --------------------- @@ -88,23 +79,6 @@ REVERSE_PROXY_TYPE=nginx # For the Celery/asynchronous tasks part: # CELERY_BROKER_URL=redis+socket:///run/redis/redis.sock?virtual_host=0 -# 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 -# can be processed in parallel. However, more processes also means -# a bigger memory footprint. -# CELERYD_CONCURRENCY=0 - -# Where media files (such as album covers or audio tracks) should be stored -# on your system? -# (Ensure this directory actually exists) -MEDIA_ROOT=/srv/docker/volumes/funkwhale/media/media - -# Where static files (such as API css or icons) should be compiled -# on your system? -# (Ensure this directory actually exists) -STATIC_ROOT=/srv/docker/volumes/funkwhale/api/static - # 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 @@ -123,19 +97,6 @@ DJANGO_SECRET_KEY= RAVEN_ENABLED=false RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:0062dc16a22b41679cd5765e5342f716@sentry.eliotberriot.com/5 -# In-place import settings -# You can safely leave those settings uncommented if you don't plan to use -# in place imports. -# Typical docker setup: -# MUSIC_DIRECTORY_PATH=/music # docker-only -# MUSIC_DIRECTORY_SERVE_PATH=/srv/docker/volumes/funkwhale/media/import_music -# Typical non-docker setup: -# MUSIC_DIRECTORY_PATH=/srv/docker/volumes/funkwhale/media/import_music -# # MUSIC_DIRECTORY_SERVE_PATH= # stays commented, not needed - -MUSIC_DIRECTORY_PATH=/music -MUSIC_DIRECTORY_SERVE_PATH=/srv/docker/volumes/funkwhale/media/import_music - # LDAP settings # Use the following options to allow authentication on your Funkwhale instance # using a LDAP directory. @@ -150,8 +111,6 @@ MUSIC_DIRECTORY_SERVE_PATH=/srv/docker/volumes/funkwhale/media/import_music # LDAP_START_TLS=False # LDAP_ROOT_DN=dc=domain,dc=com -FUNKWHALE_FRONTEND_PATH=/srv/docker/volumes/funkwhale/api/front/dist - ## External storages configuration # Funkwhale can store uploaded files on Amazon S3 and S3-compatible storages (such as Minio) # Uncomment and fill the variables below diff --git a/docker-compose.yml b/docker-compose.yml index 97f9b43..6516386 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,9 +28,11 @@ services: - postgres - redis volumes: - - "${MUSIC_DIRECTORY_SERVE_PATH}:/music:ro" - - "${MEDIA_ROOT}:${MEDIA_ROOT}" - env_file: all.env + - "${HOST_MUSIC_DIRECTORY_SERVE_PATH}:/srv/wwww/music:ro" + - "${HOST_MEDIA_ROOT}:/srv/wwww/media" + env_file: + - all.env + - shared.env environment: - C_FORCE_ROOT=true - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} @@ -50,9 +52,8 @@ services: depends_on: - postgres - redis - env_file: all.env - environment: - - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} + env_file: + - all.env command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO api: @@ -62,13 +63,15 @@ services: - postgres - redis volumes: - - "${MUSIC_DIRECTORY_SERVE_PATH}:/music:ro" - - "${MEDIA_ROOT}:${MEDIA_ROOT}" - - "${STATIC_ROOT}:${STATIC_ROOT}" - - "${FUNKWHALE_FRONTEND_PATH}:/frontend" + - "${HOST_MUSIC_DIRECTORY_SERVE_PATH}:/srv/wwww/music:ro" + - "${HOST_MEDIA_ROOT}:/srv/wwww/media" + - "${HOST_STATIC_ROOT}:/srv/wwww/static" + - "${HOST_FUNKWHALE_FRONTEND_PATH}:/frontend" expose: - 5000 - env_file: all.env + env_file: + - all.env + - shared.env environment: - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} @@ -76,15 +79,18 @@ services: image: ${WB_IMG:-nginx}:${WB_TAG:-latest} container_name: ${WB_CONTAINER_NAME:-funkwhale-web} restart: ${WB_RESTART:-unless-stopped} + networks: + - default + - main-webservices depends_on: - api volumes: - "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro" - "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro" - - "${MUSIC_DIRECTORY_SERVE_PATH}:/srv/wwww/music:ro" - - "${MEDIA_ROOT}:/srv/wwww/media:ro" - - "${STATIC_ROOT}:/srv/wwww/static:ro" - - "${FUNKWHALE_FRONTEND_PATH}:/srv/wwww/frontend:ro" + - "${HOST_MUSIC_DIRECTORY_SERVE_PATH}:/srv/wwww/music:ro" + - "${HOST_MEDIA_ROOT}:/srv/wwww/media:ro" + - "${HOST_STATIC_ROOT}:/srv/wwww/static:ro" + - "${HOST_FUNKWHALE_FRONTEND_PATH}:/srv/wwww/frontend:ro" expose: - 80 env_file: @@ -98,7 +104,9 @@ services: && cat /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" -networks: +networks: default: + internal: true + main-webservices: external: name: ${NETWORK}