Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set custom upload size limit via NGINX_MAX_UPLOAD_SIZE env var in mwdb-web Docker image #930

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions deploy/docker/Dockerfile-web
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ FROM nginx:stable
LABEL maintainer="info@cert.pl"

ENV PROXY_BACKEND_URL http://mwdb.:8080
ENV NGINX_MAX_UPLOAD_SIZE 50M

COPY docker/nginx.conf.template /etc/nginx/conf.d/default.conf.template
COPY docker/start-web.sh /start-web.sh
COPY docker/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html

# Give +r to everything in /usr/share/nginx/html and +x for directories
RUN chmod u=rX,go= -R /usr/share/nginx/html

# By default everything is owned by root - change owner to nginx
RUN chown nginx:nginx -R /usr/share/nginx/html

CMD ["/bin/sh", "/start-web.sh"]
2 changes: 1 addition & 1 deletion docker/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
server_name mwdb-web;
root /usr/share/nginx/html;

client_max_body_size 50M;
client_max_body_size ${NGINX_MAX_UPLOAD_SIZE};

location /api/ {
proxy_pass ${PROXY_BACKEND_URL}/api/;
Expand Down
4 changes: 0 additions & 4 deletions docker/start-web.sh

This file was deleted.

12 changes: 12 additions & 0 deletions docs/setup-and-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ If you use Docker-based setup, all the configuration can be set using environmen
If you are using ``karton``, we highly recommend creating a separate bucket for it.
Failing to do so might result in data loss caused by ``karton's`` garbage collector.

Setting higher upload size limit in Docker
------------------------------------------

mwdb-core allows to set maximum upload size via ``max_upload_size`` parameter in configuration (see also :ref:`Advanced configuration` section).

mwdb-core package doesn't enforce any limitation by default, but if you use Docker images: nginx configuration in mwdb-web image have set 50M limit
using `client_max_body_size <http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size>`_ option. If you want to set different
limitation for Docker environment, use ``NGINX_MAX_UPLOAD_SIZE`` environment variable to set ``client_max_body_size`` option.

If you want to customize other nginx settings (e.g. timeouts), you can also provide your own ``nginx.conf.template`` by building your own image
based on ``certpl/mwdb-web``. More information can be found in `#927 issue discussion on Github <https://github.com/CERT-Polska/mwdb-core/issues/927>`_.

Advanced configuration
----------------------

Expand Down
Loading