external_dependencies.rst 3.01 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
External dependencies
=====================


.. note::

    Those dependencies are handled automatically if you are
    :doc:`deploying using docker <./docker>`

Database setup (PostgreSQL)
---------------------------

Funkwhale requires a PostgreSQL database to work properly. Please refer
to the `PostgreSQL documentation <https://www.postgresql.org/download/>`_
for installation instructions specific to your os.

Reg's avatar
Reg committed
17
On Debian-like systems, you would install the database server like this:
18
19
20

.. code-block:: shell

Hazmo's avatar
Hazmo committed
21
    sudo apt-get install postgresql postgresql-contrib
22

23
24
25
26
27
28
29
30
On Arch Linux and its derivatives:

.. code-block:: shell

    sudo pacman -S postgresql

On Arch, you'll also need to initialize the database. See `the Arch Linux wiki <https://wiki.archlinux.org/index.php/Postgresql#Initial_configuration>`_.

31
32
33
34
35
36
37
38
39
40
41
42
The remaining steps are heavily inspired from `this Digital Ocean guide <https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04>`_.

Open a database shell:

.. code-block:: shell

    sudo -u postgres psql

Create the project database and user:

.. code-block:: shell

43
    CREATE DATABASE "funkwhale"
44
      WITH ENCODING 'utf8';
45
46
47
    CREATE USER funkwhale;
    GRANT ALL PRIVILEGES ON DATABASE funkwhale TO funkwhale;

48
49
.. warning::

50
    It's important that you use utf-8 encoding for your database,
51
    otherwise you'll end up with errors and crashes later on when dealing
Paul Walko's avatar
Paul Walko committed
52
    with music metadata that contains non-ascii chars.
53

54
55
56
57

Assuming you already have :ref:`created your funkwhale user <create-funkwhale-user>`,
you should now be able to open a postgresql shell:

58
59
60
61
.. code-block:: shell

    sudo -u funkwhale -H psql

62
63
Unless you give a superuser access to the database user, you should also
enable some extensions on your database server, as those are required
Reg's avatar
Reg committed
64
for Funkwhale to work properly:
65
66
67

.. code-block:: shell

68
    sudo -u postgres psql funkwhale -c 'CREATE EXTENSION "unaccent";'
69
    sudo -u postgres psql funkwhale -c 'CREATE EXTENSION "citext";'
70
71


72
73
74
75
76
77
78
79
80
Cache setup (Redis)
-------------------

Funkwhale also requires a cache server:

- To make the whole system faster, by caching network requests or database
  queries
- To handle asynchronous tasks such as music import

Reg's avatar
Reg committed
81
On Debian-like distributions, a redis package is available, and you can
82
83
84
85
86
87
install it:

.. code-block:: shell

    sudo apt-get install redis-server

88
89
90
91
92
93
On Arch Linux and its derivatives:

.. code-block:: shell

    sudo pacman -S redis

94
This should be enough to have your redis server set up.
95
96

External Authentication (LDAP)
97
------------------------------
98

99
LDAP support requires some additional dependencies to enable. On the OS level both ``libldap2-dev`` and ``libsasl2-dev`` are required, and the Python modules ``python-ldap`` and ``python-django-auth-ldap`` must be installed. These dependencies are all included in the ``requirements.*`` files so deploying with those will install these dependencies by default. However, they are not required unless LDAP support is explicitly enabled. See :doc:`./ldap` for more details.