2018-07-01 09:33:55 +00:00
Upgrading your Funkwhale instance to a newer version
2018-03-22 13:22:39 +00:00
====================================================
.. note ::
2018-03-23 11:15:21 +00:00
Before upgrading your instance, we strongly advise you to make at least a database backup. Ideally, you should make a full backup, including
the database and the media files.
We're commited to make upgrade as easy and straightforward as possible,
2018-07-01 09:33:55 +00:00
however, Funkwhale is still in development and you'll be safer with a backup.
2018-03-22 13:22:39 +00:00
2018-03-23 11:15:21 +00:00
2018-03-22 13:22:39 +00:00
Reading the release notes
-------------------------
2019-03-13 08:55:03 +00:00
Please take a few minutes to read the :doc: `../changelog` : updates should work
2018-03-22 13:22:39 +00:00
similarly from version to version, but some of them may require additional steps.
Those steps would be described in the version release notes.
2018-09-25 20:18:02 +00:00
Insights about new versions
---------------------------
Some versions may be bigger than usual, and we'll try to detail the changes
when possible.
.. toctree ::
:maxdepth: 1
0.17
2018-03-22 13:22:39 +00:00
Docker setup
2018-05-06 22:17:42 +00:00
------------
2018-03-22 13:22:39 +00:00
2019-03-13 08:55:03 +00:00
If you've followed the setup instructions in :doc: `../installation/docker` , upgrade path is
2018-03-22 13:22:39 +00:00
easy:
2019-03-07 09:09:31 +00:00
Mono-container installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Basically, you need to pull the new container image, stop and delete your existing container,
and relaunch a new one:
2020-06-21 11:12:23 +00:00
To upgrade your service, change the version number of the image in `` docker-compose.yml `` with the latest release (i.e. |version|).
Pull the new images:
.. code-block :: shell
docker-compose pull
Restart the service:
2019-03-07 09:09:31 +00:00
.. code-block :: shell
2020-06-21 11:12:23 +00:00
docker-compose up -d
2019-03-07 09:09:31 +00:00
Multi-container installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2018-03-22 13:22:39 +00:00
.. parsed-literal ::
2019-07-29 09:03:59 +00:00
# this assumes you want to upgrade to version "|version|"
export FUNKWHALE_VERSION="|version|"
.. code-block :: shell
2018-03-22 13:22:39 +00:00
cd /srv/funkwhale
# hardcode the targeted version your env file
# (look for the FUNKWHALE_VERSION variable)
nano .env
2018-08-31 17:21:46 +00:00
# Load your environment variables
source .env
# Download newest nginx configuration file
2019-07-29 09:03:59 +00:00
curl -L -o nginx/funkwhale.template "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/docker.nginx.template"
curl -L -o nginx/funkwhale_proxy.conf "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/$FUNKWHALE_VERSION/deploy/docker.funkwhale_proxy.conf"
2018-03-22 13:22:39 +00:00
# Pull the new version containers
docker-compose pull
# Apply the database migrations
docker-compose run --rm api python manage.py migrate
# Relaunch the containers
docker-compose up -d
2018-06-07 11:17:48 +00:00
.. warning ::
You may sometimes get the following warning while applying migrations::
"Your models have changes that are not yet reflected in a migration, and so won't be applied."
This is a warning, not an error, and it can be safely ignored.
Never run the `` makemigrations `` command yourself.
2019-01-29 13:18:47 +00:00
2019-01-28 08:48:06 +00:00
Upgrading the Postgres container
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
With some Funkwhale releases, it is recommended to upgrade the version of the
Postgres database server container. For example, Funkwhale 0.17 recommended
Postgres 9.4, but Funkwhale 0.18 recommends Postgres 11. When upgrading
Postgres, it is not sufficient to change the container referenced in
`` docker-compose.yml `` . New major versions of Postgres cannot read the databases
created by older major versions. The data has to be exported from a running
instance of the old version and imported by the new version.
Thankfully, there is a Docker container available to automate this process. You
can use the following snippet to upgrade your database in `` ./postgres `` ,
keeping a backup of the old version in `` ./postgres-old `` :
2019-01-29 13:18:47 +00:00
.. code-block :: shell
2019-01-28 08:48:06 +00:00
# Replace "9.4" and "11" with the versions you are migrating between.
export OLD_POSTGRES=9.4
export NEW_POSTGRES=11
docker-compose stop postgres
docker run --rm \
2019-01-29 13:18:47 +00:00
-v $(pwd)/data/postgres:/var/lib/postgresql/${OLD_POSTGRES}/data \
-v $(pwd)/data/postgres-new:/var/lib/postgresql/${NEW_POSTGRES}/data \
2019-01-28 08:48:06 +00:00
tianon/postgres-upgrade:${OLD_POSTGRES}-to-${NEW_POSTGRES}
# Add back the access control rule that doesn't survive the upgrade
2019-01-29 13:18:47 +00:00
echo "host all all all trust" | sudo tee -a ./data/postgres-new/pg_hba.conf
2019-01-28 08:48:06 +00:00
# Swap over to the new database
mv ./data/postgres ./data/postgres-old
mv ./data/postgres-new ./data/postgres
2018-05-06 22:17:42 +00:00
2018-03-22 13:22:39 +00:00
Non-docker setup
2018-05-06 22:17:42 +00:00
----------------
2019-09-25 18:43:08 +00:00
If you installed Funkwhale using the install script, upgrading is done using `` sh -c "$(curl -sSL https://get.funkwhale.audio/upgrade.sh)" `` . Make sure to run this command with root permissions.
If you manually installed Funkwhale, please use the following instructions.
2018-05-06 22:17:42 +00:00
Upgrade the static files
^^^^^^^^^^^^^^^^^^^^^^^^
On non-docker setups, the front-end app
is updated separately from the API. This is as simple as downloading
the zip with the static files and extracting it in the correct place.
The following example assume your setup match :ref: `frontend-setup` .
.. parsed-literal ::
# this assumes you want to upgrade to version "|version|"
export FUNKWHALE_VERSION="|version|"
cd /srv/funkwhale
2018-12-10 15:00:33 +00:00
sudo -u funkwhale curl -L -o front.zip "https://dev.funkwhale.audio/funkwhale/funkwhale/builds/artifacts/$FUNKWHALE_VERSION/download?job=build_front"
2018-06-17 10:40:46 +00:00
sudo -u funkwhale unzip -o front.zip
sudo -u funkwhale rm front.zip
2018-05-06 22:17:42 +00:00
Upgrading the API
^^^^^^^^^^^^^^^^^
2018-03-22 13:22:39 +00:00
2019-10-28 09:26:44 +00:00
.. note ::
Starting with Funkwhale 0.20, it is recommended you run Funkwhale with Python 3.6 or greater. This means upgrading to
Debian 10 if you're on Debian 9.
If you still want to use Python 3.5, you can, but you'll need to run `` sudo -u funkwhale -H -E /srv/funkwhale/virtualenv/bin/pip install "uvicorn==0.8.6" `` before upgrading.
2018-05-06 22:17:42 +00:00
On non-docker, upgrade involves a few more commands. We assume your setup
2018-06-24 21:42:38 +00:00
match what is described in :doc: `/installation/debian` :
2018-03-22 13:22:39 +00:00
.. parsed-literal ::
# this assumes you want to upgrade to version "|version|"
2018-06-24 00:50:00 +00:00
export FUNKWHALE_VERSION="|version|"
2018-03-22 13:22:39 +00:00
cd /srv/funkwhale
# download more recent API files
2018-12-10 15:00:33 +00:00
sudo -u funkwhale curl -L -o "api-$FUNKWHALE_VERSION.zip" "https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/$FUNKWHALE_VERSION/download?job=build_api"
2018-06-24 00:50:00 +00:00
sudo -u funkwhale unzip "api-$FUNKWHALE_VERSION.zip" -d extracted
2019-04-01 17:20:17 +00:00
sudo -u funkwhale rm -rf api/ && sudo -u funkwhale mv extracted/api .
2018-06-17 10:40:46 +00:00
sudo -u funkwhale rm -rf extracted
2020-11-15 15:43:09 +00:00
sudo -u funkwhale rm api-$FUNKWHALE_VERSION.zip
2018-03-22 13:22:39 +00:00
# update os dependencies
sudo api/install_os_dependencies.sh install
2019-01-22 13:08:26 +00:00
sudo -u funkwhale -H -E /srv/funkwhale/virtualenv/bin/pip install -r api/requirements.txt
2018-03-22 13:22:39 +00:00
# collect static files
2019-01-22 13:08:26 +00:00
sudo -u funkwhale -H -E /srv/funkwhale/virtualenv/bin/python api/manage.py collectstatic --no-input
2018-06-17 10:40:46 +00:00
# stop the services
sudo systemctl stop funkwhale.target
# apply database migrations
2019-01-22 13:08:26 +00:00
sudo -u funkwhale -H -E /srv/funkwhale/virtualenv/bin/python api/manage.py migrate
2018-03-22 13:22:39 +00:00
# restart the services
2018-06-17 10:40:46 +00:00
sudo systemctl start funkwhale.target
2018-06-07 11:17:48 +00:00
2019-10-15 09:52:15 +00:00
.. note ::
If you see a PermissionError when running the `` migrate `` command, try running the following commands by hand, and relaunch the migrations::
sudo -u postgres psql funkwhale -c 'CREATE EXTENSION IF NOT EXISTS "citext";'
sudo -u postgres psql funkwhale -c 'CREATE EXTENSION IF NOT EXISTS "unaccent";'
2018-06-07 11:17:48 +00:00
.. warning ::
You may sometimes get the following warning while applying migrations::
"Your models have changes that are not yet reflected in a migration, and so won't be applied."
This is a warning, not an error, and it can be safely ignored.
Never run the `` makemigrations `` command yourself.