I’ve added a local voyager (previously wefwef) instance to my set of Lemmy docker containers.
#NGINX:
Added in this to the default from Lemmy:
# Define where we send voyager traffic
upstream voyager {
server "voyager:5314";
}
server {
# Rewrite requests to 80 to https on 443
listen 80;
server_name voyager.mydomain.com;
root /nowhere;
rewrite ^ https://$server_name$request_uri permanent;
}
server {
# Rewrite requests to 80 to https on 443
listen 80;
server_name lemmy.mydomain.com;
root /nowhere;
rewrite ^ https://$server_name$request_uri permanent;
}
# Listen on 443 for voyager and send it to our upstream
server {
listen 443 ssl;
server_name voyager.mydomain.com;
ssl_certificate /certs/voyager/fullchain.pem;
ssl_certificate_key /certs/voyager/key.pem;
include /certs/options-ssl-nginx.conf;
location / {
proxy_pass http://voyager;
}
}
I also added an http (80) --> https (443) redirect as well. This accounts for browsers like Safari that don’t automatically try HTTPS.
Here we’re listening on port 80 for each hostname (in our case lemmy and voyager), then sending a redirect to a URL made up of the same server name and path, with https:// on the front.
For voyager on 443 we then send it to the defined upstream, after using our SSL certs to auth the https request with the client.
#Docker Compose
For our docker compose we add in our voyager section to spin up that container:
voyager:
image: ghcr.io/aeharding/voyager:latest
hostname: voyager
ports:
- "5314:5314"
restart: always
logging: *default-logging
environment:
- CUSTOM_LEMMY_SERVERS=lemmy.mydomain.com
depends_on:
- lemmy
- lemmy-ui
dns:
- 192.168.1.1
Here we’re exposing 5314 as our port, which maps to the 5314 port in our upstream in nginx, so nginx proxies to it.
You can define which lemmy servers you want to point to in the default sign-in dialog. Here we define our own, but you could make this a list of whichever other lemmy instances you want to. It’s comma-delimited (from memory)
After that we can just:
docker-compose up -d
And it’ll start-up the new container, and nginx will proxy to it. That’s it.
##NOTES You’ll need new certs for your voyager hostname in whichever directory you map your certs to in the proxy part of the docker-compose, in addition to specific lemmy certs.
See my previous post for more details there.