Fix nginx config for local federation setup (#104)

Fix depends_on

Add note about different port for backend in federation docs

Fix nginx config for local federation setup

Co-authored-by: Felix Ableitner <me@nutomic.com>
Reviewed-on: https://yerbamate.dev/LemmyNet/lemmy/pulls/104
This commit is contained in:
nutomic 2020-09-24 13:50:38 +00:00 committed by dessalines
parent ab17e0a9f3
commit e8ea0664ef
3 changed files with 81 additions and 24 deletions

View file

@ -15,11 +15,11 @@ services:
depends_on:
- pictrs
- iframely
- lemmy-alpha
- lemmy-beta
- lemmy-gamma
- lemmy-delta
- lemmy-epsilon
- lemmy-alpha-ui
- lemmy-beta-ui
- lemmy-gamma-ui
- lemmy-delta-ui
- lemmy-epsilon-ui
pictrs:
restart: always

View file

@ -3,6 +3,12 @@ events {
}
http {
upstream lemmy-alpha {
server "lemmy-alpha:8541";
}
upstream lemmy-alpha-ui {
server "lemmy-alpha-ui:1234";
}
server {
listen 8540;
server_name 127.0.0.1;
@ -11,14 +17,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-alpha:8541/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-alpha;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-alpha-ui:1234;
set $proxpass http://lemmy-alpha-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-alpha;
}
proxy_pass $proxpass;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -34,6 +45,12 @@ http {
}
}
upstream lemmy-beta {
server "lemmy-beta:8551";
}
upstream lemmy-beta-ui {
server "lemmy-beta-ui:1234";
}
server {
listen 8550;
server_name 127.0.0.1;
@ -42,14 +59,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-beta:8551/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-beta;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-beta-ui:1234;
set $proxpass http://lemmy-beta-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-beta;
}
proxy_pass $proxpass;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -65,6 +87,12 @@ http {
}
}
upstream lemmy-gamma {
server "lemmy-gamma:8561";
}
upstream lemmy-gamma-ui {
server "lemmy-gamma-ui:1234";
}
server {
listen 8560;
server_name 127.0.0.1;
@ -73,14 +101,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-gamma:8561/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-gamma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-gamma-ui:1234;
set $proxpass http://lemmy-gamma-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-gamma;
}
proxy_pass $proxpass;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -96,6 +129,12 @@ http {
}
}
upstream lemmy-delta {
server "lemmy-delta:8571";
}
upstream lemmy-delta-ui {
server "lemmy-delta-ui:1234";
}
server {
listen 8570;
server_name 127.0.0.1;
@ -104,14 +143,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-delta:8571/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-delta;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-delta-ui:1234;
set $proxpass http://lemmy-delta-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-delta;
}
proxy_pass $proxpass;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -127,6 +171,12 @@ http {
}
}
upstream lemmy-epsilon {
server "lemmy-epsilon:8581";
}
upstream lemmy-epsilon-ui {
server "lemmy-epsilon-ui:1234";
}
server {
listen 8580;
server_name 127.0.0.1;
@ -135,14 +185,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-epsilon:8581/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-epsilon;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-epsilon-ui:1234;
set $proxpass http://lemmy-epsilon-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-epsilon;
}
proxy_pass $proxpass;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -21,10 +21,12 @@ lemmy-epsilon | lemmy_epsilon | [127.0.0.1:8580](http://127.0.0.1:8580) | uses b
You can log into each using the instance name, and `lemmy` as the password, IE (`lemmy_alpha`, `lemmy`).
To start federation between instances, visit one of them and search for a user, community or post, like this:
- `!main@lemmy-alpha:8540`
- `http://lemmy-beta:8550/post/3`
- `@lemmy-gamma@lemmy-gamma:8560`
To start federation between instances, visit one of them and search for a user, community or post, like this. Note that
the Lemmy backend runs on a different port than the frontend, so you have to increment the port number from
the URL bar by one.
- `!main@lemmy-alpha:8541`
- `http://lemmy-beta:8551/post/3`
- `@lemmy-gamma@lemmy-gamma:8561`
Firefox containers are a good way to test them interacting.