While Snikket is often deployed as a single Docker image,
running it behind an existing reverse proxy like Caddy requires breaking it down into its core components:
-
The Server (Prosody): The brain of the XMPP operations.
-
The Portal: The web interface for users and admins.
-
The Cert-Manager: To handle XMPP-specific encryption
Following Snikket’s tutorial, it’s straightforward to deploy all these services in a docker-composer
but only if they act as a hole and not behind a reverse proxy
docker-compose.yml
snikket_certs:
container_name: snikket-certs
image: snikket/snikket-cert-manager:stable
networks:
- gotosocial
env_file: snikket.conf
volumes:
- snikket_data:/snikket
- acme_challenges:/var/www/.well-known/acme-challenge
restart: "unless-stopped"
snikket_portal:
container_name: snikket-portal
image: snikket/snikket-web-portal:stable
networks:
- gotosocial
env_file: snikket.conf
restart: "unless-stopped"
snikket_server:
container_name: snikket
image: snikket/snikket-server:stable
networks:
- gotosocial
expose:
- "5280"
- "5281"
ports:
- "5222:5222" # XMPP Client
- "5269:5269" # XMPP Federation
- "3478:3478" # TURN
- "3478:3478/udp"
- "5000:5000/tcp"
- "5000:5000/udp"
volumes:
- snikket_data:/snikket
env_file: snikket.conf
restart: "unless-stopped"
snikket.conf
SNIKKET_DOMAIN=chat.jagedn.dev
SNIKKET_ADMIN_EMAIL=jorge@edn.es
(I will omit the part you need to configure DNS in your internet provider as the aim of the post
is not a HOWTO install Snikket)
Caddyfile
social.jagedn.dev {
reverse_proxy gotosocial:8080
}
chat.jagedn.dev,
groups.chat.jagedn.dev,
share.chat.jagedn.dev {
handle_path /.well-known/acme-challenge/* {
root * /var/www/challenges
file_server
}
handle {
reverse_proxy snikket_portal:5765
}
}
As the Cert-Manager is responsible to negociate the certificate for mobile comms, we have
to align it with Caddy. This part was solved easily sharing the acme_challenges folder
Also, the docker-compose uses typical ports 443 and 80, but in my case Caddy manages these ports
Another issue is that with this default mapping, the portal tries to talk to the server via 127.0.0.1, which fails in a multi-container Docker setup, and we need to find the way to configure the services.
After several tries and errors, and digging a lot into the Snikket GitHub repo, I was able to figure
how to configure all the pieces