Merge branch 'fixed-entrypoint' into 'develop'

More generic entrypoint to work with non-compose setups

See merge request funkwhale/funkwhale!78
merge-requests/154/head
Eliot Berriot 2018-03-06 18:32:55 +00:00
commit 55a93c71e3
9 zmienionych plików z 62 dodań i 11 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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.

Wyświetl plik

@ -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

Wyświetl plik

@ -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)
-------------------