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 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 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/env.prod.sample b/deploy/env.prod.sample index 037dc4651..a8b4f7769 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 @@ -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 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 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 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 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) -------------------