hey, hope this helps, those are my sanitized notes on FW. based on mrmarkuz original notes, tweaked for FW 1.2 and python 3.8 , have not updated to postgres 13 yet. greetings, phil
LINKS
PKG
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-postgresql12 nethserver-redis curl gcc python3-pip git unzip ffmpeg make curl file ffmpeg libjpeg-turbo libpqxx python-devel openldap-devel rh-postgresql12-postgresql-contrib python3-devel mod_xsendfile nethserver-rh-python38.noarch rh-postgresql12-postgresql-devel postgresql-devel rh-python38-python-devel
add funkwhale service user
useradd -r -s /usr/sbin/nologin -d /srv/funkwhale -m funkwhale
chmod 755 /srv/funkwhale
CREATE DB, user and extensions
- edit SECRET
su - postgres -c ‘scl enable rh-postgresql12 – psql -p 55434’
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
DROP DB
su - postgres -c ‘scl enable rh-postgresql12 – psql -p 55434’
DROP DATABASE funkwhale;
DROP USER IF EXISTS funkwhale;
\du
\list
BACKUP DB
su - postgres -c ‘scl enable rh-postgresql12 – pg_dump -p 55434 funkwhale > /tmp/funkwhale20220116.sql’
cp /tmp/funkwhale20220116.sql /mnt/tank/system/backup/nethserver/FW/
RESTORE DB
su - postgres -c ‘scl enable rh-postgresql12 – pg_restore -p 55434 -d funkwhale > /tmp/funkwhale20220116.sql’
get service files
curl -L -o "/etc/systemd/system/funkwhale.target" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/blob/stable/deploy/funkwhale.target"
curl -L -o "/etc/systemd/system/funkwhale-server.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/blob/stable/deploy/funkwhale-server.service"
curl -L -o "/etc/systemd/system/funkwhale-worker.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/blob/stable/deploy/funkwhale-worker.service"
curl -L -o "/etc/systemd/system/funkwhale-beat.service" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/blob/stable/deploy/funkwhale-beat.service"
APACHE
download funkwhale apache config
curl -L -o /etc/httpd/conf.d/zzz_funkwhale.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/-/blob/stable/deploy/apache.conf"
modify
# Following variables MUST be modified according to your setup
Define funkwhale-sn your.funkwhale.domain.com
# Following variables should be modified according to your setup and if you
# use different configuration than what is described in our installation guide.
Define funkwhale-api http://localhost:5000
Define funkwhale-api-ws ws://localhost:5000
Define FUNKWHALE_ROOT_PATH /srv/funkwhale
Define MUSIC_DIRECTORY_PATH ${FUNKWHALE_ROOT_PATH}/data/music
Define MEDIA_DIRECTORY_PATH ${FUNKWHALE_ROOT_PATH}/data/media
<VirtualHost *:80>
ServerName ${funkwhale-sn}
RedirectMatch 301 ^(?!/.well-known/acme-challenge/).* https://${funkwhale-sn}
</VirtualHost>
# HTTP requests redirected to HTTPS
<VirtualHost *:80>
ServerName ${funkwhale-sn}
# Default is to force https
RewriteEngine on
RewriteCond %{SERVER_NAME} =${funkwhale-sn}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
<Location "/.well-known/acme-challenge/">
Options None
Require all granted
</Location>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName ${funkwhale-sn}
# Path to ErrorLog and access log
ErrorLog /var/log/funkwhale/error.log
CustomLog /var/log/funkwhale/access.log combined
#Header always set Service-Worker-Allowed "/"
# TLS
# Feel free to use your own configuration for SSL here or simply remove the
# lines and move the configuration to the previous server block if you
# don't want to run funkwhale behind https (this is not recommended)
# have a look here for let's encrypt configuration:
# https://certbot.eff.org/lets-encrypt/debianstretch-apache.html
SSLEngine on
SSLProxyEngine On
# SSLCertificateFile /etc/letsencrypt/live/${funkwhale-sn}/fullchain.pem
# SSLCertificateKeyFile /etc/letsencrypt/live/${funkwhale-sn}/privkey.pem
# Include /etc/letsencrypt/options-ssl-apache.conf
LOGIN AS USER FW
sudo -u funkwhale -H bash
GET FW PKG
create dir
cd /srv/funkwhale
mkdir -p config api data/static data/media data/music front
get funkwhale api (stable branch)
curl -L -o "build_api.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/stable/download?job=build_api"
unzip "build_api.zip" -d extracted
mv extracted/api/* api/
rm -rf extracted
get frontend
curl -L -o "build_front.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/stable/download?job=build_front"
unzip "build_front.zip" -d extracted
mv extracted/front/dist front/
rm -rf extracted
PYTHON
enable python 3.8
scl enable rh-python38 bash
create virtual environment
python3.8 -m venv /srv/funkwhale/virtualenv
USE ENV
source /srv/funkwhale/virtualenv/bin/activate
check python version
python3 -V
get python dependencies
pip install wheel service_identity uvloop httptools
pip install -r api/requirements.txt
ENV
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
edit hostname
sed -i ‘s!FUNKWHALE_HOSTNAME=yourdomain.funkwhale!FUNKWHALE_HOSTNAME=your.funkwhale.domain.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
MOD for 1.0
- uncomment CELERYD_CONCURRENCY
POSTGRES
add postgresql and redis config - the empty line is necessary
- edit SECRET
cat >> /srv/funkwhale/config/.env <<EOF
DATABASE_URL=postgresql://funkwhale:SECRET@localhost:55434/funkwhale
CACHE_URL=redis://127.0.0.1:6379/0
EOF
HTTP proxy test
vi /etc/httpd/conf.d/zzz_funkwhale.conf
# strip the X-Forwarded-Proto header from incoming requests
RequestHeader unset X-Forwarded-Proto
# set the header for requests using HTTPS
RequestHeader set X-Forwarded-Proto https env=HTTPS
fill DB
python api/manage.py migrate
create superuser admin
python api/manage.py createsuperuser
create static files
python api/manage.py collectstatic
exit as user funkwhale to be root again
exit
SERVICES
systemctl daemon-reload
systemctl enable funkwhale-server funkwhale-worker funkwhale-beat
systemctl restart httpd funkwhale-*
systemctl status funkwhale-* httpd
systemctl stop funkwhale-*
launch
your.funkwhale.domain.com
USER CREATION
user help
python api/manage.py fw users --help
create user
sudo -u funkwhale -H bash
cd /srv/funkwhale
source /srv/funkwhale/virtualenv/bin/activate
interactive create
python api/manage.py fw users create
make user a staff memeber
python api/manage.py fw users set --staff --superuser yourusername
Managment Commands
import help
python api/manage.py import_files --help
ENV
sudo -u funkwhale -H bash
cd /srv/funkwhale
source /srv/funkwhale/virtualenv/bin/activate
symlink audio directory
ln -s /mnt/your/audio/location /srv/funkwhale/data/music/audio_raid
IMPORT
import in place example
-
you will find the id on the page where you created the library
export LIBRARY_ID=“b3f91384”
python api/manage.py import_files $LIBRARY_ID “/srv/funkwhale/data/music/audio_raid/Blues” --recursive --noinput --in-place
VARIOUS MANAGE COMMANDS
-
remove obsolte files from db
python api/manage.py check_inplace_files --no-dry-run
-
prune db entries that is not tied to a file
python api/manage.py prune_library --tracks --albums --artists --no-dry-run
-
Associate tags that are found on all tracks to the corresponding artist or album
python api/manage.py fw artists add-tags-from-tracks
UPDATE FW
stop
systemctl stop funkwhale-\*
user
sudo -u funkwhale -H bash
cd /srv/funkwhale
move
rm -rf *_bak
mv api api_bak
mv front front_bak
mv data/static data/static_bak
mv virtualenv virtualenv_bak
mkdir -p api front
get pkg
curl -L -o "build_api.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/stable/download?job=build_api"
unzip "build_api.zip" -d extracted
mv extracted/api/* api/
rm -rf extracted
get frontend
curl -L -o "build_front.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/stable/download?job=build_front"
unzip "build_front.zip" -d extracted
mv extracted/front/dist front/
rm -rf extracted
env
scl enable rh-python38 bash
python3.8 -m venv /srv/funkwhale/virtualenv
source /srv/funkwhale/virtualenv/bin/activate
python
pip install wheel service_identity uvloop httptools
pip install -r api/requirements.txt
python api/manage.py migrate
python api/manage.py collectstatic
exit
exit
systemd
systemctl daemon-reload
systemctl start httpd funkwhale.target
systemctl status funkwhale-*
SYSTEM COMMANDS
journalctl -xn -u funkwhale-server
journalctl -xn -u funkwhale-worker
Reverse proxy: /var/log/httpd/*.log
python3 --version
flsuh redis cache
redis-cli FLUSHALL
django web interface
https://your.funkwhale.domain.com/api/admin
permission apache files
chmod 644 zzz_funkwhale.conf