From d89d6197ab0020081eb38ff750a0593ed6bb6d10 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 27 Oct 2020 12:56:52 +0100 Subject: [PATCH] Add Lemmy Lite to federation setup and Ansible deployment --- ansible/lemmy.yml | 4 ---- ansible/templates/docker-compose.yml | 11 +++++++++-- ansible/templates/nginx.conf | 18 +++++++++++++----- docker/dev/docker-compose.yml | 6 ++++-- docker/federation/docker-compose.yml | 7 +++++++ docker/federation/nginx.conf | 7 +++++++ 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/ansible/lemmy.yml b/ansible/lemmy.yml index 28179ba41..a5006fd0b 100644 --- a/ansible/lemmy.yml +++ b/ansible/lemmy.yml @@ -78,10 +78,6 @@ vars: lemmy_docker_image: "dessalines/lemmy:{{ lookup('file', 'VERSION') }}" lemmy_docker_ui_image: "dessalines/lemmy-ui:{{ lookup('file', 'VERSION') }}" - lemmy_port: "8536" - lemmy_ui_port: "1235" - pictshare_port: "8537" - iframely_port: "8538" - name: add config file (only during initial setup) template: diff --git a/ansible/templates/docker-compose.yml b/ansible/templates/docker-compose.yml index 868505e91..219127173 100644 --- a/ansible/templates/docker-compose.yml +++ b/ansible/templates/docker-compose.yml @@ -27,6 +27,15 @@ services: depends_on: - lemmy + lemmy-lite: + image: ironoxidizer/lemmy-lite:0.3.0-rc1 + ports: + - "127.0.0.1:1131:1131" + environment: + - LEMMY_INTERNAL_HOST=lemmy:8536 + depends_on: + - lemmy + postgres: image: postgres:12-alpine environment: @@ -40,8 +49,6 @@ services: pictrs: image: asonix/pictrs:v0.2.4-r0 user: 991:991 - ports: - - "127.0.0.1:8537:8080" volumes: - ./volumes/pictrs:/mnt restart: always diff --git a/ansible/templates/nginx.conf b/ansible/templates/nginx.conf index 03b139bb0..72da0f5e6 100644 --- a/ansible/templates/nginx.conf +++ b/ansible/templates/nginx.conf @@ -51,7 +51,7 @@ server { # Upload limit for pictrs client_max_body_size 20M; - # frontend + # standard frontend location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; @@ -61,21 +61,29 @@ server { # lemmy_ui_port: 1235 # lemmy_port: 8536 - set $proxpass "http://0.0.0.0:{{ lemmy_ui_port }}"; + set $proxpass "http://0.0.0.0:1235"; if ($http_accept = "application/activity+json") { - set $proxpass "http://0.0.0.0:{{ lemmy_port }}"; + set $proxpass "http://0.0.0.0:8536"; } if ($request_method = POST) { - set $proxpass "http://0.0.0.0:{{ lemmy_port }}"; + set $proxpass "http://0.0.0.0:8536"; } proxy_pass $proxpass; rewrite ^(.+)/+$ $1 permanent; } + # lemmy lite frontend + location /lite { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass "http://0.0.0.0:1131"; + } + # backend location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) { - proxy_pass http://0.0.0.0:{{ lemmy_port }}; + proxy_pass http://0.0.0.0:8536; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index c2d09d10b..ab74211da 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -27,9 +27,11 @@ services: depends_on: - lemmy lemmy-lite: - image: lemmy-lite + image: ironoxidizer/lemmy-lite:0.3.0-rc1 ports: - - "1132:1131" + - "1131:1131" + environment: + - LEMMY_INTERNAL_HOST=lemmy:8536 depends_on: - lemmy diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 094709771..47013c1ea 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -16,6 +16,7 @@ services: - pictrs - iframely - lemmy-alpha-ui + - lemmy-alpha-lite - lemmy-beta-ui - lemmy-gamma-ui - lemmy-delta-ui @@ -36,6 +37,12 @@ services: - LEMMY_HTTPS=false depends_on: - lemmy-alpha + lemmy-alpha-lite: + image: ironoxidizer/lemmy-lite:0.3.0-rc1 + environment: + - LEMMY_INTERNAL_HOST=lemmy-alpha:8541 + depends_on: + - lemmy-alpha lemmy-alpha: image: lemmy-federation:latest environment: diff --git a/docker/federation/nginx.conf b/docker/federation/nginx.conf index 003f88dc0..e75301947 100644 --- a/docker/federation/nginx.conf +++ b/docker/federation/nginx.conf @@ -43,6 +43,13 @@ http { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } + location /lite { + proxy_pass http://lemmy-alpha-lite:1131; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } } upstream lemmy-beta {