「Funkwhale」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(他言語へのリンクを追加)
2行目: 2行目:
 
[[Category:音楽]]
 
[[Category:音楽]]
 
[[Category:ウェブアプリケーション]]
 
[[Category:ウェブアプリケーション]]
  +
[[en:Funkwhale]]
 
{{Related articles start}}
 
{{Related articles start}}
 
{{Related|Django}}
 
{{Related|Django}}

2024年1月17日 (水) 04:35時点における版

関連記事

メインドキュメントページ: から引用

Funkwhale is a self-hosted, modern, free and open-source music server, heavily inspired by Grooveshark.

インスタンスは ActivityPub プロトコルで連携できます。

インストール

Funkwhale にはリバースプロキシ ([1]) が必要です。 したがって、nginx または Apache HTTP Server をインストールする必要があります。

また、設定された PostgreSQL データベースと Redis キャッシュサーバーも必要です。 詳細については、Funkwhale#設定 およびそれぞれのページを参照してください。

AUR からのインストール

funkwhaleAUR パッケージを インストール して下さい。

警告: このインストールでは Python virtualenv を使用しないため、すべての Python 依存関係は主に AUR からシステム全体にインストールされます。パッケージのバージョンが上流の要件と異なる場合があり、問題が発生する可能性があります。

手動インストール

[2] にある Arch のインストール手順に従ってください。 これにより、すべてのコンポーネントが /srv/funkwhale にインストールされます。

Docker のインストール

[3] にある Docker のインストール手順に従ってください。

Configuration

The following sections assume that Funkwhale was installed from AUR, for a manual installation the folders should be changed appropriately.

It also assumes that you are using Funkwhale on a local network. See the official documentation for making it accessible outside, especially for the certificates using Certbot.

Host config

Make sure your /etc/hosts file is setup correctly. The Funkwhale server is running on 127.0.0.1 with alias funkwhale.local, but this can be changed.

Your /etc/hosts file should look something like the following,

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost
::1             localhost
127.0.0.1       funkwhale.local

Configure nginx

The upstream template of the Nginx configuration file is provided in /etc/webapps/funkwhale/nginx.template. However, this file contains variables that need to be replaced by their value from the env file (see section #Initialization on how to create this file):

$ set -a && source /srv/funkwhale/config/env && set +a
$ envsubst "`env | awk -F = '{printf \" $%s\", $$1}'`" \
   < /etc/webapps/funkwhale/nginx.conf \
   > /etc/nginx/sites-available/funkwhale.conf

The paths to the certificates should also be modified accordingly.

Then enable the site:

$ ln -s /etc/nginx/sites-available/funkwhale.conf /etc/nginx/sites-enabled/

And start the nginx.service.

Configure apache

ノート: You will need Apache HTTP Server configured to run with Redis, PostgreSQL and Apache TLS support.

A template Apache configuration file is provided in /etc/webapps/funkwhale/apache-funkwhale.conf. It configures the Funkwhale instance to be accessible at https://funkwhale.local.

The folder names should be change to fit your installation. More explanation on which lines need to be modified is provided in [4].

Copy the template to the apache configuration folder,

$ cp /etc/webapps/funkwhale/apache-funkwhale.conf /etc/httpd/conf/extra/funkwhale.conf

Next, edit the Apache HTTP Server configuration file and add the following:

# /etc/httpd/conf/httpd.conf
Include conf/extra/funkwhale.conf

For the changes to be applied, you need to restart httpd.service (Apache) using systemd.

Configure PostgreSQL

Here we follow the official documentation: [5]

Connect to the PostgreSQL command line using the postgres user to create the funkwhale user and the database.

$ sudo -u postgres psql
CREATE DATABASE "funkwhale"
 WITH ENCODING 'utf8';
CREATE USER funkwhale;
GRANT ALL PRIVILEGES ON DATABASE funkwhale TO funkwhale;
\c funkwhale;
CREATE EXTENSION "unaccent";
CREATE EXTENSION "citext";

The last three lines load the unaccent and citext extensions, which are needed for funkwhale to work (citext since version 0.20).

Initialization

Funkwhale user

Funkwhale should be run as the funkwhale user. It is automatically created by the AUR package. If you followed the manual installation, create it with

$ useradd -r -d /srv/funkwhale -m funkwhale -c "Funkwhale music server -s /sbin/nologin"

Create Funkwhale's data folders in /srv/funkwhale, owned by the funkwhale user:

$ mkdir /srv/funkwhale
$ chown funkwhale:funkwhale /srv/funkwhale

Run the following commands as the funkwhale user.

Create sub-folders for api files and storage.

$ sudo -u funkwhale -H bash
[funkwhale]$ cd /srv/funkwhale
[funkwhale]$ mkdir -p api data/static data/media data/music config

To work, Funkwhale needs several environment variables to be present, these should be defined in the environment file /srv/funkwhale/config/env. There is a template at /etc/webapps/funkwhale/env.template, copy and modify it to fit your installation.

[funkwhale]$ cp /etc/webapps/funkwhale/env.template /srv/funkwhale/config/env

The FUNKWHALE_HOSTNAME variable should correspond to the hostname in /etc/hosts. DJANGO_ALLOWED_HOSTS needs also to match the address where the funkwhale instance will be reached. You should generate a unique DJANGO_SECRET_KEY and change the paths accordingly to your installation.

ヒント: As you will need to run several commands as the funkwhale user with the environment variables loaded, you can use the following command-line after logging in:

[funkwhale]$ export $(cat /srv/funkwhale/config/env | grep -v ^# | xargs)

For convenience, you can copy this line to /srv/funkwhale/.bashrc (or whichever shell you are using), so it is loaded automatically everytime you log in to the funkwhale user.

Database setup

Initialize the database before launching the application:

$ sudo -u funkwhale -H bash
[funkwhale]$ python /usr/share/webapps/funkwhale/api/manage.py migrate

Create a superuser for your Funkwhale instance:

[funkwhale]$ python /usr/share/webapps/funkwhale/api/manage.py createsuperuser

Collect the static files for the webapp:

[funkwhale]$ python /usr/share/webapps/funkwhale/api/manage.py collectstatic
ノート: Starting with version 0.21, an alias is provided for /usr/share/webapps/funkwhale/api/manage.py in /usr/bin/funkwhale_manage, so you can instead use:
[funkwhale]$ funkwhale_manage collectstatic

Version upgrade

ノート: Starting with version 0.21, an alias is provided for /usr/share/webapps/funkwhale/api/manage.py in /usr/bin/funkwhale_manage, so you can use:
[funkwhale]$ funkwhale_manage [commands...]

instead of

[funkwhale]$ python /usr/share/webapps/funkwhale/api/manage.py [commands...]

All commands should be entered as funkwhale user. Stop the funkwhale.service before upgrading.

The static files have to be collected again:

[funkwhale]$ funkwhale_manage collectstatic --no-input

Apply database migrations:

[funkwhale]$ funkwhale_manage migrate

To upgrade to version 1.0, the thumbnails quality has been increased from 70 to 95, so all the thumbnails should be regenerated (or set THUMBNAIL_JPEG_RESIZE_QUALITY=70 in the .env file so nothing changes). First delete the __sized__ directory in your MEDIA_ROOT directory, then regenerate the thumbnails,

[funkwhale]$ rm -rf /srv/funkwhale/data/media/__sized__
[funkwhale]$ funkwhale_manage fw media generate-thumbnails

Starting from version 0.20.1, there is a new MUSIC_USE_DENORMALIZATION parameter in the env file set to True (you can set it to False so nothing changes). It is a performance enhancement and to make it work you need to run the following command,

[funkwhale]$ python /usr/share/webapps/funkwhale/api/manage.py rebuild_music_permissions
警告: Check that the apache or nginx configuration file did not change before restarting the service. Consult the official documentation for incompatible changes.
警告: From version 0.20, python-daphneAUR was replaced by uvicorn/gunicorn. The service file was updated not to use python-daphneAUR anymore. This can be changed by editing the funkwhale-server.service file.

Also, the citext extension for postgresql is now needed. It can be loaded with issueing the following command before calling the migrate command:

$ sudo -u postgres psql funkwhale -c 'CREATE EXTENSION "citext";'

After completing all these steps, the funkwhale.service can be started again.

ノート: All the instructions for upgrading are given on the official documentation [6].

Usage

Upstream provides systemd services that are already installed with the AUR package.

To start the instance, just start funkwhale.service.

This starts three services, you can check their status with:

$ systemctl status funkwhale-\*

Troubleshooting

See https://docs.funkwhale.audio/admin/troubleshooting.html

Proxy logs

Apache logs for funkwhale:

$ tail -f /var/log/httpd/funkwhale/error.log