Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Ability to customize nginx client_max_body_size (#997)
Browse files Browse the repository at this point in the history
At the moment, this value is hard coded to 300M.
If selenium driver try to upload a file bigger than this limit it will fail.
  • Loading branch information
lcharlois-neotys authored and diemol committed Jul 19, 2019
1 parent 03559f5 commit 49063e6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions charts/zalenium/templates/_pod-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ spec:
- name: CONTEXT_PATH
value: {{ .Values.ingress.path | quote }}
{{- end }}
{{- if .Values.ingress.maxBodySize }}
- name: NGINX_MAX_BODY_SIZE
value: {{ .Values.ingress.maxBodySize | quote }}
{{- end }}
{{- if .Values.hub.sauceLabsEnabled }}
- name: SAUCE_LABS_ENABLED
value: {{ .Values.hub.sauceLabsEnabled | quote }}
Expand Down
5 changes: 3 additions & 2 deletions charts/zalenium/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ ingress:
# If your ingress host name is only for Zalenium,
# no need to set path
# path: /
# maxBodySize: 300M
annotations:
# kubernetes.io/ingress.class: "nginx"
# kubernetes.io/tls-acme: "true"
# kubernetes.io/ingress.class: "nginx"
# kubernetes.io/tls-acme: "true"
## For RBAC support:

rbac:
Expand Down
2 changes: 1 addition & 1 deletion docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ events {
worker_connections 1024;
}
http {
client_max_body_size 300M;
client_max_body_size {{nginxMaxBodySize}};
proxy_connect_timeout 900s;
proxy_send_timeout 900s;
proxy_read_timeout 900s;
Expand Down
7 changes: 7 additions & 0 deletions docs/_posts/2000-01-05-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,13 @@ Any of these environment variables can be passed to Zalenium like this:
Time in seconds for <code>browserTmeout</code>, maps to the same parameter in default Selenium Grid.
</td>
</tr>
<tr>
<td><code>NGINX_MAX_BODY_SIZE</code></td>
<td>300M</td>
<td>
Max body size accepted by nginx. Can be usefull if selenium test try to upload file bigger than 300M.
</td>
</tr>
</tbody>
</table>

Expand Down
2 changes: 2 additions & 0 deletions scripts/zalenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ CONTEXT_PATH=${CONTEXT_PATH:-/}
if [ -z "${CONTEXT_PATH}" ] || [ "${CONTEXT_PATH}" = "/" ]; then
CONTEXT_PATH=""
fi
NGINX_MAX_BODY_SIZE=${NGINX_MAX_BODY_SIZE:-300M}

PID_PATH_SELENIUM=/tmp/selenium-pid
PID_PATH_SAUCE_LABS_NODE=/tmp/sauce-labs-node-pid
Expand Down Expand Up @@ -487,6 +488,7 @@ StartUp()

# In nginx.conf, Replace {{contextPath}} with value of APPEND_CONTEXT_PATH
sed -i.bak "s~{{contextPath}}~${CONTEXT_PATH}~" /home/seluser/nginx.conf
sed -i.bak "s~{{nginxMaxBodySize}}~${NGINX_MAX_BODY_SIZE}~" /home/seluser/nginx.conf

echo "Starting Nginx reverse proxy..."
nginx -c /home/seluser/nginx.conf
Expand Down

0 comments on commit 49063e6

Please sign in to comment.