From 19c5c8ab9b16c53fed33711320f92224cbf06b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 20:59:18 +0200 Subject: [PATCH 1/8] fix python->python3 in debian docs --- docs/installation/debian.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/installation/debian.rst b/docs/installation/debian.rst index eb8683e56..c91580b6c 100644 --- a/docs/installation/debian.rst +++ b/docs/installation/debian.rst @@ -162,7 +162,7 @@ First, create the virtualenv and install wheel: .. code-block:: shell python3 -m venv /srv/funkwhale/virtualenv - pip install wheel + pip3 install wheel This will result in a ``virtualenv`` directory being created in ``/srv/funkwhale/virtualenv``. @@ -180,7 +180,7 @@ Finally, install the python dependencies: .. code-block:: shell - pip install -r api/requirements.txt + pip3 install -r api/requirements.txt .. important:: @@ -244,7 +244,7 @@ You should now be able to import the initial database structure: .. code-block:: shell - python api/manage.py migrate + python3 api/manage.py migrate This will create the required tables and rows. @@ -269,23 +269,23 @@ You can then create your first user account: .. code-block:: shell - python api/manage.py createsuperuser + python3 api/manage.py createsuperuser If you ever want to change a user's password from the command line, just run: .. code-block:: shell - python api/manage.py changepassword + python3 api/manage.py changepassword Collect static files -------------------- Static files are the static assets used by the API server (icon PNGs, CSS, etc.). -We need to collect them explicitely, so they can be served by the webserver: +We need to collect them explicitly, so they can be served by the webserver: .. code-block:: shell - python api/manage.py collectstatic + python3 api/manage.py collectstatic This should populate the directory you choose for the ``STATIC_ROOT`` variable in your ``.env`` file. From 46d5293964470f585618f3167a36457867b1c285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 21:07:29 +0200 Subject: [PATCH 2/8] adds funkwhale user authorization for postgres --- docs/installation/external_dependencies.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/installation/external_dependencies.rst b/docs/installation/external_dependencies.rst index 3fa430788..55ce9747b 100644 --- a/docs/installation/external_dependencies.rst +++ b/docs/installation/external_dependencies.rst @@ -45,15 +45,25 @@ Create the project database and user: CREATE USER funkwhale; GRANT ALL PRIVILEGES ON DATABASE funkwhale TO funkwhale; -Assuming you already have :ref:`created your funkwhale user `, -you should now be able to open a postgresql shell: - .. warning:: - It's importing that you use utf-8 encoding for your database, + It's important that you use utf-8 encoding for your database, otherwise you'll end up with errors and crashes later on when dealing with music metedata that contains non-ascii chars. + +On Debian you will also need to allow the funkwhale unix user to access the database: + +.. code-block:: shell + + cat | sudo tee -a /etc/postgresql/9.5/main/pg_hba.conf << EOF + local all funkwhale peer + EOF + sudo systemctl restart postgresql + +Assuming you already have :ref:`created your funkwhale user `, +you should now be able to open a postgresql shell: + .. code-block:: shell sudo -u funkwhale -H psql From 854283c2e5e1811ccefc5d7155557f5764886aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 21:11:23 +0200 Subject: [PATCH 3/8] fixed your->you're, reformatted paragraphs --- docs/installation/optimization.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/installation/optimization.rst b/docs/installation/optimization.rst index f873795e2..9ff8ffadf 100644 --- a/docs/installation/optimization.rst +++ b/docs/installation/optimization.rst @@ -2,7 +2,7 @@ Optimizing your Funkwhale instance ================================== Depending on your requirements, you may want to reduce as much as possible -Funkwhale's footprint. +Funkwhale's memory footprint. Reduce workers concurrency -------------------------- @@ -14,9 +14,9 @@ memory usage. You can control this behaviour using the ``--concurrency`` flag. For instance, setting ``--concurrency=1`` will spawn only one worker. -This flag should be appended after the ``celery -A funkwhale_api.taskapp worker`` -command in your :file:`docker-compose.yml` file if your using Docker, or in your -:file:`/etc/systemd/system/funkwhale-worker.service` otherwise. +This flag should be appended after the ``celery -A funkwhale_api.taskapp +worker`` command in your :file:`docker-compose.yml` file if your using Docker, +or in your :file:`/etc/systemd/system/funkwhale-worker.service` otherwise. .. note:: @@ -33,5 +33,5 @@ Using the ``solo`` pool type should reduce your memory consumption. You can control this behaviour using the ``--pool=solo`` flag. This flag should be appended after the ``celery -A funkwhale_api.taskapp worker`` -command in your :file:`docker-compose.yml` file if your using Docker, or in your -:file:`/etc/systemd/system/funkwhale-worker.service` otherwise. +command in your :file:`docker-compose.yml` file if you're using Docker, or in +your :file:`/etc/systemd/system/funkwhale-worker.service` otherwise. From 302e119f839435080c9a9e3c2af3d2e8708245b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 21:16:33 +0200 Subject: [PATCH 4/8] removes use of script for simpler direct installation --- docs/installation/debian.rst | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/docs/installation/debian.rst b/docs/installation/debian.rst index c91580b6c..c71f6f861 100644 --- a/docs/installation/debian.rst +++ b/docs/installation/debian.rst @@ -119,30 +119,19 @@ First, switch to the api directory: cd api A few OS packages are required in order to run Funkwhale. On Debian-like - systems, the list is available in ``api/requirements.apt`` or by running -``./install_os_dependencies.sh list`` and in ``api/requirements.pac`` on -Arch. - -.. note:: - - Ensure you are running the next commands as root or using sudo - (and not as the funkwhale) user. - -You can install those packages all at once: - -On Debian-like systems: +systems, they can be installed with .. code-block:: shell - ./install_os_dependencies.sh install + sudo apt install build-essential ffmpeg libjpeg-dev libmagic-dev libpq-dev postgresql-client python3-dev -On Arch Linux and its derivatives: +On Arch, run .. code-block:: shell pacman -S $(cat api/requirements.pac) -From now on you can switch back to the funkwhale user. +From now on, you should use the funkwhale user for all commands. Python dependencies -------------------- From 5081c1fe5415b3303bb98e7fc3d00036ed25940d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 21:19:51 +0200 Subject: [PATCH 5/8] removes script to load environement variables (?) --- docs/installation/debian.rst | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/docs/installation/debian.rst b/docs/installation/debian.rst index c71f6f861..5a4c9dae5 100644 --- a/docs/installation/debian.rst +++ b/docs/installation/debian.rst @@ -192,7 +192,7 @@ Download the sample environment file: curl -L -o config/.env "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/env.prod.sample" You can then edit it: the file is heavily commented, and the most relevant -configuration options are mentionned at the top of the file. +configuration options are mentioned at the top of the file. Especially, populate the ``DATABASE_URL`` and ``CACHE_URL`` values based on how you configured your PostgreSQL and Redis servers in @@ -201,30 +201,15 @@ how you configured your PostgreSQL and Redis servers in When you want to run command on the API server, such as to create the database or compile static files, you have to ensure you source -the environment variables. +the environment variables in that file. This can be done like this:: export $(cat config/.env | grep -v ^# | xargs) -The easier thing to do is to store this in a script:: - - cat > /srv/funkwhale/load_env <<'EOL' - #!/bin/bash - export $(cat /srv/funkwhale/config/.env | grep -v ^# | xargs) - EOL - chmod +x /srv/funkwhale/load_env - -You should now be able to run the following to populate your environment -variables easily: - -.. code-block:: shell - - source /srv/funkwhale/load_env - .. note:: - Remember to source ``load_env`` whenever you edit your .env file. + Remember to reload these variables whenever you edit your .env file. Database setup --------------- From e3de7306caf051a6b5df02cc095329fd2a2c5871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Thu, 12 Jul 2018 21:25:49 +0200 Subject: [PATCH 6/8] adds instructions for installation via git clone --- docs/installation/debian.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/installation/debian.rst b/docs/installation/debian.rst index 5a4c9dae5..21b97f922 100644 --- a/docs/installation/debian.rst +++ b/docs/installation/debian.rst @@ -106,6 +106,20 @@ Then we'll download the frontend files: mv extracted/front . rm -rf extracted +.. note:: + + You can also choose to get the code directly from the git repo. In this + case, run + + cd /srv + rm -r funkwhale + git clone https://code.eliotverriot.com/funkwhale/funkwhale funkwhale + cd funkwale + + You will still need to get the frontend files as specified before, because + we're not going to build them. + + You can leave the ZIP archives in the directory, this will help you know which version you've installed next time you want to upgrade your installation. @@ -191,6 +205,13 @@ Download the sample environment file: curl -L -o config/.env "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/env.prod.sample" +.. note:: + + if you used git to get the latest version of the code earlier, you can instead do + + cp /srv/funkwhale/deploy/env.prod.sample /srv/funkwhale/config/.env + + You can then edit it: the file is heavily commented, and the most relevant configuration options are mentioned at the top of the file. From b50e3465694adb9268c41cb820c19193d0436efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Sat, 14 Jul 2018 00:03:20 +0200 Subject: [PATCH 7/8] fixes pip3/python3 inside virtualenv and re-creation of directories --- docs/installation/debian.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/installation/debian.rst b/docs/installation/debian.rst index 21b97f922..407f71dd7 100644 --- a/docs/installation/debian.rst +++ b/docs/installation/debian.rst @@ -113,8 +113,12 @@ Then we'll download the frontend files: cd /srv rm -r funkwhale - git clone https://code.eliotverriot.com/funkwhale/funkwhale funkwhale - cd funkwale + git clone https://code.eliotberriot.com/funkwhale/funkwhale funkwhale + cd funkwhale + + You'll also need to re-create the folders we make earlier: + + mkdir -p config data/static data/media data/music front You will still need to get the frontend files as specified before, because we're not going to build them. @@ -183,7 +187,7 @@ Finally, install the python dependencies: .. code-block:: shell - pip3 install -r api/requirements.txt + pip install -r api/requirements.txt .. important:: @@ -239,7 +243,7 @@ You should now be able to import the initial database structure: .. code-block:: shell - python3 api/manage.py migrate + python api/manage.py migrate This will create the required tables and rows. @@ -264,13 +268,13 @@ You can then create your first user account: .. code-block:: shell - python3 api/manage.py createsuperuser + python api/manage.py createsuperuser If you ever want to change a user's password from the command line, just run: .. code-block:: shell - python3 api/manage.py changepassword + python api/manage.py changepassword Collect static files -------------------- @@ -280,7 +284,7 @@ We need to collect them explicitly, so they can be served by the webserver: .. code-block:: shell - python3 api/manage.py collectstatic + python api/manage.py collectstatic This should populate the directory you choose for the ``STATIC_ROOT`` variable in your ``.env`` file. From 8ecdc64e53764251c64491da9dd1f8722c4000eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wxcaf=C3=A9=20=28Cl=C3=A9ment=20Hertling=29?= Date: Sat, 14 Jul 2018 15:49:58 +0200 Subject: [PATCH 8/8] removed comment about postgres --- docs/installation/external_dependencies.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/installation/external_dependencies.rst b/docs/installation/external_dependencies.rst index 55ce9747b..981997207 100644 --- a/docs/installation/external_dependencies.rst +++ b/docs/installation/external_dependencies.rst @@ -52,15 +52,6 @@ Create the project database and user: with music metedata that contains non-ascii chars. -On Debian you will also need to allow the funkwhale unix user to access the database: - -.. code-block:: shell - - cat | sudo tee -a /etc/postgresql/9.5/main/pg_hba.conf << EOF - local all funkwhale peer - EOF - sudo systemctl restart postgresql - Assuming you already have :ref:`created your funkwhale user `, you should now be able to open a postgresql shell: