Skip to content

Commit

Permalink
fix: DEV-3561: missing nginx sub-path support
Browse files Browse the repository at this point in the history
  • Loading branch information
farioas committed Oct 5, 2022
1 parent fce6e02 commit 6acc8c7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 61 deletions.
91 changes: 44 additions & 47 deletions deploy/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,53 +98,50 @@ http {
return 405;
}

location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Headers Content-Length;
add_header Access-Control-Allow-Headers Range;
add_header Strict-Transport-Security "max-age=31536000";

client_max_body_size 200m; # adjust to taste

if ($request_method = OPTIONS) {
return 204;
}

location /static {
alias /label-studio/label_studio/core/static_build/;
}

# Frontend react
# Source: https://github.com/heartexlabs/label-studio-frontend
location /label-studio-frontend {
alias /label-studio/label_studio/frontend/dist/lsf;
}

# Data Manager
# Source: https://github.com/heartexlabs/dm2
location /dm {
alias /label-studio/label_studio/frontend/dist/dm;
}

# LabelStudio frontend
# Source: https://github.com/heartexlabs/label-studio/blob/HEAD/label_studio/frontend/src
location /react-app {
alias /label-studio/label_studio/frontend/dist/react-app;
}

location /nginx_health {
return 200;
}

location /favicon.ico {
alias /label-studio/label_studio/core/static_build/images/favicon.ico;
}

try_files $uri @label_studio;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Headers Content-Length;
add_header Access-Control-Allow-Headers Range;
add_header Strict-Transport-Security "max-age=31536000";

client_max_body_size 200m; # adjust to taste

if ($request_method = OPTIONS) {
return 204;
}

location /static {
alias /label-studio/label_studio/core/static_build/;
}

# Frontend react
# Source: https://github.com/heartexlabs/label-studio-frontend
location /label-studio-frontend {
alias /label-studio/label_studio/frontend/dist/lsf;
}

# Data Manager
# Source: https://github.com/heartexlabs/dm2
location /dm {
alias /label-studio/label_studio/frontend/dist/dm;
}

location @label_studio {
# LabelStudio frontend
# Source: https://github.com/heartexlabs/label-studio/blob/HEAD/label_studio/frontend/src
location /react-app {
alias /label-studio/label_studio/frontend/dist/react-app;
}

location /nginx_health {
return 200;
}

location /favicon.ico {
alias /label-studio/label_studio/core/static_build/images/favicon.ico;
}

location / {
absolute_redirect off;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
Expand All @@ -155,13 +152,13 @@ http {
proxy_set_header X-Request-ID $request_id;
proxy_pass_header Content-Type;
proxy_redirect off;
proxy_pass http://app:8080;
proxy_pass http://app:8080/;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}

}
}
20 changes: 6 additions & 14 deletions deploy/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ if-not-env = UWSGI_PROCESSES
processes = %(%k * 2)
endif =

if-env = UWSGI_NUMBER_OF_THREADS
threads = $(UWSGI_NUMBER_OF_THREADS)
endif =
if-not-env = UWSGI_NUMBER_OF_THREADS
threads = 1
endif =

vacuum = true
die-on-term = true
pidfile = /tmp/%n.pid
Expand Down Expand Up @@ -56,6 +49,7 @@ log-encoder = nl
# Disable request logging
disable-logging = True
log-5xx = true
skip-atexit-teardown = True

# https://docs.launchdarkly.com/sdk/server-side/python#configuring-uwsgi
enable-threads = True
Expand All @@ -69,14 +63,12 @@ lazy-apps = True

# Worker Recycling <!>
# This configuration will restart a worker process after any of the following events:
# 5000 requests have been handled
# 3000 requests have been handled
# The worker has allocated 2 GB of memory
max-requests = 5000
# 1 hour has passed
max-requests = 3000
reload-on-rss = 2048
max-worker-lifetime = 3600
max-worker-lifetime-delta = 20
worker-reload-mercy = 300

# 1 hour has passed
; Remove these options because of https://github.com/unbit/uwsgi/issues/1760
;max-worker-lifetime = 3600
;max-worker-lifetime-delta = 120

0 comments on commit 6acc8c7

Please sign in to comment.