Merge pull request #1146 from LemmyNet/fix_nginx_docs

Fix nginx docs, fix test deploy.
pull/1149/head
Nutomic 2020-09-22 19:02:46 +00:00 committed by GitHub
commit 440dba4372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 39 deletions

View File

@ -51,17 +51,27 @@ server {
# Upload limit for pictrs # Upload limit for pictrs
client_max_body_size 20M; client_max_body_size 20M;
# lemmy api # frontend
location /api/v1 { location / {
proxy_pass http://0.0.0.0:8536/api/v1;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Cuts off the trailing slash on URLs to make them valid set $proxpass "http://0.0.0.0:{{ lemmy_ui_port }}";
rewrite ^(.+)/+$ $1 permanent; if ($http_accept = "application/activity+json") {
set $proxpass "http://0.0.0.0:{{ lemmy_port }}";
}
if ($request_method = POST) {
set $proxpass "http://0.0.0.0:{{ lemmy_port }}";
}
proxy_pass $proxpass;
# WebSocket support rewrite ^(.+)/+$ $1 permanent;
}
# backend
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://0.0.0.0:{{ lemmy_port }};
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
@ -70,36 +80,12 @@ server {
limit_req zone=lemmy_ratelimit burst=30 nodelay; limit_req zone=lemmy_ratelimit burst=30 nodelay;
} }
# Docs
location /docs {
proxy_pass http://0.0.0.0:8536/docs;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# lemmy-ui
location / {
proxy_pass http://0.0.0.0:1235;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Redirect pictshare images to pictrs # Redirect pictshare images to pictrs
location ~ /pictshare/(.*)$ { location ~ /pictshare/(.*)$ {
return 301 /pictrs/image/$1; return 301 /pictrs/image/$1;
} }
# Separate location block to disable rate limiting for images
location /pictrs {
proxy_pass http://0.0.0.0:8536/pictrs;
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/ { location /iframely/ {
proxy_pass http://0.0.0.0:8061/; proxy_pass http://0.0.0.0:8061/;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View File

@ -1,18 +1,14 @@
#!/bin/bash #!/bin/bash
set -e set -e
BRANCH=$1
git checkout $BRANCH
export COMPOSE_DOCKER_CLI_BUILD=1 export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1 export DOCKER_BUILDKIT=1
# Rebuilding dev docker # Rebuilding dev docker
sudo docker build ../../ -f . -t "dessalines/lemmy:$BRANCH" sudo docker build ../../ -f . -t "dessalines/lemmy:dev"
sudo docker push "dessalines/lemmy:$BRANCH" sudo docker push "dessalines/lemmy:dev"
# Run the playbook # Run the playbook
pushd ../../../lemmy-ansible # pushd ../../../lemmy-ansible
ansible-playbook -i test playbooks/site.yml # ansible-playbook -i test playbooks/site.yml
popd # popd