diff --git a/.env.example b/.env.example index b59794d..1a1a259 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,10 @@ # Global Settings TZ=Etc/UTC LOCAL_STACK_DIR=/srv/docker/volumes/funkwhale +# 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) FUNKWHALE_VERSION= @@ -20,6 +24,12 @@ RD_TAG= RD_CONTAINER_NAME= RD_RESTART= +# nginx (optional) +WB_IMG= +WB_TAG= +WB_CONTAINER_NAME= +WB_RESTART= + CELERYD_CONCURRENCY= diff --git a/all.env.example b/all.env.example index 0c0d58a..b26abfc 100644 --- a/all.env.example +++ b/all.env.example @@ -37,10 +37,7 @@ FUNKWHALE_API_PORT=5000 # 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=1 -# 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=msubdomain.domain.tld + FUNKWHALE_PROTOCOL=https # Configure email sending using this variale diff --git a/docker-compose.yml b/docker-compose.yml index 4366b68..97f9b43 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,11 +28,12 @@ services: - postgres - redis volumes: - - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/docker/volumes/funkwhale/media/import_music}:${MUSIC_DIRECTORY_PATH-/music}:ro" + - "${MUSIC_DIRECTORY_SERVE_PATH}:/music:ro" - "${MEDIA_ROOT}:${MEDIA_ROOT}" env_file: all.env environment: - - C_FORCE_ROOT=true + - C_FORCE_ROOT=true + - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} # 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 @@ -50,6 +51,8 @@ services: - postgres - redis env_file: all.env + environment: + - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO api: @@ -59,31 +62,35 @@ services: - postgres - redis volumes: - - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/docker/volumes/funkwhale/media/import_music}:${MUSIC_DIRECTORY_PATH-/music}:ro" + - "${MUSIC_DIRECTORY_SERVE_PATH}:/music:ro" - "${MEDIA_ROOT}:${MEDIA_ROOT}" - "${STATIC_ROOT}:${STATIC_ROOT}" - "${FUNKWHALE_FRONTEND_PATH}:/frontend" expose: - 5000 env_file: all.env + environment: + - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} nginx: - image: nginx - restart: unless-stopped + image: ${WB_IMG:-nginx}:${WB_TAG:-latest} + container_name: ${WB_CONTAINER_NAME:-funkwhale-web} + restart: ${WB_RESTART:-unless-stopped} 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/docker/volumes/funkwhale/media/import_music}:${MUSIC_DIRECTORY_SERVE_PATH-/srv/docker/volumes/funkwhale/media/import_music}:ro" - - "${MEDIA_ROOT}:${MEDIA_ROOT}:ro" - - "${STATIC_ROOT}:${STATIC_ROOT}:ro" - - "${FUNKWHALE_FRONTEND_PATH}:/frontend: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" expose: - 80 env_file: - - all.env - nginx.env + environment: + - FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME} command: > sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\" < /etc/nginx/conf.d/funkwhale.template diff --git a/nginx/funkwhale.template b/nginx/funkwhale.template index b5f01ea..a06cebc 100644 --- a/nginx/funkwhale.template +++ b/nginx/funkwhale.template @@ -21,7 +21,7 @@ server { # have a look here for let's encrypt configuration: # https://certbot.eff.org/all-instructions/#debian-9-stretch-nginx - root /frontend; + root /srv/wwww/frontend; # If you are using S3 to host your files, remember to add your S3 URL to the # media-src and img-src headers (e.g. img-src 'self' https:// data:) @@ -42,7 +42,7 @@ server { add_header Referrer-Policy "strict-origin-when-cross-origin"; add_header Service-Worker-Allowed "/"; add_header X-Frame-Options "ALLOW"; - alias /frontend/; + alias /srv/wwww/frontend/; expires 30d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; @@ -53,7 +53,7 @@ server { add_header Referrer-Policy "strict-origin-when-cross-origin"; add_header X-Frame-Options "ALLOW"; - alias /frontend/embed.html; + alias /srv/wwww/frontend/embed.html; expires 30d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; @@ -76,7 +76,7 @@ server { } location /media/ { - alias ${MEDIA_ROOT}/; + alias /srv/wwww/media/; } # this is an internal location that is used to serve @@ -84,7 +84,7 @@ server { # has been checked on API side location /_protected/media { internal; - alias ${MEDIA_ROOT}; + alias /srv/wwww/media; } # Comment the previous location and uncomment this one if you're storing @@ -102,11 +102,11 @@ server { # has been checked on API side # Set this to the same value as your MUSIC_DIRECTORY_PATH setting internal; - alias ${MUSIC_DIRECTORY_PATH}; + alias /srv/wwww/music; } location /staticfiles/ { # django static files - alias ${STATIC_ROOT}/; + alias /srv/wwww/static/; } }