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:
Funkwhale provides a `compose.yml` file following the default file naming convention of a Docker Compose manifest. For Linux users, we assume that you finished the post-install steps to [manage Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user).
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
our development instance(s) with using regular domain names.
The needed certificate is generated and installed to system and
browser with `mkcert`. Dynamic DNS resolution of local domain names in the
`funkwhale.test` zone is provided by dnsmasq. Proxying secure web traffic
between the containers and between the host and the containers is provided by
Træfik.
The services bind to the following ports on the default Docker bridge network:
<details><summary>Manage the networking services with regular <ahref="https://docs.docker.com/reference/cli/docker/compose/"target="_blank">Compose life cycle commands</a>.</summary>
3. Add the DNS search domain for `~funkwhale.test` to your system. This allows your system to dereference our domain names `funkwhale.funkwhale.test`, `node1.funkwhale.test`, `node2.…`, `…` to the IP address of the Træfik reverse proxy listening at `172.17.0.1`.
Please refer to the manual of your distribution for other configurations,
e.g. with system installations of netplan, systemd-networkd, NetworkManager, resolvconf or dnsmasq. Ensure the search domain is set to `funkwhale.test.`
and the nameserver address is set to `172.17.0.1`.
:::
:::{tab-item} Mac
To set up `172.17.0.1` as the search domain for the `funkwhale.test` zone on
your mac OS system, please follow the instructions at
[macOS: Using Custom DNS Resolvers](https://vninja.net/2020/02/06/macos-custom-dns-resolvers/).
For [Docker on Mac](https://docs.docker.com/desktop/install/mac-install/) you
will also need to install and use [recap/docker-mac-routes](https://github.com/recap/docker-mac-routes)
each time the Docker VM is restarted.
For [OrbStack]() make sure:
- to configure the
[Container IP ranges](https://docs.orbstack.dev/docker/network#container-ip-ranges)
of the Docker daemon to resemble the default Docker configuration. This
helps to recreate the expected environment for DNS + HTTPS networking.
E.g.:
```json
{
"bip": "172.17.0.1/23",
"default-address-pools": [
{ "base": "172.17.0.0/19", "size": 23 },
{ "base": "172.18.0.0/19", "size": 23 }
]
}
```
- to disable its
[HTTPS for containers](https://docs.orbstack.dev/features/https)
function, as we are supplying our own Træfik instance.
:::
::::
:::{hint}
You can now reach your Træfik dashboard at
[http://172.17.0.1:8008/dashboard/](http://172.17.0.1:8008/dashboard/). The DNS
server will answer requests to `172.17.0.1:53`. The SMTP MDA listens on
echo $command | docker compose run --rm -T api funkwhale-manage shell -i python
```
This will launch a development funkwhale instance with a super user having `COMPOSE_PROJECT_NAME` as username and `funkwhale` as password. Libraries, listenings and music data will be associated with the superuser :
```sh
export COMPOSE_PROJECT_NAME=node2 ; export VUE_PORT=8882 ; docker compose run --rm api funkwhale-manage migrate ; echo "from funkwhale_api.music import fake_data; fake_data.create_data(super_user_name=\"$COMPOSE_PROJECT_NAME\")" | docker compose run --rm -T api funkwhale-manage shell -i python ; docker compose up
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).
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/).
Maintain their life cycle with similar commands to those used to
[set up auxiliary services (point 2.)](#set-up-auxiliary-services).