Best way to install FW on a Raspberry Pi?


#1

Hi everyone!

I just found a nice little Raspberry Pi 3, virgin and fresh out of the box… and I want to turn it into a small Funkwhale instance, to start sharing music with my friends.

I’m just wondering, what would be the recommended procedure for installation on such a device? Is it also Docker? I see at least 3 possibilities:

  1. Standard Debian install
  2. Docker
  3. Yunohost

There are a couple active threads here discussing installation issues, and I will be following these conversations closely. But I can’t find much feedback on installing FW using the dedicated Yunohost app (https://yunohost.org)… Has this method been tried and tested on a RP? Or else, should I go for the recommended Docker install, or Debian?

Please keep in mind: Although I am used to Linux/Debian command lines to some extent, and I have experience running my own server through SSH, I’m far from being a mega-geek – so if there is a relatively “smoother” way to install, I would be happy to know what it is :slight_smile:

(I have a tendency to forget to sleep and eat when confronted with a software issue, which is probably unhealthy)

Anyway - I’m conscious that we’re on the forefront of change here, and lots of things still need to be tested “pour essuyer les plâtres” as we say in French… so I’d also be happy to take some time for try & error, step by step, and report on my progress here! As long as Eliot doesn’t feel overwhelmed with support tickets from everyone :smiley:

Let me know your thoughts.

Thanks to all you people who are making this project possible, & let’s push it forward!

Daoyang


#2

Hi there! I’m glad you’re considering installing Funkwhale!

The YunoHost package shoud work, I think @troll is using it, and he may be able to give your feedback.

Otherwise, on a RPI, I’d probably suggest not using Docker and use the classical debian installation, since we’re not yet building an ARM-compatible Docker image.

If you’re ok with spending some time with the install process, I’d say you should go the Debian route, and post the issues your facing here. I’ll help you when I have the time, and it will serve as a great reference for future users wanting to follow the same path :wink:


#3

Hi all,
Currently I use Funkwhale with Yunohost. Big thanks to Jibec for the unofficial package.

the package is in the list of community applications, but you can also install it on yunohost by entering the github link directly.

It works perfectly for me with the current version v.0.17.0 (alpha)
I thank Jibec very much for his work but I don’t know if he will continue to maintain the package in the future, I hope so ^_<

After the installation you can go to the administration interface (Django):
https://funkwhale.yourdomain.tld/api/admin/login/

Your credentials are:
login = your username yunohost
pass = funkwhale

Then you can change your password in the interface for more security.


#4

Troll,

Interesting…Thanks for sharing .


#5

Cool, thanks Eliot! I’ll head down the Debian path in the coming days then, and report on what I find :smile:


#6

So, I started installing FW on my Raspberry Pi, following the official guide.

It all went well, until the Python dependencies…

  Building wheels for collected packages: hiredis
  Running setup.py bdist_wheel for hiredis ... error
  Complete output from command /srv/funkwhale/virtualenv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-t343xj7h/hiredis/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp0y48ljh4pip-wheel- --python-tag cp35:
  /usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for hiredis
  Running setup.py clean for hiredis
Failed to build hiredis
Installing collected packages: pytz, django, django-environ, whitenoise, olefile, Pillow, defusedxml, python3-openid, idna, chardet, certifi, urllib3, requests, oauthlib, requests-oauthlib, django-allauth, psycopg2-binary, redis, django-redis, billiard, vine, amqp, kombu, celery, django-cors-headers, musicbrainzngs, youtube-dl, djangorestframework, PyJWT, djangorestframework-jwt, httplib2, pyasn1, pyasn1-modules, six, rsa, oauth2client, uritemplate, google-api-python-client, python-dateutil, pytzdata, pendulum, persisting-theory, django-versatileimagefield, django-filter, django-rest-auth, beautifulsoup4, Markdown, simplegeneric, ptyprocess, pexpect, ipython-genutils, decorator, traitlets, backcall, pygments, pickleshare, wcwidth, prompt-toolkit, parso, jedi, ipython, mutagen, django-taggit, pymemoize, django-dynamic-preferences, audioread, pyacoustid, raven, python-magic, future, ffmpeg-python, async-timeout, asgiref, txaio, autobahn, PyHamcrest, attrs, constantly, Automat, hyperlink, zope.interface, incremental, twisted, daphne, channels, hiredis, aioredis, msgpack, channels-redis, asn1crypto, pycparser, cffi, cryptography, django-cleanup, python-ldap, django-auth-ldap, requests-http-signature
  Running setup.py install for hiredis ... done
  Running setup.py install for requests-http-signature ... done
Successfully installed Automat-0.7.0 Markdown-2.6.11 Pillow-4.3.0 PyHamcrest-1.9.0 PyJWT-1.6.4 aioredis-1.0.0 amqp-2.3.2 asgiref-2.3.2 asn1crypto-0.24.0 async-timeout-3.0.1 attrs-18.2.0 audioread-2.1.6 autobahn-18.11.2 backcall-0.1.0 beautifulsoup4-4.6.3 billiard-3.5.0.4 celery-4.1.1 certifi-2018.10.15 cffi-1.11.5 channels-2.0.2 channels-redis-2.1.1 chardet-3.0.4 constantly-15.1.0 cryptography-2.4.2 daphne-2.0.4 decorator-4.3.0 defusedxml-0.5.0 django-2.0.9 django-allauth-0.36.0 django-auth-ldap-1.7.0 django-cleanup-2.1.0 django-cors-headers-2.1.0 django-dynamic-preferences-1.5.1 django-environ-0.4.5 django-filter-1.1.0 django-redis-4.5.0 django-rest-auth-0.9.3 django-taggit-0.22.2 django-versatileimagefield-1.9 djangorestframework-3.7.7 djangorestframework-jwt-1.11.0 ffmpeg-python-0.1.10 future-0.17.1 google-api-python-client-1.6.7 hiredis-0.3.0 httplib2-0.12.0 hyperlink-18.0.0 idna-2.7 incremental-17.5.0 ipython-6.5.0 ipython-genutils-0.2.0 jedi-0.13.1 kombu-4.2.1 msgpack-0.5.6 musicbrainzngs-0.6 mutagen-1.39 oauth2client-3.0.0 oauthlib-2.1.0 olefile-0.46 parso-0.3.1 pendulum-2.0.4 persisting-theory-0.2.1 pexpect-4.6.0 pickleshare-0.7.5 prompt-toolkit-1.0.15 psycopg2-binary-2.7.6.1 ptyprocess-0.6.0 pyacoustid-1.1.5 pyasn1-0.4.4 pyasn1-modules-0.2.2 pycparser-2.19 pygments-2.3.0 pymemoize-1.0.3 python-dateutil-2.7.5 python-ldap-3.1.0 python-magic-0.4.15 python3-openid-3.1.0 pytz-2017.3 pytzdata-2018.7 raven-6.9.0 redis-2.10.6 requests-2.20.1 requests-http-signature-0.0.3 requests-oauthlib-1.0.0 rsa-4.0 simplegeneric-0.8.1 six-1.11.0 traitlets-4.3.2 twisted-18.9.0 txaio-18.8.1 uritemplate-3.0.0 urllib3-1.24.1 vine-1.1.4 wcwidth-0.1.7 whitenoise-3.3.1 youtube-dl-2018.11.23 zope.interface-4.6.0

I didn’t go further than that for now.
Is this a serious issue?


#7

I have used the debian method to install on a rpi3 / raspbian stretch.

The above errors are a problem. Verify each step again. I installed External Dep. first.

Have u installed the External Dependencies ? (redis / postgres) https://docs.funkwhale.audio/installation/external_dependencies.html

When u have completed Debian / External…u also need to setup systemd entries using;

https://docs.funkwhale.audio/installation/systemd.html


#8

Ah! I started installing Postgres, and then suddenly I wasn’t sure if the external dependencies had to be installed first… Or after.
So I didn’t install Redis and LDAP yet. I guess that should be the source of the error.

Should I install these dependencies, then simply go through the Python dependencies install steps one by one again? Or should I clean up/purge any files first?


#9

@daoyang based on the error logs, I think the python dependencies installation actually succeeded (the error likely indicate that you where missing the python3-wheel package, but pip apparently fallbacked to another installation method).

System dependencies should be installed before the Python dependency by the way :slight_smile:


#10

Thanks! I installed system dependencies before the Python ones, no worries :wink:
So I can just go ahead and install the external dependencies, then start configuring FW? No need to worry about Python?


#11

Yep, you can go ahead!


#12

Today’s report… I’m afraid I didn’t make it all that much further :confused:

Within the virtualenv, I downloaded the sample environment file and started editing it.

The comments in that file recommend the following values as database and cache URL, respectively, when following the Debian installation guide:

DATABASE_URL=postgresql://[email protected]:5432/funkwhale
CACHE_URL=redis://127.0.0.1:6379/0

So I just uncommented them. (That was the right thing to do, yes? No need to add anything in front of “:5432”, in the postgres URL?)

Moving on to the “Database Setup” instructions…
I then tried importing the initial database structure, but hit the following error:

(virtualenv) [email protected]:~ $ python api/manage.py migrate

Traceback (most recent call last):

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 273, in get_value

    value = self.ENVIRON[var]

  File "/usr/lib/python3.5/os.py", line 725, in __getitem__

    raise KeyError(key) from None

KeyError: 'FUNKWHALE_URL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "api/manage.py", line 16, in &lt;module&gt;

    django.setup()

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/__init__.py", line 19, in setup

    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__

    self._setup(name)

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup

    self._wrapped = Settings(settings_module)

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import

  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load

  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked

  File "&lt;frozen importlib._bootstrap&gt;", line 673, in _load_unlocked

  File "&lt;frozen importlib._bootstrap_external&gt;", line 673, in exec_module

  File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed

  File "/srv/funkwhale/api/config/settings/production.py", line 14, in &lt;module&gt;

    from .common import *  # noqa

  File "/srv/funkwhale/api/config/settings/common.py", line 44, in &lt;module&gt;

    FUNKWHALE_URL = env("FUNKWHALE_URL")

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 123, in __call__

    return self.get_value(var, cast=cast, default=default, parse_default=parse_default)

  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 277, in get_value

    raise ImproperlyConfigured(error_msg)

django.core.exceptions.ImproperlyConfigured: Set the FUNKWHALE_URL environment variable

So it looks like I need to input my instance’s URL somewhere… But where?
I already changed the FUNKWHALE_HOSTNAME field in the .env file to my instance’s domain, but it doesn’t seem to make a difference.

Or else, do I have to modify the settings of my PostgreSQL database? Or something else?


#13

Did you resourced your .env file after changing the value? If the variable is picked up, it should not raise the error you shared.


#14

Sorry Eliot, I’m out of my depth here…
How do I resource the .env file? I don’t see anything about this on the install guide :slight_smile:
(I also searched elsewhere online, but no luck)


#15

sorry, I’ll try to be more explicit. You can either run source config/.env or export $(cat config/.env | grep -v ^# | xargs)


#16

You can easily verify if you have the proper value set in your environment by running echo $FUNKWHALE_HOSTNAME

Also, I’ve just merged a branch that will remove the need for this in the next release.


#17

Thanks Eliot!

source config/.env didn’t seem to change anything, but the export command did.
echo $FUNKWHALE_HOSTNAME does return the URL I assigned to my server IP. Woopee!

Now, when I try to import the DB structure, I get the following issue:

(virtualenv) [email protected]:~ $ python api/manage.py migrate
    Traceback (most recent call last):
      File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 273, in get_value
        value = self.ENVIRON[var]
      File "/usr/lib/python3.5/os.py", line 725, in __getitem__
        raise KeyError(key) from None
    KeyError: 'DJANGO_ALLOWED_HOSTS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "api/manage.py", line 16, in <module>
    django.setup()
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/srv/funkwhale/api/config/settings/production.py", line 14, in <module>
    from .common import *  # noqa
  File "/srv/funkwhale/api/config/settings/common.py", line 63, in <module>
    ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS")
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 179, in list
    return self.get_value(var, cast=list if not cast else [cast], default=default)
  File "/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py", line 277, in get_value
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: Set the DJANGO_ALLOWED_HOSTS environment variable

I’ve been searching online how to set this DJANGO_ALLOWED_HOSTS variable, but, yes, I’m confused once more (it probably doesn’t help that I’ve never coded anything more complicated than a few PHP files :sweat:).
Is Django even installed yet? If so, where do I access the settings.py file?

(when I try editing “/srv/funkwhale/virtualenv/lib/python3.5/site-packages/environ/environ.py”, the editor says this file is empty)


#18

It’s still an environment issue. Can you try with export $(cat config/.env | grep -v ^# | xargs) instead of the source command?


#19

Hi Eliot,
I actually did that before, after trying the source command…
Just tried again, but the same error message pops up :frowning:

To confirm: the export and the source command should be performed from within the virtualenv, right?
When I run echo $FUNKWHALE_HOSTNAME, the URL I set in the .env file (=“xxx.xxx.xyz” below) is displayed. So I guess at least some of my settings are taken into account somehow?

In case it may help with anything, here’s the content of my .env file:

# If you have any doubts about what a setting does,
# check https://docs.funkwhale.audio/configuration.html#configuration-reference

# If you're tweaking this file from the template, ensure you edit at least the
# following variables:
# - DJANGO_SECRET_KEY
# - FUNKWHALE_HOSTNAME
# - EMAIL_CONFIG and DEFAULT_FROM_EMAIL if you plan to send emails)
# On non-docker setup **only**, you'll also have to tweak/uncomment those variables:
# - DATABASE_URL
# - CACHE_URL
#
# You **don't** need to update those variables on pure docker setups.
#
# Additional options you may want to check:
# - MUSIC_DIRECTORY_PATH and MUSIC_DIRECTORY_SERVE_PATH if you plan to use
#   in-place import
#
# Docker only
# -----------

# The tag of the image we should use
# (it will be interpolated in docker-compose file)
# You can comment or ignore this if you're not using docker
FUNKWHALE_VERSION=latest

# End of Docker-only configuration

# General configuration
# ---------------------

# Set this variables to bind the API server to another interface/port
# example: FUNKWHALE_API_IP=0.0.0.0
# example: FUNKWHALE_API_PORT=5678
FUNKWHALE_API_IP=127.0.0.1
FUNKWHALE_API_PORT=5000

# Replace this by the definitive, public domain you will use for
# your instance
FUNKWHALE_HOSTNAME=xxx.xxx.xyz
FUNKWHALE_PROTOCOL=https

# Configure email sending using this variale
# By default, funkwhale will output emails sent to stdout
# here are a few examples for this setting
# EMAIL_CONFIG=consolemail://         # output emails to console (the default)
# EMAIL_CONFIG=dummymail://          # disable email sending completely
# On a production instance, you'll usually want to use an external SMTP server:
# EMAIL_CONFIG=smtp://[email protected]:[email protected]:25
# EMAIL_CONFIG=smtp+ssl://[email protected]:[email protected]:465
# EMAIL_CONFIG=smtp+tls://[email protected]:[email protected]:587

# The email address to use to send system emails.
# [email protected]


# Depending on the reverse proxy used in front of your funkwhale instance,
# the API will use different kind of headers to serve audio files
# Allowed values: nginx, apache2
REVERSE_PROXY_TYPE=nginx

# API/Django configuration

# Database configuration
# Examples:
#  DATABASE_URL=postgresql://<user>:<password>@<host>:<port>/<database>
#  DATABASE_URL=postgresql://funkwhale:[email protected]:5432/funkwhale_database
# Use the next one if you followed Debian installation guide
DATABASE_URL=postgresql://[email protected]:5432/funkwhale

# Cache configuration
# Examples:
#  CACHE_URL=redis://<host>:<port>/<database>
#  CACHE_URL=redis://localhost:6379/0
# Use the next one if you followed Debian installation guide
CACHE_URL=redis://127.0.0.1:6379/0

# Where media files (such as album covers or audio tracks) should be stored
# on your system?
# (Ensure this directory actually exists)
MEDIA_ROOT=/srv/funkwhale/data/media

# Where static files (such as API css or icons) should be compiled
# Where static files (such as API css or icons) should be compiled
# on your system?
# (Ensure this directory actually exists)
STATIC_ROOT=/srv/funkwhale/data/static

# which settings module should django use?
# You don't have to touch this unless you really know what you're doing
DJANGO_SETTINGS_MODULE=config.settings.production

# Generate one using `openssl rand -base64 45`, for example
DJANGO_SECRET_KEY=xxxxxxxxxxxxxxxxx

# You don't have to edit this, but you can put the admin on another URL if you
# want to
# DJANGO_ADMIN_URL=^api/admin/

# Sentry/Raven error reporting (server side)
# Enable Raven if you want to help improve funkwhale by
# automatically sending error reports our Sentry instance.
# This will help us detect and correct bugs
RAVEN_ENABLED=false
RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:[email protected]/5

# In-place import settings
# You can safely leave those settings uncommented if you don't plan to use
# in place imports.
# Typical docker setup:
#   MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
#   MUSIC_DIRECTORY_SERVE_PATH=/music  # docker-only
# Typical non-docker setup:
#  MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
#   # MUSIC_DIRECTORY_SERVE_PATH= # stays commented, not needed

MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music

# LDAP settings
# Use the following options to allow authentication on your Funkwhale instance
# using a LDAP directory.
# Have a look at https://docs.funkwhale.audio/installation/ldap.html for
# detailed instructions.

# LDAP_ENABLED=True
# LDAP_SERVER_URI=ldap://your.server:389
# LDAP_BIND_DN=cn=admin,dc=domain,dc=com
# LDAP_BIND_PASSWORD=bindpassword
# LDAP_SEARCH_FILTER=(|(cn={0})(mail={0}))
# LDAP_START_TLS=False
# LDAP_ROOT_DN=dc=domain,dc=com

FUNKWHALE_FRONTEND_PATH=/srv/funkwhale/front/dist

# Nginx related configuration
NGINX_MAX_BODY_SIZE=30M

#20

Can you try adding DANGO_ALLOWED_HOSTS=yourdomain.name in your .env file? I believe you were hit by a documentation update two days ago.