From f40f74b20d736b72152ffdf3823026b9bce6f920 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 3 Jun 2020 17:55:32 -0400 Subject: Adding additional 3-instance integration test for community announce. --- docker/federation-test/run-tests.sh | 1 + docker/federation/docker-compose.yml | 41 ++++++++++++++++++++++++++++++++++-- docker/federation/nginx.conf | 35 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/docker/federation-test/run-tests.sh b/docker/federation-test/run-tests.sh index 9d8a7e58..b2d319dd 100755 --- a/docker/federation-test/run-tests.sh +++ b/docker/federation-test/run-tests.sh @@ -14,6 +14,7 @@ yarn echo "Waiting for Lemmy to start..." while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8540/api/v1/site')" != "200" ]]; do sleep 1; done while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8550/api/v1/site')" != "200" ]]; do sleep 1; done +while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8560/api/v1/site')" != "200" ]]; do sleep 1; done yarn api-test || true popd diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 496e7fa6..3f986a81 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -6,6 +6,7 @@ services: ports: - "8540:8540" - "8550:8550" + - "8560:8560" volumes: # Hack to make this work from both docker/federation/ and docker/federation-test/ - ../federation/nginx.conf:/etc/nginx/nginx.conf @@ -14,6 +15,8 @@ services: - pictshare_alpha - lemmy_beta - pictshare_beta + - lemmy_gamma + - pictshare_gamma - iframely restart: "always" @@ -26,7 +29,7 @@ services: - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_beta + - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_beta,lemmy_gamma - LEMMY_PORT=8540 - LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha - LEMMY_SETUP__ADMIN_PASSWORD=lemmy @@ -60,7 +63,7 @@ services: - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_alpha + - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_alpha,lemmy_gamma - LEMMY_PORT=8550 - LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta - LEMMY_SETUP__ADMIN_PASSWORD=lemmy @@ -85,6 +88,40 @@ services: - ./volumes/pictshare_beta:/usr/share/nginx/html/data restart: always + lemmy_gamma: + image: lemmy-federation:latest + environment: + - LEMMY_HOSTNAME=lemmy_gamma:8560 + - LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_gamma:5432/lemmy + - LEMMY_JWT_SECRET=changeme + - LEMMY_FRONT_END_DIR=/app/dist + - LEMMY_FEDERATION__ENABLED=true + - LEMMY_FEDERATION__TLS_ENABLED=false + - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_alpha,lemmy_beta + - LEMMY_PORT=8560 + - LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma + - LEMMY_SETUP__ADMIN_PASSWORD=lemmy + - LEMMY_SETUP__SITE_NAME=lemmy_gamma + - RUST_BACKTRACE=1 + - RUST_LOG=debug + restart: always + depends_on: + - postgres_gamma + postgres_gamma: + image: postgres:12-alpine + environment: + - POSTGRES_USER=lemmy + - POSTGRES_PASSWORD=password + - POSTGRES_DB=lemmy + volumes: + - ./volumes/postgres_gamma:/var/lib/postgresql/data + restart: always + pictshare_gamma: + image: shtripok/pictshare:latest + volumes: + - ./volumes/pictshare_gamma:/usr/share/nginx/html/data + restart: always + iframely: image: dogbin/iframely:latest volumes: diff --git a/docker/federation/nginx.conf b/docker/federation/nginx.conf index c0633ea4..a73b0954 100644 --- a/docker/federation/nginx.conf +++ b/docker/federation/nginx.conf @@ -72,4 +72,39 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } + + server { + listen 8560; + server_name 127.0.0.1; + access_log off; + + # Upload limit for pictshare + client_max_body_size 50M; + + location / { + proxy_pass http://lemmy_gamma:8560; + 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_gamma: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; + } + } } -- cgit v1.2.3