docs: Update docker commands

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2318>
This commit is contained in:
Ciarán Ainsworth 2023-01-18 14:37:57 +01:00 committed by Marge
parent 4225056d6e
commit 258e4ac7ab
25 changed files with 119 additions and 114 deletions

View File

@ -37,7 +37,7 @@ Running `fix_federation_ids` with the `--no-dry-run` flag is irreversible. Make
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_federation_ids https://old-url https://new-url --no-dry-run --no-input
sudo docker compose run --rm api funkwhale-manage fix_federation_ids https://old-url https://new-url --no-dry-run --no-input
```
:::

View File

@ -19,7 +19,7 @@ sudo systemctl restart funkwhale.target
:sync: docker
```{code-block} sh
docker-compose restart
sudo docker compose restart
```
:::

View File

@ -99,7 +99,7 @@ To make the job of writing and debugging MRF policies easier, we provide a manag
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage mrf_check --list
sudo docker compose run --rm api funkwhale-manage mrf_check --list
```
:::
@ -124,7 +124,7 @@ To make the job of writing and debugging MRF policies easier, we provide a manag
```{code-block} sh
export MRF_MESSAGE='{"actor": "https://normal.domain/@alice", "type": "Create", "object": {"type": "Follow"}}'
echo $MRF_MESSAGE | docker-compose run --rm api funkwhale-manage mrf_check inbox - -p blocked_follow_domains
echo $MRF_MESSAGE | sudo docker compose run --rm api funkwhale-manage mrf_check inbox - -p blocked_follow_domains
```
::::
@ -148,7 +148,7 @@ To make the job of writing and debugging MRF policies easier, we provide a manag
```{code-block} sh
export MRF_MESSAGE='{"actor": "https://botdomain.org/@bob", "type": "Create", "object": {"type": "Follow"}}'
echo $MRF_MESSAGE | docker-compose run --rm api funkwhale-manage mrf_check inbox - -p blocked_follow_domains
echo $MRF_MESSAGE | sudo docker compose run --rm api funkwhale-manage mrf_check inbox - -p blocked_follow_domains
```
:::
@ -175,7 +175,7 @@ To make the job of writing and debugging MRF policies easier, we provide a manag
export ACTIVITY_UUID="06208aea-c687-4e8b-aefd-22f1c3f76039"
echo $MRF_MESSAGE | docker-compose run --rm api funkwhale-manage mrf_check inbox $ACTIVITY_UUID -p blocked_follow_domains
echo $MRF_MESSAGE | sudo docker compose run --rm api funkwhale-manage mrf_check inbox $ACTIVITY_UUID -p blocked_follow_domains
```
@ -199,7 +199,7 @@ venv/bin/funkwhale-manage mrf_check --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage mrf_check --help
sudo docker compose run --rm api funkwhale-manage mrf_check --help
```
:::

View File

@ -158,7 +158,7 @@ Serving files from an object store requires some changes to the reverse proxy.
:sync: docker
```{code-block} sh
docker-compose restart
sudo docker compose restart
sudo systemctl restart nginx
```

View File

@ -60,7 +60,7 @@ Celery uses a `prefork` pool by default. This enables the server to process many
2. Restart Celery.
```{code-block} sh
docker-compose restart celerybeat
sudo docker compose restart celerybeat
```
:::

View File

@ -24,7 +24,7 @@ venv/bin/funkwhale-manage import_files --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage import_files --help
sudo docker compose run --rm api funkwhale-manage import_files --help
```
:::
@ -188,7 +188,7 @@ Funkwhale imports the music in your storage directory into the specified library
2. Run your import command against your music storage directory:
```{code-block} sh
docker-compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place
sudo docker compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place
```
Funkwhale imports the music in your storage directory into the specified library.
@ -250,7 +250,7 @@ venv/bin/funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nf
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place --watch
sudo docker compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place --watch
```
:::
@ -281,7 +281,7 @@ venv/bin/funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nf
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place --watch --prune
sudo docker compose run --rm api funkwhale-manage import_files $LIBRARY_ID "/srv/funkwhale/data/music/nfsshare/" --recursive --noinput --in-place --watch --prune
```
:::

View File

@ -1,6 +1,6 @@
# Install Funkwhale using Docker
Funkwhale is available as a containerized application. This enables you to run each service in containers rather than install them on your server. You can run Funkwhale using [Docker](https://docker.com) and Docker-Compose.
Funkwhale is available as a containerized application. This enables you to run each service in containers rather than install them on your server. You can run Funkwhale using [Docker](https://docker.com).
```{note}
This guide assumes you are using a [Debian](https://debian.org)-based system.
@ -18,7 +18,7 @@ This guide assumes you are using a [Debian](https://debian.org)-based system.
export FUNKWHALE_VERSION={sub-ref}`version`
```
- Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/).
- Install [Docker](https://docs.docker.com/engine/install/) and the [compose plugin](https://docs.docker.com/compose/install/linux/#install-using-the-repository).
- Install `curl`.
```{code-block} sh
@ -32,11 +32,9 @@ It's good practice to create a user on your server for Funkwhale administration.
1. Create the `funkwhale` user and set its shell to `bash` and its home directory to `/srv/funkwhale`.
```{code-block} sh
sudo useradd --system --shell /bin/bash --create-home --home-dir /srv/funkwhale funkwhale
```
2. Follow the [Docker post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/) to give the `funkwhale` user the ability to use Docker without `sudo`.
```{code-block} sh
sudo useradd --system --shell /bin/bash --create-home --home-dir /srv/funkwhale funkwhale
```
````{note}
To perform any tasks as the `funkwhale` user, prefix your commands with `sudo -u funkwhale`.
@ -69,7 +67,7 @@ That's it! You've created your `funkwhale` user.
cd /srv/funkwhale
```
3. Download the `docker-compose` template. This contains information about the containers and how they work together.
3. Download the `docker compose` template. This contains information about the containers and how they work together.
```{code-block} sh
curl -L -o /srv/funkwhale/docker-compose.yml "https://dev.funkwhale.audio/funkwhale/funkwhale/raw/${FUNKWHALE_VERSION}/deploy/docker-compose.yml"
@ -128,19 +126,19 @@ Once you've filled in your environment file, you can set up Funkwhale. Follow th
```{code-block} sh
cd /srv/funkwhale
docker-compose pull
sudo docker compose pull
```
2. Bring up the database container so you can run the database migrations.
```{code-block} sh
docker-compose up -d postgres
sudo docker compose up -d postgres
```
3. Run the database migrations.
```{code-block} sh
docker-compose run --rm api funkwhale-manage migrate
sudo docker compose run --rm api funkwhale-manage migrate
```
````{note}
@ -156,13 +154,13 @@ Once you've filled in your environment file, you can set up Funkwhale. Follow th
4. Create your superuser.
```{code-block} sh
docker-compose run --rm api funkwhale-manage createsuperuser
sudo docker compose run --rm api funkwhale-manage createsuperuser
```
5. Launch all the containers to bring up your pod.
```{code-block} sh
docker-compose up -d
sudo docker compose up -d
```
That's it! Your Funkwhale pod is now up and running.
@ -255,7 +253,7 @@ The frontend container ships default Nginx templates which serve content to the
6. Bring the `front` container up again to pick up the changes.
```{code-block} sh
docker-compose up -d front
sudo docker compose up -d front
```
That's it! The container mounts your custom nginx files and uses its values to serve Funkwhale content. To revert to the default values, comment out the volumes by adding a `#` in front of them and bring the `front` container back up.
@ -267,8 +265,8 @@ To enable your users to connect to your pod securely, you need to set up {abbr}`
1. Install certbot
```{code-block} sh
apt-get update
apt-get install certbot python3-certbot-nginx
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx
```
2. Run certbot

View File

@ -62,7 +62,7 @@ On your {term}`destination server`, follow the [installation guide](docker.md).
Once you have finished the installation, stop the Funkwhale services. These shouldn't be running when you copy your existing data over.
```{code-block} sh
docker-compose stop
sudo docker compose stop
```
:::
@ -87,7 +87,7 @@ sudo -u postgres -H pg_dump funkwhale > /srv/funkwhale/dump.sql
:sync: docker
```{code-block} sh
docker-compose exec postgres pg_dumpall -c -U postgres > dump.sql
sudo docker compose exec postgres pg_dumpall -c -U postgres > dump.sql
```
:::
@ -157,19 +157,19 @@ You need to initialize the postgres container on your {term}`destination server`
CREATE USER funkwhale; \
GRANT ALL PRIVILEGES ON DATABASE funkwhale TO funkwhale;" > init.sql # Create an init.sql file with the correct permissions
docker-compose run --rm postgres psql -U postgres -d postgres < "init.sql" # Import the init.sql file
sudo docker compose run --rm postgres psql -U postgres -d postgres < "init.sql" # Import the init.sql file
```
2. Import your database backup.
```{code-block} sh
docker-compose run --rm postgres psql -U postgres -d postgres < "dump.sql"
sudo docker compose run --rm postgres psql -U postgres -d postgres < "dump.sql"
```
3. When the import finishes, run the `funkwhale-manage migrate` command to set up the database.
```{code-block} sh
docker-compose run --rm api funkwhale-manage migrate
sudo docker compose run --rm api funkwhale-manage migrate
```
:::
@ -198,7 +198,7 @@ sudo systemctl start funkwhale.target
:sync: docker
```{code-block} sh
docker-compose up -d
sudo docker compose up -d
```
:::

View File

@ -47,7 +47,7 @@ venv/bin/funkwhale-manage create_library username1 --name="Library 1" --privacy-
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage create_library username1 --name="Library 1" --privacy-level="everyone"
sudo docker compose run --rm api funkwhale-manage create_library username1 --name="Library 1" --privacy-level="everyone"
```
:::
@ -79,7 +79,7 @@ venv/bin/funkwhale-manage create_library username1
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage create_library username1
sudo docker compose run --rm api funkwhale-manage create_library username1
```
:::
@ -111,7 +111,7 @@ venv/bin/funkwhale-manage create_library username1 --name="Library 1" --privacy-
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage create_library username1 --name="Library 1" --privacy-level="everyone"
sudo docker compose run --rm api funkwhale-manage create_library username1 --name="Library 1" --privacy-level="everyone"
```
:::

View File

@ -25,7 +25,7 @@ venv/bin/funkwhale-manage check_inplace_files
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage check_inplace_files
sudo docker compose run --rm api funkwhale-manage check_inplace_files
```
:::

View File

@ -23,7 +23,7 @@ venv/bin/funkwhale-manage fix_uploads --mimetype
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_uploads --mimetype
sudo docker compose run --rm api funkwhale-manage fix_uploads --mimetype
```
:::
@ -48,7 +48,7 @@ venv/bin/funkwhale-manage fix_uploads --audio-data
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_uploads --audio-data
sudo docker compose run --rm api funkwhale-manage fix_uploads --audio-data
```
:::
@ -73,7 +73,7 @@ venv/bin/funkwhale-manage fix_uploads --size
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_uploads --size
sudo docker compose run --rm api funkwhale-manage fix_uploads --size
```
:::
@ -98,7 +98,7 @@ venv/bin/funkwhale-manage fix_uploads --checksum
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_uploads --checksum
sudo docker compose run --rm api funkwhale-manage fix_uploads --checksum
```
:::
@ -123,7 +123,7 @@ venv/bin/funkwhale-manage fix_uploads --batch-size 500
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fix_uploads --batch-size 500
sudo docker compose run --rm api funkwhale-manage fix_uploads --batch-size 500
```
:::

View File

@ -29,7 +29,7 @@ venv/bin/funkwhale-manage prune_library --tracks
:sync: docker
```bash
docker-compose run --rm api funkwhale-manage prune_library --tracks
sudo docker compose run --rm api funkwhale-manage prune_library --tracks
```
:::
@ -52,7 +52,7 @@ venv/bin/funkwhale-manage prune_library --albums
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage prune_library --albums
sudo docker compose run --rm api funkwhale-manage prune_library --albums
```
:::
@ -75,7 +75,7 @@ venv/bin/funkwhale-manage prune_library --artists
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage prune_library --artists
sudo docker compose run --rm api funkwhale-manage prune_library --artists
```
:::
@ -98,7 +98,7 @@ venv/bin/funkwhale-manage prune_library --tracks --albums --artists
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage prune_library --tracks --albums --artists
sudo docker compose run --rm api funkwhale-manage prune_library --tracks --albums --artists
```
:::
@ -121,7 +121,7 @@ venv/bin/funkwhale-manage prune_library --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage prune_library --help
sudo docker compose run --rm api funkwhale-manage prune_library --help
```
:::

View File

@ -45,7 +45,7 @@ To add tags to untagged albums:
3. Run the `funkwhale-manage` command line interface to generate tags for untagged albums.
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw albums add-tags-from-tracks
sudo docker compose run --rm api funkwhale-manage fw albums add-tags-from-tracks
```
:::
@ -88,7 +88,7 @@ To add tags to untagged artists:
3. Run the `funkwhale-manage` command line interface to generate tags for untagged artists.
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw artists add-tags-from-tracks
sudo docker compose run --rm api funkwhale-manage fw artists add-tags-from-tracks
```
:::

View File

@ -53,7 +53,7 @@ To generate new thumbnails:
4. Run the `funkwhale-manage` command line interface to regenerate the thumbnails.
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw media generate-thumbnails
sudo docker compose run --rm api funkwhale-manage fw media generate-thumbnails
```
:::

View File

@ -25,7 +25,7 @@ venv/bin/funkwhale-manage fw users create
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users create
sudo docker compose run --rm api funkwhale-manage fw users create
```
:::
@ -48,7 +48,7 @@ venv/bin/funkwhale-manage fw users create --username <username> --email <user em
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users create --username <username> --email <user email> -p ""
sudo docker compose run --rm api funkwhale-manage fw users create --username <username> --email <user email> -p ""
```
:::
@ -73,7 +73,7 @@ venv/bin/funkwhale-manage fw users create --username <username> --email <user em
```{code-block} sh
export FUNKWHALE_CLI_USER_PASSWORD=<password>
docker-compose run --rm api funkwhale-manage fw users create --username <username> --email <user email>
sudo docker compose run --rm api funkwhale-manage fw users create --username <username> --email <user email>
```
:::
@ -96,7 +96,7 @@ venv/bin/funkwhale-manage fw users --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users --help
sudo docker compose run --rm api funkwhale-manage fw users --help
```
:::
@ -123,7 +123,7 @@ venv/bin/funkwhale-manage fw users set --upload-quota 500 <user>
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --upload-quota 500 <user>
sudo docker compose run --rm api funkwhale-manage fw users set --upload-quota 500 <user>
```
:::
@ -146,7 +146,7 @@ venv/bin/funkwhale-manage fw users set --staff --superuser <user 1> <user 2>
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --staff --superuser <user 1> <user 2>
sudo docker compose run --rm api funkwhale-manage fw users set --staff --superuser <user 1> <user 2>
```
:::
@ -169,7 +169,7 @@ venv/bin/funkwhale-manage fw users set --no-staff --no-superuser <user>
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --no-staff --no-superuser <user>
sudo docker compose run --rm api funkwhale-manage fw users set --no-staff --no-superuser <user>
```
:::
@ -192,7 +192,7 @@ venv/bin/funkwhale-manage fw users set --permission-moderation <user>
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --permission-moderation <user>
sudo docker compose run --rm api funkwhale-manage fw users set --permission-moderation <user>
```
:::
@ -215,7 +215,7 @@ venv/bin/funkwhale-manage fw users set --password "<password>" <user>
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --password "<password>" <user>
sudo docker compose run --rm api funkwhale-manage fw users set --password "<password>" <user>
```
:::
@ -240,7 +240,7 @@ venv/bin/funkwhale-manage fw users set <user>
```{code-block} sh
export FUNKWHALE_CLI_USER_UPDATE_PASSWORD=<password>
docker-compose run --rm api funkwhale-manage fw users set <user>
sudo docker compose run --rm api funkwhale-manage fw users set <user>
```
:::
@ -263,7 +263,7 @@ venv/bin/funkwhale-manage fw users set --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users set --help
sudo docker compose run --rm api funkwhale-manage fw users set --help
```
:::
@ -290,7 +290,7 @@ venv/bin/funkwhale-manage fw users rm <user>
:sync: docker
```{code-block} py
docker-compose run --rm api funkwhale-manage fw users rm <user>
sudo docker compose run --rm api funkwhale-manage fw users rm <user>
```
:::
@ -315,7 +315,7 @@ venv/bin/funkwhale-manage fw users rm --hard <user>
:sync: docker
```{code-block} py
docker-compose run --rm api funkwhale-manage fw users rm --hard <user>
sudo docker compose run --rm api funkwhale-manage fw users rm --hard <user>
```
:::
@ -338,7 +338,7 @@ venv/bin/funkwhale-manage fw users rm --help
:sync: docker
```{code-block} sh
docker-compose run --rm api funkwhale-manage fw users rm --help
sudo docker compose run --rm api funkwhale-manage fw users rm --help
```
:::

View File

@ -35,7 +35,7 @@ Follow this guide to migrate a mono-container installation to a multi-container
1. Create a backup of your Funkwhale database. We will import this into the new postgres container later.
```{code-block} sh
docker-compose exec funkwhale /usr/bin/pg_dumpall -U funkwhale > db_dump.sql
sudo docker compose exec funkwhale /usr/bin/pg_dumpall -U funkwhale > db_dump.sql
```
## Stop your Funkwhale instance
@ -43,7 +43,7 @@ Follow this guide to migrate a mono-container installation to a multi-container
1. Stop all Funkwhale services. This ensures that no data is changed while you migrate your instance.
```{code-block} sh
docker-compose down
sudo docker compose down
```
## Prepare the multi-container setup
@ -113,19 +113,19 @@ Check the file and remove any duplicated settings after copying.
1. Start up your new database container.
```{code-block} sh
docker-compose up -d postgres
sudo docker compose up -d postgres
```
2. Import your database dump into the new container.
```{code-block} sh
cat db_dump.sql | docker-compose exec -T postgres psql -U postgres
cat db_dump.sql | sudo docker compose exec -T postgres psql -U postgres
```
3. Run the database migrations.
```{code-block} sh
docker-compose run --rm api funkwhale-manage migrate
sudo docker compose run --rm api funkwhale-manage migrate
```
## Start your Funkwhale instance
@ -133,5 +133,5 @@ Check the file and remove any duplicated settings after copying.
Once you have imported your database and run migrations, you can start all containers.
```{code-block} sh
docker-compose up -d
sudo docker compose up -d
```

View File

@ -47,7 +47,7 @@ journalctl -xn -u funkwhale-server
:sync: docker
```{code-block} sh
docker-compose logs -f --tail=50 api # Follow the last 50 messages
sudo docker compose logs -f --tail=50 api # Follow the last 50 messages
```
:::
@ -70,7 +70,7 @@ journalctl -xn -u funkwhale-worker
:sync: docker
```{code-block} sh
docker-compose logs -f --tail=50 celery # Follow the last 50 messages
sudo docker compose logs -f --tail=50 celery # Follow the last 50 messages
```
:::
@ -150,7 +150,7 @@ If your Funkwhale server uses more memory than expected, you can check the footp
:sync: docker
```{code-block} sh
docker-compose restart
sudo docker compose restart
```
:::
@ -189,7 +189,7 @@ To disable memory tracing:
:sync: docker
```{code-block} sh
docker-compose restart
sudo docker compose restart
```
:::

View File

@ -24,7 +24,7 @@ Before you remove any data, you need to stop the Funkwhale containers.
2. Stop the containers
```{code-block} sh
docker-compose down
sudo docker compose down
```
## Remove the reverse proxy
@ -80,7 +80,7 @@ This action is __irreversible__. Make sure you have [backed up your data](../upg
Once you have stopped the containers, you can delete all containers and associated volumes.
```{code-block} sh
docker-compose rm -fsv
sudo docker compose rm -fsv
```
## Remove the Funkwhale directory

View File

@ -19,7 +19,7 @@ Before performing big changes, we recommend you back up your database and media
:sync: docker
```{code-block} sh
docker-compose exec postgres pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
sudo docker compose exec postgres pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
```
:::
@ -126,13 +126,13 @@ To restore your database, do the following:
1. Restore your database backup.
```{code-block} sh
docker-compose run --rm -T postgres psql -U postgres postgres < "/path/to/your/backup/dump.sql"
sudo docker compose run --rm -T postgres psql -U postgres postgres < "/path/to/your/backup/dump.sql"
```
2. Run the `funkwhale-manage migrate` command to set up the database.
```{code-block} sh
docker-compose run --rm api funkwhale-manage migrate
sudo docker compose run --rm api funkwhale-manage migrate
```
:::

View File

@ -29,28 +29,35 @@ If you installed Funkwhale following the [Docker guide](../installation_docs/doc
nano .env
```
6. Load the configuration from your `.env` file.
6. Log in as `su` to load the configuration from your `.env` file.
```{code-block} sh
sudo su
source .env
```
7. Pull the updated containers.
```{code-block} sh
docker-compose pull
docker compose pull
```
8. Apply the database migrations.
```{code-block} sh
docker-compose run --rm api funkwhale-manage migrate
docker compose run --rm api funkwhale-manage migrate
```
9. Relaunch your containers.
```{code-block} sh
docker-compose up -d
docker compose up -d
```
10. Exit the root shell.
```{code-block} sh
exit
```
Thats it! Youve updated your Funkwhale pod. You should now see the new version running in your web browser.
@ -76,13 +83,13 @@ To upgrade postgres on Docker we use the [`postgres-upgrade`](https://hub.docker
3. Stop the postgres container. This means no data changes while you are upgrading.
```{code-block} sh
docker-compose stop postgres
sudo docker compose stop postgres
```
4. Run the migration using the `postgres-upgrade` container. This creates a new version of the database in the `/srv/funkwhale/data/postgres-new` directory.
```{code-block} sh
docker run --rm \
sudo -E docker run --rm \
-v $(pwd)/data/postgres:/var/lib/postgresql/${OLD_POSTGRES}/data \
-v $(pwd)/data/postgres-new:/var/lib/postgresql/${NEW_POSTGRES}/data \
tianon/postgres-upgrade:${OLD_POSTGRES}-to-${NEW_POSTGRES}
@ -104,13 +111,13 @@ To upgrade postgres on Docker we use the [`postgres-upgrade`](https://hub.docker
7. Pull the new postgres version.
```{code-block} sh
docker-compose pull
sudo docker compose pull
```
8. Restart your containers.
```{code-block} sh
docker-compose up -d
sudo docker compose up -d
```
That's it! Your Funkwhale pod is now running the new version of postgres. The old database is available in `/srv/funkwhale/data/postgres-old`. You can back this up and remove it from your server once you've confirmed everything is working.

View File

@ -47,19 +47,19 @@ We provide a docker container for our documentation to make it easy to work on d
2. Create a dummy federation network
```{code-block} sh
docker network create federation
sudo docker network create federation
```
3. Build the container
```{code-block} sh
docker-compose -f dev.yml build docs
sudo docker compose -f dev.yml build docs
```
4. Run the container
```{code-block} sh
docker-compose -f dev.yml up docs
sudo docker compose -f dev.yml up docs
```
A real-time preview of the documentation is available on `http://0.0.0.1:8001`

View File

@ -36,7 +36,7 @@ Try to keep your tests small and focused. Each test should test a single functio
Test files must target a module and follow the `funkwhale_api` directory structure. If you write tests for `funkwhale_api/myapp/views.py`, you should put them in `tests/myapp/test_views.py`.
```
We provide utilities and fixtures to make writing tests as easy as possible. You can see the list of available fixtures by running `docker-compose -f dev.yml run --rm api pytest --fixtures`.
We provide utilities and fixtures to make writing tests as easy as possible. You can see the list of available fixtures by running `sudo docker compose -f dev.yml run --rm api pytest --fixtures`.
### Factories
@ -134,17 +134,17 @@ def test_downgrade_not_superuser_skips_email(factories, mocker):
You can run all tests in the pytest suite with the following command:
```sh
docker-compose -f dev.yml run --rm api pytest
sudo docker compose -f dev.yml run --rm api pytest
```
Run a specific test file by calling pytest against it:
```sh
docker-compose -f dev.yml run --rm api pytest tests/music/test_models.py
sudo docker compose -f dev.yml run --rm api pytest tests/music/test_models.py
```
You can check the full list of options by passing the `-h` flag:
```sh
docker-compose -f dev.yml run --rm api pytest -h
sudo docker compose -f dev.yml run --rm api pytest -h
```

View File

@ -26,11 +26,11 @@ The Funkwhale frontend contains some tests to catch errors before changes go liv
To run the test suite, run the following command:
```sh
docker-compose -f dev.yml run --rm front yarn test:unit
sudo docker compose -f dev.yml run --rm front yarn test:unit
```
To run tests as you make changes, launch the test suite with the `-w` flag:
```sh
docker-compose -f dev.yml run --rm front yarn test:unit -w
sudo docker compose -f dev.yml run --rm front yarn test:unit -w
```

View File

@ -40,7 +40,7 @@ You can install third-party plugins using the `funkwhale-manage` command line in
:::{tab-item} Docker
```{code-block} shell
docker-compose run --rm api funkwhale-manage fw plugins install https://plugin_url.zip
sudo docker compose run --rm api funkwhale-manage fw plugins install https://plugin_url.zip
```
:::

View File

@ -3,7 +3,7 @@
Funkwhale can be run in Docker containers for local development. You can work on any part of the Funkwhale codebase and run the container setup to test your changes. To work with Docker:
1. [Install Docker](https://docs.docker.com/install)
2. [Install docker-compose](https://docs.docker.com/compose/install)
2. [Install docker compose](https://docs.docker.com/compose/install)
3. Clone the Funkwhale repository to your system. The `develop` branch is checked out by default
::::{tab-set}
@ -32,7 +32,7 @@ Funkwhale can be run in Docker containers for local development. You can work on
````{note}
Funkwhale provides a `dev.yml` file that contains the required docker-compose setup. You need to pass the `-f dev.yml` flag you run docker-compose commands to ensure it uses this file. If you don't want to add this each time, you can export it as a `COMPOSE_FILE` variable:
Funkwhale provides a `dev.yml` file that contains the required docker compose setup. You need to pass the `-f dev.yml` flag you run docker compose commands to ensure it uses this file. If you don't want to add this each time, you can export it as a `COMPOSE_FILE` variable:
```sh
export COMPOSE_FILE=dev.yml
@ -58,13 +58,13 @@ To set up your Docker environment:
3. Create a network for federation support
```sh
docker network create federation
sudo docker network create federation
```
Once you've set everything up, you need to build the containers. Run this command any time there are upstream changes or dependency changes to ensure you're up-to-date.
```sh
docker-compose -f dev.yml build
sudo docker compose -f dev.yml build
```
## Set up the database
@ -72,7 +72,7 @@ docker-compose -f dev.yml build
Funkwhale relies on a postgresql database to store information. To set this up, you need to run the `funkwhale-manage migrate` command:
```sh
docker-compose -f dev.yml run --rm api funkwhale-manage migrate
sudo docker compose -f dev.yml run --rm api funkwhale-manage migrate
```
This command creates all the required tables. You need to run this whenever there are changes to the API schema. You can run this at any time without causing issues.
@ -84,7 +84,7 @@ You need to create some local data to mimic a production environment.
1. Create a superuser so you can log in to your local app:
```sh
docker-compose -f dev.yml run --rm api funkwhale-manage createsuperuser
sudo docker compose -f dev.yml run --rm api funkwhale-manage createsuperuser
```
2. Add some fake data to populate the database. The following command creates 25 artists with random albums, tracks, and metadata.
@ -92,7 +92,7 @@ You need to create some local data to mimic a production environment.
```sh
artists=25 # Adds 25 fake artists
command="from funkwhale_api.music import fake_data; fake_data.create_data($artists)"
echo $command | docker-compose -f dev.yml run --rm -T api funkwhale-manage shell -i python
echo $command | sudo docker compose -f dev.yml run --rm -T api funkwhale-manage shell -i python
```
## Manage services
@ -102,13 +102,13 @@ Once you have set up your containers, bring them up to start working on them.
1. Compile the translations:
```sh
docker-compose -f dev.yml run --rm front yarn run i18n-compile
sudo docker compose -f dev.yml run --rm front yarn run i18n-compile
```
2. Launch all services:
```sh
docker-compose -f dev.yml up front api nginx celeryworker
sudo docker compose -f dev.yml up front api nginx celeryworker
```
This gives you access to the following:
@ -120,13 +120,13 @@ This gives you access to the following:
Once you're done with the containers, you can stop them all:
```sh
docker-compose -f dev.yml stop
sudo docker compose -f dev.yml stop
```
If you want to destroy your containers, run the following:
```sh
docker-compose -f dev.yml down -v
sudo docker compose -f dev.yml down -v
```
## Set up federation support
@ -186,7 +186,7 @@ To run a reverse proxy for your app:
2. Launch traefik using the bundled configuration:
```sh
docker-compose -f docker/traefik.yml up -d
sudo docker compose -f docker/traefik.yml up -d
```
3. Set up as many different projects as you need. Make sure the `COMPOSE_PROJECT_NAME` and `VUE_PORT` variables are unique per instance
@ -194,9 +194,9 @@ To run a reverse proxy for your app:
```sh
export COMPOSE_PROJECT_NAME=node2
export VUE_PORT=1234 # this has to be unique for each instance
docker-compose -f dev.yml run --rm api funkwhale-manage migrate
docker-compose -f dev.yml run --rm api funkwhale-manage createsuperuser
docker-compose -f dev.yml up nginx api front nginx api celeryworker
sudo docker compose -f dev.yml run --rm api funkwhale-manage migrate
sudo docker compose -f dev.yml run --rm api funkwhale-manage createsuperuser
sudo docker compose -f dev.yml up nginx api front nginx api celeryworker
```
You can access your project at `https://{COMPOSE_PROJECT_NAME}.funkwhale.test`.