Fix #350: saner defaults for STATIC_ROOT and MEDIA_ROOT in .env
This commit is contained in:
parent
03eb2be2b8
commit
28a30ac40c
|
@ -0,0 +1,51 @@
|
||||||
|
Ensure we have sane defaults for MEDIA_ROOT, STATIC_ROOT and MUSIC_DIRECTORY_PATH
|
||||||
|
in the deployment .env file (#350)
|
||||||
|
|
||||||
|
Ensure MEDIA_ROOT, STATIC_ROOT and MUSIC_DIRECTORY_* are set explicitely
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
In our default .env file, MEDIA_ROOT and STATIC_ROOT were commented by default, causing
|
||||||
|
some deployment issues on non-docker setups when people forgot to uncomment them.
|
||||||
|
|
||||||
|
From now on, those variables are uncommented, and will also be used on docker setups
|
||||||
|
to mount the volumes automatically in the docker-compose.yml file. This has been a source
|
||||||
|
of headache as well in some deployments, where you had to update both the .env file and
|
||||||
|
the compose file.
|
||||||
|
|
||||||
|
This also applies to in-place paths (MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH),
|
||||||
|
whose values are now used directly to set up the proper Docker volumes.
|
||||||
|
|
||||||
|
This will only affect new deployments though. If you want to benefit from this on an
|
||||||
|
existing instance, do a backup of your ``.env`` and ``docker-compose.yml`` files and apply the following changes:
|
||||||
|
|
||||||
|
- Ensure ``MEDIA_ROOT`` is uncommented in your .env file and match the absolute path where media files are stored
|
||||||
|
on your host (``/srv/funkwhale/data/media`` by default)
|
||||||
|
- Ensure ``STATIC_ROOT`` is uncommented in your .env file and match the absolute path where static files are stored
|
||||||
|
on your host (``/srv/funkwhale/data/static`` by default)
|
||||||
|
- If you use in-place import:
|
||||||
|
- Ensure MUSIC_DIRECTORY_PATH is uncommented and set to ``/music``
|
||||||
|
- Ensure MUSIC_DIRECTORY_SERVE_PATH is uncommented and set to the absolute path on your host were your music files
|
||||||
|
are stored (``/srv/funkwhale/data/music`` by default)
|
||||||
|
- Edit your docker-compose.yml file to reflect the changes:
|
||||||
|
- Search for volumes (there should be two occurences) that contains ``/app/funkwhale_api/media`` on the right side, and
|
||||||
|
replace the whole line with ``- "${MEDIA_ROOT}:${MEDIA_ROOT}"``
|
||||||
|
- Search for a volume that contains ``/app/staticfiles`` on the right side, and
|
||||||
|
replace the whole line with ``- "${STATIC_ROOT}:${STATIC_ROOT}"``
|
||||||
|
- If you use in-place import, search for volumes (there should be two occurences) that contains ``/music:ro`` on the right side, and
|
||||||
|
replace the whole line with ``- "${MUSIC_DIRECTORY_SERVE_PATH}:${MUSIC_DIRECTORY_PATH}:ro"``
|
||||||
|
|
||||||
|
In the end, the ``volumes`` directives of your containers should look like that::
|
||||||
|
|
||||||
|
...
|
||||||
|
celeryworker
|
||||||
|
volumes:
|
||||||
|
- "${MUSIC_DIRECTORY_SERVE_PATH}:${MUSIC_DIRECTORY_PATH}:ro"
|
||||||
|
- "${MEDIA_ROOT}:${MEDIA_ROOT}"
|
||||||
|
...
|
||||||
|
api:
|
||||||
|
volumes:
|
||||||
|
- "${MUSIC_DIRECTORY_SERVE_PATH}:${MUSIC_DIRECTORY_PATH}:ro"
|
||||||
|
- "${MEDIA_ROOT}:${MEDIA_ROOT}"
|
||||||
|
- "${STATIC_ROOT}:${STATIC_ROOT}"
|
||||||
|
- ./front/dist:/frontend
|
||||||
|
...
|
|
@ -35,8 +35,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- C_FORCE_ROOT=true
|
- C_FORCE_ROOT=true
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/music:/music:ro
|
- "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
|
||||||
- ./data/media:/app/funkwhale_api/media
|
- "${MEDIA_ROOT}:${MEDIA_ROOT}"
|
||||||
|
|
||||||
celerybeat:
|
celerybeat:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -52,9 +52,9 @@ services:
|
||||||
image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
|
image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/music:/music:ro
|
- "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
|
||||||
- ./data/media:/app/funkwhale_api/media
|
- "${MEDIA_ROOT}:${MEDIA_ROOT}"
|
||||||
- ./data/static:/app/staticfiles
|
- "${STATIC_ROOT}:${STATIC_ROOT}"
|
||||||
- ./front/dist:/frontend
|
- ./front/dist:/frontend
|
||||||
ports:
|
ports:
|
||||||
- "${FUNKWHALE_API_IP:-127.0.0.1}:${FUNKWHALE_API_PORT:-5000}:5000"
|
- "${FUNKWHALE_API_IP:-127.0.0.1}:${FUNKWHALE_API_PORT:-5000}:5000"
|
||||||
|
|
|
@ -10,14 +10,13 @@
|
||||||
# On non-docker setup **only**, you'll also have to tweak/uncomment those variables:
|
# On non-docker setup **only**, you'll also have to tweak/uncomment those variables:
|
||||||
# - DATABASE_URL
|
# - DATABASE_URL
|
||||||
# - CACHE_URL
|
# - CACHE_URL
|
||||||
# - STATIC_ROOT
|
|
||||||
# - MEDIA_ROOT
|
|
||||||
#
|
#
|
||||||
# You **don't** need to update those variables on pure docker setups.
|
# You **don't** need to update those variables on pure docker setups.
|
||||||
#
|
#
|
||||||
# Additional options you may want to check:
|
# Additional options you may want to check:
|
||||||
# - MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH if you plan to use
|
# - MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH if you plan to use
|
||||||
# in-place import
|
# in-place import
|
||||||
|
#
|
||||||
# Docker only
|
# Docker only
|
||||||
# -----------
|
# -----------
|
||||||
|
|
||||||
|
@ -25,7 +24,6 @@
|
||||||
# (it will be interpolated in docker-compose file)
|
# (it will be interpolated in docker-compose file)
|
||||||
# You can comment or ignore this if you're not using docker
|
# You can comment or ignore this if you're not using docker
|
||||||
FUNKWHALE_VERSION=latest
|
FUNKWHALE_VERSION=latest
|
||||||
MUSIC_DIRECTORY_PATH=/music
|
|
||||||
|
|
||||||
# End of Docker-only configuration
|
# End of Docker-only configuration
|
||||||
|
|
||||||
|
@ -79,12 +77,12 @@ REVERSE_PROXY_TYPE=nginx
|
||||||
# Where media files (such as album covers or audio tracks) should be stored
|
# Where media files (such as album covers or audio tracks) should be stored
|
||||||
# on your system?
|
# on your system?
|
||||||
# (Ensure this directory actually exists)
|
# (Ensure this directory actually exists)
|
||||||
# MEDIA_ROOT=/srv/funkwhale/data/media
|
MEDIA_ROOT=/srv/funkwhale/data/media
|
||||||
|
|
||||||
# Where static files (such as API css or icons) should be compiled
|
# Where static files (such as API css or icons) should be compiled
|
||||||
# on your system?
|
# on your system?
|
||||||
# (Ensure this directory actually exists)
|
# (Ensure this directory actually exists)
|
||||||
# STATIC_ROOT=/srv/funkwhale/data/static
|
STATIC_ROOT=/srv/funkwhale/data/static
|
||||||
|
|
||||||
# Update it to match the domain that will be used to reach your funkwhale
|
# Update it to match the domain that will be used to reach your funkwhale
|
||||||
# instance
|
# instance
|
||||||
|
@ -112,5 +110,9 @@ RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:0062dc16a22b41679cd5765e5342f
|
||||||
# In-place import settings
|
# In-place import settings
|
||||||
# You can safely leave those settings uncommented if you don't plan to use
|
# You can safely leave those settings uncommented if you don't plan to use
|
||||||
# in place imports.
|
# in place imports.
|
||||||
# MUSIC_DIRECTORY_PATH=
|
# Typical docker setup:
|
||||||
# MUSIC_DIRECTORY_SERVE_PATH= # docker-only
|
# MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
|
||||||
|
# MUSIC_DIRECTORY_SERVE_PATH=/music # docker-only
|
||||||
|
# Typical non-docker setup:
|
||||||
|
# MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
|
||||||
|
# # MUSIC_DIRECTORY_SERVE_PATH= # stays commented, not needed
|
||||||
|
|
Loading…
Reference in New Issue