From 0d369e60197fd8a967200ee6c02a9f84beaf5dca Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 28 Mar 2020 17:30:59 +0100 Subject: [PATCH] Get image uploads working for federation-test --- docker/federation-test/docker-compose.yml | 37 +++++++++--- docker/federation-test/nginx.conf | 73 +++++++++++++++++++++++ 2 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 docker/federation-test/nginx.conf diff --git a/docker/federation-test/docker-compose.yml b/docker/federation-test/docker-compose.yml index de539237..91f167c4 100644 --- a/docker/federation-test/docker-compose.yml +++ b/docker/federation-test/docker-compose.yml @@ -1,17 +1,30 @@ version: '3.3' services: + nginx: + image: nginx:1.17-alpine + ports: + - "8540:8540" + - "8550:8550" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + depends_on: + - lemmy_alpha + - pictshare_alpha + - lemmy_beta + - pictshare_beta + - iframely + restart: "always" + lemmy_alpha: image: lemmy-federation-test:latest - ports: - - "127.0.0.1:8540:8540" environment: - LEMMY_HOSTNAME=lemmy_alpha:8540 - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy - LEMMY_JWT_SECRET=changeme - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - - LEMMY_FEDERATION__FOLLOWED_INSTANCES=lemmy_beta:8541 + - LEMMY_FEDERATION__FOLLOWED_INSTANCES=lemmy_beta:8550 - LEMMY_FEDERATION__TLS_ENABLED=false - LEMMY_PORT=8540 - RUST_BACKTRACE=1 @@ -27,20 +40,23 @@ services: volumes: - ./volumes/postgres_alpha:/var/lib/postgresql/data restart: always + pictshare_alpha: + image: shtripok/pictshare:latest + volumes: + - ./volumes/pictshare_alpha:/usr/share/nginx/html/data + restart: always lemmy_beta: image: lemmy-federation-test:latest - ports: - - "127.0.0.1:8541:8541" environment: - - LEMMY_HOSTNAME=lemmy_beta:8541 + - LEMMY_HOSTNAME=lemmy_beta:8550 - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy - LEMMY_JWT_SECRET=changeme - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__FOLLOWED_INSTANCES=lemmy_alpha:8540 - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_PORT=8541 + - LEMMY_PORT=8550 - RUST_BACKTRACE=1 restart: always depends_on: @@ -54,11 +70,14 @@ services: volumes: - ./volumes/postgres_beta:/var/lib/postgresql/data restart: always + pictshare_beta: + image: shtripok/pictshare:latest + volumes: + - ./volumes/pictshare_beta:/usr/share/nginx/html/data + restart: always iframely: image: dogbin/iframely:latest - ports: - - "127.0.0.1:8061:80" volumes: - ../iframely.config.local.js:/iframely/config.local.js:ro restart: always diff --git a/docker/federation-test/nginx.conf b/docker/federation-test/nginx.conf new file mode 100644 index 00000000..96fbf997 --- /dev/null +++ b/docker/federation-test/nginx.conf @@ -0,0 +1,73 @@ +events { + worker_connections 1024; +} + +http { + server { + listen 8540; + server_name 127.0.0.1; + + # Upload limit for pictshare + client_max_body_size 50M; + + location / { + proxy_pass http://lemmy_alpha:8540; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # WebSocket support + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location /pictshare/ { + proxy_pass http://pictshare_alpha:80/; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /iframely/ { + proxy_pass http://iframely:80/; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } + + server { + listen 8550; + server_name 127.0.0.1; + + # Upload limit for pictshare + client_max_body_size 50M; + + location / { + proxy_pass http://lemmy_beta:8540; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # WebSocket support + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location /pictshare/ { + proxy_pass http://pictshare_beta:80/; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /iframely/ { + proxy_pass http://iframely:80/; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } +} -- 2.44.1