Triggered by @lclaude in Feature request: Funkwhale, federated music streaming, here are install instructions for Funkwhale, a free and decentralized audio platform.
You need a domain (example.com
is used here) pointing to your Nethserver with a valid cert (for instance letsencrypt).
# get nux repo for ffmpeg
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
# install dependencies
yum -y install nethserver-postgresql94 nethserver-redis curl gcc python3-pip git unzip ffmpeg make curl file ffmpeg libjpeg-turbo libpqxx python-devel openldap-devel rh-postgresql94-postgresql-contrib python3-devel mod_xsendfile
# add funkwhale service user
useradd -r -s /usr/sbin/nologin -d /srv/funkwhale -m funkwhale
chmod 755 /srv/funkwhale
You may change the password âSECRETâ of the postgresql user funkwhale to a more secure one:
# create db, user and extensions
su - postgres -c 'scl enable rh-postgresql94 -- psql -p 55432'
create database funkwhale with template = template0 encoding 'utf8';
create user funkwhale with encrypted password 'SECRET';
grant all privileges on database funkwhale to funkwhale;
\c funkwhale
CREATE EXTENSION unaccent;
CREATE EXTENSION citext;
\q
# get service files
curl -L -o "/etc/systemd/system/funkwhale.target" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/0.20.1/deploy/funkwhale.target"
curl -L -o "/etc/systemd/system/funkwhale-server.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/0.20.1/deploy/funkwhale-server.service"
curl -L -o "/etc/systemd/system/funkwhale-worker.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/0.20.1/deploy/funkwhale-worker.service"
curl -L -o "/etc/systemd/system/funkwhale-beat.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/0.20.1/deploy/funkwhale-beat.service"
# download funkwhale apache config
curl -L -o /etc/httpd/conf.d/zzz_funkwhale.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/0.20.1/deploy/apache.conf"
Edit example.com
to match your domain.
sed -i 's!Define funkwhale-sn funkwhale.yourdomain.com!Define funkwhale-sn example.com!' /etc/httpd/conf.d/zzz_funkwhale.conf
# add letsencrypt exception
sed -i '12 i\
<VirtualHost *:80>\
ServerName ${funkwhale-sn}\
RedirectMatch 301 ^(?!/\\.well-known/acme-challenge/).* https://${funkwhale-sn}\
</VirtualHost>\
' /etc/httpd/conf.d/zzz_funkwhale.conf
# comment out wrong log path
sed -i '38,39 s/^ /# /' /etc/httpd/conf.d/zzz_funkwhale.conf
# comment out wrong cert paths
sed -i '49,51 s/^ /# /' /etc/httpd/conf.d/zzz_funkwhale.conf
# work as user funkwhale from now on
sudo -u funkwhale -H bash
cd /srv/funkwhale
# Create dirs
mkdir -p config api data/static data/media data/music front
# get funkwhale api
curl -L -o "api-0.20.1.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.20.1/download?job=build_api"
unzip "api-0.20.1.zip" -d extracted
mv extracted/api/* api/
rm -rf extracted
# Get frontend
curl -L -o "front-0.20.1.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.20.1/download?job=build_front"
unzip "front-0.20.1.zip" -d extracted
mv extracted/front/dist front/
rm -rf extracted
# Create virtual environment
python3 -m venv /srv/funkwhale/virtualenv
# Use venv
source /srv/funkwhale/virtualenv/bin/activate
# get python dependencies
pip install wheel service_identity
pip install -r api/requirements.txt
# get environment file
curl -L -o config/.env "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/master/deploy/env.prod.sample"
# secure config file
chmod 600 /srv/funkwhale/config/.env
Again you need to edit example.com
:
# edit hostname
sed -i 's!FUNKWHALE_HOSTNAME=yourdomain.funkwhale!FUNKWHALE_HOSTNAME=example.com!' /srv/funkwhale/config/.env
# set proxy type to apache2
sed -i 's!REVERSE_PROXY_TYPE=nginx!REVERSE_PROXY_TYPE=apache2!' /srv/funkwhale/config/.env
# add random django secret key
sed -i 's!DJANGO_SECRET_KEY=$!DJANGO_SECRET_KEY='"$(openssl rand -base64 45)"'!' /srv/funkwhale/config/.env
If you changed the postgresql password you have to edit it here too:
# add postgresql and redis config - the empty line is necessary
cat >> /srv/funkwhale/config/.env <<EOF
DATABASE_URL=postgresql://funkwhale:SECRET@localhost:55432/funkwhale
CACHE_URL=redis://127.0.0.1:6379/0
EOF
# fill DB
python api/manage.py migrate
# create superuser admin
python api/manage.py createsuperuser
Now you are asked for the new superusers name, mail and password:
(virtualenv) [funkwhale@testserver ~]$ python api/manage.py createsuperuser
2019-12-06 21:55:44,866 funkwhale_api.config INFO Loaded env file at /srv/funkwhale/config/.env
2019-12-06 21:55:44,867 funkwhale_api.config INFO Running with no plugins
Username: admin
Email address: mail@example.com
Password:
Password (again):
Superuser created successfully.
Now we create the static files and start the services.
# create static files
python api/manage.py collectstatic
# exit as user funkwhale to be root again
exit
# start and enable services
systemctl daemon-reload
systemctl enable funkwhale-server funkwhale-worker funkwhale-beat
systemctl restart httpd funkwhale.target
Browse to https://<USED_DOMAIN>
and login with the credentials set before.
Funkwhale supports LDAP too:
Sources: