docs(developer/setup/docker): refine
This commit is contained in:
		
							parent
							
								
									0587779127
								
							
						
					
					
						commit
						22edb05a99
					
				| 
						 | 
				
			
			@ -33,10 +33,13 @@ Funkwhale can be run in Docker containers for local development. You can work on
 | 
			
		|||
   ::::
 | 
			
		||||
 | 
			
		||||
6. Activate the pre-commit hook:
 | 
			
		||||
 | 
			
		||||
   ```sh
 | 
			
		||||
   pre-commit install
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
7. Finally, initialise the environment:
 | 
			
		||||
 | 
			
		||||
   ```sh
 | 
			
		||||
   cp .env.example .env
 | 
			
		||||
   ```
 | 
			
		||||
| 
						 | 
				
			
			@ -50,16 +53,18 @@ Funkwhale provides a `compose.yml` file following the default file naming conven
 | 
			
		|||
To set up your Docker environment:
 | 
			
		||||
 | 
			
		||||
1. Create a network for federation support via the web proxy:
 | 
			
		||||
 | 
			
		||||
   ```sh
 | 
			
		||||
   docker network create web
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
2. Then build the application containers. Run this command any time there are upstream changes or dependency changes to ensure you're up-to-date.
 | 
			
		||||
 | 
			
		||||
   ```sh
 | 
			
		||||
   docker compose build
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
## Set up auxiliary services
 | 
			
		||||
## Set up network services
 | 
			
		||||
 | 
			
		||||
To support ActivityPub in the local development environment, we use a
 | 
			
		||||
combination of auxiliary services that provide DNS-based discovery, local email delivery and web/TLS termination. This also has the benefit that we can talk to
 | 
			
		||||
| 
						 | 
				
			
			@ -85,9 +90,11 @@ The services bind to the following ports on the default Docker bridge network:
 | 
			
		|||
1. Create a wildcard certificate for the Common Name (CN) `funkwhale.test` and
 | 
			
		||||
   the Subject Alternative Name (SAN) `*.funkwhale.test` which will be
 | 
			
		||||
   installed into your system and browser trust stores with:
 | 
			
		||||
 | 
			
		||||
   ```sh
 | 
			
		||||
   mkcert -install -cert-file compose/var/test.crt -key-file compose/var/test.key "funkwhale.test" "*.funkwhale.test"
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
   It will be used by Træefik to secure connections, which is needed for
 | 
			
		||||
   ActivityPub to work locally.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -318,9 +325,9 @@ Set up as many different projects as you need. Make sure the
 | 
			
		|||
`COMPOSE_PROJECT_NAME` and `VUE_PORT` variables are unique per instance.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
export COMPOSE_PROJECT_NAME=node2
 | 
			
		||||
export COMPOSE_PROJECT_NAME=node1
 | 
			
		||||
# VUE_PORT this has to be unique for each instance
 | 
			
		||||
export VUE_PORT=1234
 | 
			
		||||
export VUE_PORT=8081
 | 
			
		||||
docker compose run --rm api funkwhale-manage fw users create --superuser
 | 
			
		||||
docker compose up -d
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			@ -333,23 +340,29 @@ You can access your project at `https://{COMPOSE_PROJECT_NAME}.funkwhale.test`.
 | 
			
		|||
You may as well address the different Compose projects by using ad hoc
 | 
			
		||||
environment variables:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
COMPOSE_PROJECT_NAME=node1 VUE_PORT=1234 docker compose run --rm api funkwhale-manage fw users create --superuser
 | 
			
		||||
COMPOSE_PROJECT_NAME=node1 VUE_PORT=1234 docker compose up -d
 | 
			
		||||
```sh
 | 
			
		||||
COMPOSE_PROJECT_NAME=node1 VUE_PORT=8081 docker compose run --rm api funkwhale-manage fw users create --superuser
 | 
			
		||||
COMPOSE_PROJECT_NAME=node1 VUE_PORT=8081 docker compose up -d
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The `node1` instance will be available at [https://node1.funkwhale.test](https://node1.funkwhale.test).
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
COMPOSE_PROJECT_NAME=node2 VUE_PORT=1235 docker compose run --rm api funkwhale-manage fw users create --superuser
 | 
			
		||||
COMPOSE_PROJECT_NAME=node2 VUE_PORT=1235 docker compose up -d
 | 
			
		||||
```sh
 | 
			
		||||
COMPOSE_PROJECT_NAME=node2 VUE_PORT=8082 docker compose run --rm api funkwhale-manage fw users create --superuser
 | 
			
		||||
COMPOSE_PROJECT_NAME=node2 VUE_PORT=8082 docker compose up -d
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The `node2` instance will be available at [https://node2.funkwhale.test](https://node2.funkwhale.test).
 | 
			
		||||
 | 
			
		||||
Proceed freely with different sets of values for `COMPOSE_PROJECT_NAME` and
 | 
			
		||||
Proceed freely with different sets of non-overlapping values for `COMPOSE_PROJECT_NAME` and
 | 
			
		||||
`VUE_PORT`.
 | 
			
		||||
 | 
			
		||||
As a rule of thumb, remember to:
 | 
			
		||||
 | 
			
		||||
- Prepend `COMPOSE_PROJECT_NAME=node1 VUE_PORT=8081` to the lifecycle commands `up` and `run` to execute containers of additional instances.
 | 
			
		||||
- Prepend `COMPOSE_PROJECT_NAME=node1` to any other `docker compose` command to work with the indicated instance.
 | 
			
		||||
 | 
			
		||||
By example, this mechanic also applies to the [set up of local data for development](#set-up-local-data-for-development) above.
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
::::{tab-set}
 | 
			
		||||
| 
						 | 
				
			
			@ -416,11 +429,9 @@ To build the documentation locally run:
 | 
			
		|||
docker compose -f compose.docs.yml up -d
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The documentation is then accessible at [https://docs.funkwhale.test](https://docs.funkwhale.test). The OpenAPI schema is available at [https://openapi.funkwhale.test](https://openapi.funkwhale.test).
 | 
			
		||||
The documentation is then accessible at <https://docs.funkwhale.test>. The OpenAPI schema is available at <https://openapi.funkwhale.test>. The UI component library will be served at <https://ui.funkwhale.test>.
 | 
			
		||||
 | 
			
		||||
Fallback ports are available for the documentation at
 | 
			
		||||
[http://localhost:8001/](http://localhost:8001/) and for the OpenAPI schema at
 | 
			
		||||
[http://localhost:8002/](http://localhost:8002/).
 | 
			
		||||
Fallback ports are available for the documentation at <http://localhost:8001/>, for the OpenAPI schema at <http://localhost:8002/> and for the UI component library at <http://localhost:8003/>.
 | 
			
		||||
 | 
			
		||||
Maintain their life cycle with similar commands to those used to
 | 
			
		||||
[set up auxiliary services (point 2.)](#set-up-auxiliary-services).
 | 
			
		||||
[set up network services (point 2.)](#set-up-network-services).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue