From 20d8daa11532805538dac36b3df9c467435812e6 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 13:15:53 +0100 Subject: [PATCH 1/8] More generic entrypoint to work with non-compose setups --- api/compose/django/entrypoint.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/api/compose/django/entrypoint.sh b/api/compose/django/entrypoint.sh index 7e789968b..ac85f1164 100755 --- a/api/compose/django/entrypoint.sh +++ b/api/compose/django/entrypoint.sh @@ -4,16 +4,19 @@ set -e # Since docker-compose relies heavily on environment variables itself for configuration, we'd have to define multiple # environment variables just to support cookiecutter out of the box. That makes no sense, so this little entrypoint # does all this for us. -export CACHE_URL=redis://redis:6379/0 +export CACHE_URL=${CACHE_URL:="redis://redis:6379/0"} -# the official postgres image uses 'postgres' as default user if not set explictly. -if [ -z "$POSTGRES_ENV_POSTGRES_USER" ]; then +if [ -z "$DATABASE_URL" ]; then + # the official postgres image uses 'postgres' as default user if not set explictly. + if [ -z "$POSTGRES_ENV_POSTGRES_USER" ]; then export POSTGRES_ENV_POSTGRES_USER=postgres + fi + export DATABASE_URL=postgres://$POSTGRES_ENV_POSTGRES_USER:$POSTGRES_ENV_POSTGRES_PASSWORD@postgres:5432/$POSTGRES_ENV_POSTGRES_USER fi -export DATABASE_URL=postgres://$POSTGRES_ENV_POSTGRES_USER:$POSTGRES_ENV_POSTGRES_PASSWORD@postgres:5432/$POSTGRES_ENV_POSTGRES_USER - -export CELERY_BROKER_URL=$CACHE_URL +if [ -z "$CELERY_BROKER_URL" ]; then + export CELERY_BROKER_URL=$CACHE_URL +fi # we copy the frontend files, if any so we can serve them from the outside if [ -d "frontend" ]; then From 66802d50b8f904aa9b96fd4b45020e72a6d38d26 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 13:38:42 +0100 Subject: [PATCH 2/8] Updated incorrect celery commands --- deploy/docker-compose.yml | 2 +- deploy/funkwhale-worker.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index e6292812e..69d5e1721 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -20,7 +20,7 @@ services: restart: unless-stopped image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest} env_file: .env - command: python manage.py celery worker + command: celery -A funkwhale_api.taskapp worker -l INFO links: - postgres - redis diff --git a/deploy/funkwhale-worker.service b/deploy/funkwhale-worker.service index 2a25c2a1b..cb3c88307 100644 --- a/deploy/funkwhale-worker.service +++ b/deploy/funkwhale-worker.service @@ -8,7 +8,7 @@ User=funkwhale # adapt this depending on the path of your funkwhale installation WorkingDirectory=/srv/funkwhale/api EnvironmentFile=/srv/funkwhale/config/.env -ExecStart=/srv/funkwhale/virtualenv/bin/python manage.py celery worker +ExecStart=/srv/funkwhale/virtualenv/bin/celery -A funkwhale_api.taskapp worker -l INFO [Install] WantedBy=multi-user.target From 2167c1731ce50522551cf49c05c4d8c18f3b91e4 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 17:44:53 +0100 Subject: [PATCH 3/8] Removed duplicate variable --- api/config/settings/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/config/settings/common.py b/api/config/settings/common.py index bff43b233..d27857b07 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -310,7 +310,7 @@ CELERY_BROKER_URL = env( "CELERY_BROKER_URL", default=env('CACHE_URL', default=CACHE_DEFAULT)) ########## END CELERY # Location of root django.contrib.admin URL, use {% url 'admin:index' %} -ADMIN_URL = r'^admin/' + # Your common stuff: Below this line define 3rd party library settings CELERY_TASK_DEFAULT_RATE_LIMIT = 1 CELERY_TASK_TIME_LIMIT = 300 From 27e53aba5bbc26efd6275550aa268e02ec876937 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 17:45:03 +0100 Subject: [PATCH 4/8] Fixed typo in env file --- deploy/env.prod.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/env.prod.sample b/deploy/env.prod.sample index 037dc4651..e1a381b94 100644 --- a/deploy/env.prod.sample +++ b/deploy/env.prod.sample @@ -31,7 +31,7 @@ FUNKWHALE_API_PORT=5000 # Replace this by the definitive, public domain you will use for # your instance -FUNKWHALE_URL=https.//yourdomain.funwhale +FUNKWHALE_URL=https://yourdomain.funwhale # API/Django configuration From be38dc9b9f08c826db14726cc9eb4549db84f002 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 17:45:13 +0100 Subject: [PATCH 5/8] Disable cachalot by default --- deploy/env.prod.sample | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/env.prod.sample b/deploy/env.prod.sample index e1a381b94..a8b4f7769 100644 --- a/deploy/env.prod.sample +++ b/deploy/env.prod.sample @@ -84,3 +84,6 @@ API_AUTHENTICATION_REQUIRED=True # This will help us detect and correct bugs RAVEN_ENABLED=false RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:0062dc16a22b41679cd5765e5342f716@sentry.eliotberriot.com/5 + +# This setting will soon become useless +CACHALOT_ENABLED=False From 472aa87838bda49c259f5664ea025b92166ae1f2 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 17:56:47 +0100 Subject: [PATCH 6/8] Added documentation to manually enable required extensions --- docs/installation/external_dependencies.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/installation/external_dependencies.rst b/docs/installation/external_dependencies.rst index fa0908545..6641bef00 100644 --- a/docs/installation/external_dependencies.rst +++ b/docs/installation/external_dependencies.rst @@ -43,6 +43,15 @@ you should now be able to open a postgresql shell: sudo -u funkwhale -H psql +Unless you give a superuser access to the database user, you should also +enable some extensions on your database server, as those are required +for funkwhale to work properly: + +.. code-block:: shell + + sudo -u postgres psql -c 'CREATE EXTENSION "unaccent";'' + + Cache setup (Redis) ------------------- From b277b16fadc9d0b04045711cee94073efa1355c6 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 18:45:25 +0100 Subject: [PATCH 7/8] Fixed wrong virtualenv path in unit file --- deploy/funkwhale-server.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/funkwhale-server.service b/deploy/funkwhale-server.service index 0027a80ab..53d3a104b 100644 --- a/deploy/funkwhale-server.service +++ b/deploy/funkwhale-server.service @@ -8,7 +8,7 @@ User=funkwhale # adapt this depending on the path of your funkwhale installation WorkingDirectory=/srv/funkwhale/api EnvironmentFile=/srv/funkwhale/config/.env -ExecStart=/usr/local/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application +ExecStart=/srv/funkwhale/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application [Install] WantedBy=multi-user.target From 968423a6f87916c171475fa80cc62b51f538b5e8 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 6 Mar 2018 18:47:30 +0100 Subject: [PATCH 8/8] Added a new doc page about instance configuration --- docs/configuration.rst | 35 +++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 2 files changed, 36 insertions(+) create mode 100644 docs/configuration.rst diff --git a/docs/configuration.rst b/docs/configuration.rst new file mode 100644 index 000000000..5883a2d17 --- /dev/null +++ b/docs/configuration.rst @@ -0,0 +1,35 @@ +Instance configuration +====================== + +General configuration is achieved using two type of settings. + +Environment variables +--------------------- + +Those are located in your ``.env`` file, which you should have created +during installation. + +Options from this file are heavily commented, and usually target lower level +and technical aspects of your instance, such as database credentials. + +.. note:: + + You should restart all funwhale processes when you change the values + on environment variables. + + +Instance settings +----------------- + +Those settings are stored in database and do not require a restart of your +instance after modification. They typically relate to higher level configuration, +such your instance description, signup policy and so on. + +There is no polished interface for those settings, yet, but you can view update +them using the administration interface provided by Django (the framework funkwhale is built on). + +The URL should be ``/api/admin/dynamic_preferences/globalpreferencemodel/`` (prepend your domain in front of it, of course). + +If you plan to use acoustid and external imports +(e.g. with the youtube backends), you should edit the corresponding +settings in this interface. diff --git a/docs/index.rst b/docs/index.rst index ca6504b52..17e9fe7f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,6 +13,7 @@ Funkwhale is a self-hosted, modern free and open-source music server, heavily in features installation/index + configuration importing-music changelog