How I configured development setup with federation. Step by step.
System: Ubuntu 20.04
docker-compose version 1.25.0, build unknown
Docker version 20.10.14, build a224086
TL;DR: instructions at https://docs.funkwhale.audio/contributing.html#working-with-federation-locally work. Although we might improve them for clarity.
First of all:
sudo docker system prune -a
Probably overkill, but I want to be sure that all networks are deleted, and no built cache interferes in any sense. I don't trust my limited understanding about docker.
git clone git@dev.funkwhale.audio:funkwhale/funkwhale.git funkwhale-federation
cd funkwhale-federation
Add this entries to /etc/hosts:
172.17.0.1 node1.funkwhale.test
172.17.0.1 node2.funkwhale.test
Create federation network:
docker network create federation
Follow the steps from here https://docs.funkwhale.audio/contributing.html#working-with-federation-locally
- sudo cp docker/ssl/test.crt /usr/local/share/ca-certificates/
- sudo update-ca-certificates
Create .env file with this content:
# This will ensure we don't bind any port on the host, and thus enable
# multiple instances of funkwhale to be spawned concurrently.
VUE_PORT_BINDING=
# This disable certificate verification
EXTERNAL_REQUESTS_VERIFY_SSL=false
# this ensure you don't have incorrect urls pointing to http resources
FUNKWHALE_PROTOCOL=https
# Disable host ports binding for the nginx container, as traefik is serving everything
NGINX_PORTS_MAPPING=80
Build container:
docker-compose -f dev.yml build
In one terminal tab:
docker-compose -f docker/traefik.yml up
In a second tab:
export COMPOSE_PROJECT_NAME=node1
export VUE_PORT=8888
docker-compose -f dev.yml run --rm api python manage.py migrate
docker-compose -f dev.yml run --rm api python manage.py createsuperuser
docker-compose -f dev.yml up nginx api front nginx api celeryworker
In a third tab:
export COMPOSE_PROJECT_NAME=node2
export VUE_PORT=9999
docker-compose -f dev.yml run --rm api python manage.py migrate
docker-compose -f dev.yml run --rm api python manage.py createsuperuser
docker-compose -f dev.yml up nginx api front nginx api celeryworker
Open https://node1.funkwhale.test/ in Firefox (accept risk and continue.…):
Log in then add content (upload icon, top right column), => Publish your work in a channel => add new channel => artist discography | name: node1 channel => create channel. Once created I create an new album and add some songs to that album. Then publish.
Open new browser tab https://node2.funkwhale.test/ (accept risk and continue...)
Channels => add new => introduce @node1channel@node1.funkwhale.test
It fails:
node1:
INFO: 172.19.0.7:33444 - "GET /federation/actors/node1channel HTTP/1.1" 403 Forbidden
I try with RSS:
api_1 | INFO: 172.19.0.7:33816 - "GET /api/v1/channels/node1channel/rss HTTP/1.1" 401 Unauthorized
I decide to try with libraries. I create one in node1, with "everyone across all instances" visibility. I try to follow from node2, it fails with another 403 http error, but when I try a second time it succeeds!
[upl-image-preview url=https://forum.funkwhale.audio/assets/files/2022-04-14/1649957613-39120-image.png]
So I decide to try again with the channel. This time it works!
[upl-image-preview url=https://forum.funkwhale.audio/assets/files/2022-04-14/1649957547-512373-image.png]
I don't know what happened, since I didn't modify anything before the successful attempts. My guess is that the instances needed some time to sync?