diff --git a/api/compose/django/entrypoint.sh b/api/compose/django/entrypoint.sh index 7e789968ba601f901bd73ca56a2728af1abd1d2d..ac85f1164320d4a5f18c542a6aa44e0c4ef9511e 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 bff43b233481b45a91c1e2ff53d1e235c6743838..d27857b076475377b2605e196f00c1141705427a 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 e6292812e0470156da0f131e735e9ab64c2a9c17..69d5e17214e09b01b5d9d262f088e7d8508ae21b 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 037dc4651aae2cace9375b34c563691d572cd984..a8b4f7769ab4b1b5b0938843569551eb5da53a22 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 0027a80ab8e73802f9efa3e2b4febf792052b1bc..53d3a104bfaab54c4bb96569ac673f2540c62af7 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 2a25c2a1b70a4e58a68834dc626b38ebc23a426b..cb3c883070f13ec0052694a27d34719f908791e3 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 0000000000000000000000000000000000000000..5883a2d17e6d99ba5c34e0a6693e7a8537b34942 --- /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 ca6504b52ba6293f7a88947c8d7073740d3d590f..17e9fe7f0b699cc427c71cac4597708b5a311e31 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 fa0908545611d67b4321bd19dbda01bb060f0dff..6641bef000081bbc639dd4113815c7e6d1814de2 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) -------------------