From 0fab6db75e68ff2505127274d1fc0a10e7026515 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 10 May 2022 15:11:35 -0400 Subject: [PATCH] frontend: add nginx.conf to limit worker processes (#226) set the number of nginx workers to 2 to avoid exceeding memory, which can happen with default worker_processes: auto due to the cpu limit setting. --- frontend/Dockerfile | 5 +-- ...{nginx.conf.template => frontend.template} | 0 frontend/nginx.conf | 31 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) rename frontend/{nginx.conf.template => frontend.template} (100%) create mode 100644 frontend/nginx.conf diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 03db205a..67c828ff 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,4 +1,4 @@ -# central place to configure the production replayweb.pgae loading prefix +# central place to configure the production replayweb.page loading prefix ARG RWP_BASE_URL=https://cdn.jsdelivr.net/npm/replaywebpage@1.5.8/ FROM node:16 as build @@ -32,7 +32,8 @@ ENV RWP_BASE_URL=${RWP_BASE_URL} COPY --from=build /app/dist /usr/share/nginx/html -COPY ./nginx.conf.template /etc/nginx/templates/ +COPY ./nginx.conf /etc/nginx/nginx.conf +COPY ./frontend.template /etc/nginx/templates/ RUN rm /etc/nginx/conf.d/* diff --git a/frontend/nginx.conf.template b/frontend/frontend.template similarity index 100% rename from frontend/nginx.conf.template rename to frontend/frontend.template diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 00000000..56d5670c --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes 2; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +}