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
commit 258e4ac7ab
25 changed files with 119 additions and 114 deletions

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`.