Docs(Docker): Adapt setup instructions for new development environments
co-authored-by: upsiflu@gmail.com co-authored-by: jon@allmende.io
This commit is contained in:
		
							parent
							
								
									26295c08f7
								
							
						
					
					
						commit
						b1be4be6a0
					
				|  | @ -52,7 +52,7 @@ To set up your Docker environment: | |||
| 3. Create a network for federation support | ||||
| 
 | ||||
|    ```sh | ||||
|    sudo docker network create federation | ||||
|    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. | ||||
|  | @ -61,52 +61,47 @@ Once you've set everything up, you need to build the containers. Run this comman | |||
| docker compose build | ||||
| ``` | ||||
| 
 | ||||
| ## Set up the database | ||||
| 
 | ||||
| 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 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. | ||||
| 
 | ||||
| ## Set up local data | ||||
| 
 | ||||
| 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 run --rm api funkwhale-manage fw users create --superuser | ||||
|    ``` | ||||
| 
 | ||||
| 2. Add some fake data to populate the database. The following command creates 25 artists with random albums, tracks, and metadata. | ||||
| 
 | ||||
|    ```sh | ||||
|    artists=25 # Adds 25 fake artists | ||||
|    command="from funkwhale_api.music import fake_data; fake_data.create_data($artists)" | ||||
|    echo $command | docker compose run --rm -T api funkwhale-manage shell -i python | ||||
|    ``` | ||||
| 
 | ||||
| ## Manage services | ||||
| 
 | ||||
| Once you have set up your containers, launch all services to start working on them: | ||||
| 
 | ||||
| ::::{tab-set} | ||||
| 
 | ||||
| :::{tab-item} Multi node federation testnet (Default) | ||||
| 
 | ||||
| ```sh | ||||
| docker compose -f compose.net.yml up -d | ||||
| docker compose up -d | ||||
| ``` | ||||
| 
 | ||||
| This gives you access to the following: | ||||
| 
 | ||||
| - The Funkwhale webapp on `http://localhost:8000` | ||||
| - The Funkwhale web app on `https://funkwhale.funkwhale.test` | ||||
| - The Funkwhale API on `https://funkwhale.funkwhale.test/api/v1` | ||||
| - The Django admin interface on `https://funkwhale.funkwhale.test/api/admin` | ||||
| 
 | ||||
| ::: | ||||
| 
 | ||||
| :::{tab-item} Single node local development | ||||
| 
 | ||||
| ```sh | ||||
| docker compose -f compose.yml -f compose.local.yml up -d | ||||
| ``` | ||||
| 
 | ||||
| This gives you access to the following: | ||||
| 
 | ||||
| - The Funkwhale web app on `http://localhost:8000` | ||||
| - The Funkwhale API on `http://localhost:8000/api/v1` | ||||
| - The Django admin interface on `http://localhost:8000/api/admin` | ||||
| 
 | ||||
| Please note that at this stage, login will only work if you choose to run this together with the `single-node` overlay: | ||||
| ::: | ||||
| 
 | ||||
| :::: | ||||
| 
 | ||||
| To be able to login create a local superuser: | ||||
| 
 | ||||
| ```sh | ||||
| docker compose -f compose.yml -f compose.single-node.yml up -d | ||||
| docker compose run --rm api funkwhale-manage fw users create --superuser | ||||
| ``` | ||||
| 
 | ||||
| Once you're done with the containers, you can stop them all: | ||||
|  | @ -127,9 +122,21 @@ To also destroy the state of your containers, run: | |||
| docker compose down -v | ||||
| ``` | ||||
| 
 | ||||
| ## Set up local data | ||||
| 
 | ||||
| You can create local data to mimic a live environment. | ||||
| 
 | ||||
| Add some fake data to populate the database. The following command creates 25 artists with random albums, tracks, and metadata. | ||||
| 
 | ||||
| ```sh | ||||
| artists=25 # Adds 25 fake artists | ||||
| command="from funkwhale_api.music import fake_data; fake_data.create_data($artists)" | ||||
| echo $command | docker compose run --rm -T api funkwhale-manage shell -i python | ||||
| ``` | ||||
| 
 | ||||
| ## Set up federation support | ||||
| 
 | ||||
| Working on federation features requires some additional setup. You need to do the following: | ||||
| Working on federation features requires additional setup. You need to do the following: | ||||
| 
 | ||||
| 1. Update your DNS resolver to resolve all your `.test` hostnames locally | ||||
| 2. Set up a reverse proxy (such as traefik) to catch `.test` requests with a TLS certificate | ||||
|  | @ -171,14 +178,14 @@ sudo resolvectl dns docker0 172.17.0.1 | |||
| 
 | ||||
| To add a wildcard certificate, copy the test certificate from the `docker/ssl` folder to your system store. This certificate is a wildcard for `*.funkwhale.test`. | ||||
| 
 | ||||
| For Debian-based systems, like Ubuntu, run: | ||||
| For Debian-based systems like Ubuntu, run: | ||||
| 
 | ||||
| ```sh | ||||
| sudo cp docker/ssl/test.crt /usr/local/share/ca-certificates/ | ||||
| sudo update-ca-certificates | ||||
| ``` | ||||
| 
 | ||||
| For RHEL-based systems, like Fedora, run: | ||||
| For RHEL-based systems like Fedora, run: | ||||
| 
 | ||||
| ```sh | ||||
| sudo cp docker/ssl/test.crt /etc/pki/ca-trust/source/anchors/ | ||||
|  | @ -215,9 +222,13 @@ To run a reverse proxy for your app: | |||
|    export COMPOSE_PROJECT_NAME=node2 | ||||
|    # VUE_PORT this has to be unique for each instance | ||||
|    export VUE_PORT=1234 | ||||
|    docker compose run --rm api funkwhale-manage migrate | ||||
|    docker compose run --rm api funkwhale-manage fw users create --superuser | ||||
|    docker compose up -d | ||||
|    ``` | ||||
| 
 | ||||
|    You can access your project at `https://{COMPOSE_PROJECT_NAME}.funkwhale.test`. | ||||
| 
 | ||||
| ## Known issues and workarounds | ||||
| 
 | ||||
| - (systemd-resolved) Under certain conditions the `docker0` bridge does not stay up, which in turn deactivates any DNS configuration associated to the interface. Uncomment the prepared resolved helper in line #6 of `compose.net.yml` to fix this issue and restart the networking stack. `docker compose -f compose.net.yml up -d` | ||||
| - Broken federation on Alpine containers | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 ArneBo
						ArneBo