mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Git Bridge: support git-bridge configuration via env in nginx
- generate overleaf.conf dynamically - support GIT_BRIDGE_HOST and GIT_BRIDGE_PORT - configure client_max_body_size for /git using GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE
This commit is contained in:
@@ -47,7 +47,7 @@ ADD server-ce/config/env.sh /etc/overleaf/env.sh
|
|||||||
# Configure nginx
|
# Configure nginx
|
||||||
# ---------------
|
# ---------------
|
||||||
ADD server-ce/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
|
ADD server-ce/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
|
||||||
ADD server-ce/nginx/overleaf.conf /etc/nginx/sites-enabled/overleaf.conf
|
ADD server-ce/nginx/overleaf.conf.template /etc/nginx/templates/overleaf.conf.template
|
||||||
ADD server-ce/nginx/clsi-nginx.conf /etc/nginx/sites-enabled/clsi-nginx.conf
|
ADD server-ce/nginx/clsi-nginx.conf /etc/nginx/sites-enabled/clsi-nginx.conf
|
||||||
|
|
||||||
|
|
||||||
@@ -119,7 +119,9 @@ ENV GRACEFUL_SHUTDOWN_DELAY_SECONDS=1
|
|||||||
ENV NODE_ENV="production"
|
ENV NODE_ENV="production"
|
||||||
ENV LOG_LEVEL="info"
|
ENV LOG_LEVEL="info"
|
||||||
|
|
||||||
|
ENV GIT_BRIDGE_HOST=git-bridge
|
||||||
|
ENV GIT_BRIDGE_PORT=8000
|
||||||
|
ENV GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE=52428800
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/my_init"]
|
ENTRYPOINT ["/sbin/my_init"]
|
||||||
|
|||||||
@@ -16,12 +16,18 @@ fi
|
|||||||
nginx_template_file="${nginx_templates_dir}/nginx.conf.template"
|
nginx_template_file="${nginx_templates_dir}/nginx.conf.template"
|
||||||
nginx_config_file="${nginx_dir}/nginx.conf"
|
nginx_config_file="${nginx_dir}/nginx.conf"
|
||||||
|
|
||||||
|
overleaf_template_file="${nginx_templates_dir}/overleaf.conf.template"
|
||||||
|
overleaf_config_file="${nginx_dir}/sites-enabled/overleaf.conf"
|
||||||
|
|
||||||
if [ -f "${nginx_template_file}" ]; then
|
if [ -f "${nginx_template_file}" ]; then
|
||||||
export NGINX_KEEPALIVE_TIMEOUT="${NGINX_KEEPALIVE_TIMEOUT:-65}"
|
export NGINX_KEEPALIVE_TIMEOUT="${NGINX_KEEPALIVE_TIMEOUT:-65}"
|
||||||
export NGINX_WORKER_CONNECTIONS="${NGINX_WORKER_CONNECTIONS:-768}"
|
export NGINX_WORKER_CONNECTIONS="${NGINX_WORKER_CONNECTIONS:-768}"
|
||||||
export NGINX_WORKER_PROCESSES="${NGINX_WORKER_PROCESSES:-4}"
|
export NGINX_WORKER_PROCESSES="${NGINX_WORKER_PROCESSES:-4}"
|
||||||
export MAX_UPLOAD_SIZE="${MAX_UPLOAD_SIZE:-50}"
|
export MAX_UPLOAD_SIZE="${MAX_UPLOAD_SIZE:-50}"
|
||||||
|
|
||||||
|
export GIT_BRIDGE_HOST="${GIT_BRIDGE_HOST:-git-bridge}"
|
||||||
|
export GIT_BRIDGE_PORT="${GIT_BRIDGE_PORT:-8000}"
|
||||||
|
export GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE="${GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE:-52428800}"
|
||||||
echo "Nginx: generating config file from template"
|
echo "Nginx: generating config file from template"
|
||||||
|
|
||||||
# Note the single-quotes, they are important.
|
# Note the single-quotes, they are important.
|
||||||
@@ -37,6 +43,15 @@ if [ -f "${nginx_template_file}" ]; then
|
|||||||
< "${nginx_template_file}" \
|
< "${nginx_template_file}" \
|
||||||
> "${nginx_config_file}"
|
> "${nginx_config_file}"
|
||||||
|
|
||||||
|
# Config git-bridge in nginx
|
||||||
|
envsubst '
|
||||||
|
${GIT_BRIDGE_HOST}
|
||||||
|
${GIT_BRIDGE_PORT}
|
||||||
|
${GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE}
|
||||||
|
' \
|
||||||
|
< "${overleaf_template_file}" \
|
||||||
|
> "${overleaf_config_file}"
|
||||||
|
|
||||||
echo "Checking Nginx config"
|
echo "Checking Nginx config"
|
||||||
nginx -t
|
nginx -t
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ server {
|
|||||||
location ^~ /git/ {
|
location ^~ /git/ {
|
||||||
resolver_timeout 2s;
|
resolver_timeout 2s;
|
||||||
resolver 127.0.0.11 valid=10s;
|
resolver 127.0.0.11 valid=10s;
|
||||||
set $git_upstream http://git-bridge:8000;
|
set $git_upstream http://${GIT_BRIDGE_HOST}:${GIT_BRIDGE_PORT};
|
||||||
rewrite ^/git/(.*)$ /$1 break;
|
rewrite ^/git/(.*)$ /$1 break;
|
||||||
|
client_max_body_size ${GIT_BRIDGE_REPOSTORE_MAX_FILE_SIZE};
|
||||||
proxy_pass $git_upstream;
|
proxy_pass $git_upstream;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
Reference in New Issue
Block a user