Skip to content

Commit

Permalink
Merge pull request #792 from tbuerli-komax/feature/config-max-upload-…
Browse files Browse the repository at this point in the history
…size

Allow configuration of MAX_UPLOAD_SIZE
  • Loading branch information
fliiiix authored Feb 15, 2024
2 parents fe459ba + 8eb2f42 commit 6f784be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ RUN poetry install --no-root --no-ansi --only main
# production
FROM python:3.12-slim

# defaults
ENV MAX_UPLOAD_SIZE=100M

# set up the system
RUN apt update && \
apt install --yes nginx dumb-init libmagic1 && \
apt install --yes nginx dumb-init libmagic1 gettext && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /var/docat/doc
Expand All @@ -49,10 +52,8 @@ COPY --from=frontend /app/frontend/dist /var/www/html
COPY docat /app/docat
WORKDIR /app/docat

RUN cp docat/nginx/default /etc/nginx/sites-enabled/default

# Copy the build artifact (.venv)
COPY --from=backend /app /app/docat

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["sh", "-c", "nginx && .venv/bin/python -m uvicorn --host 0.0.0.0 --port 5000 docat.app:app"]
CMD ["sh", "-c", "envsubst '$MAX_UPLOAD_SIZE' < /app/docat/docat/nginx/default > /etc/nginx/sites-enabled/default && nginx && .venv/bin/python -m uvicorn --host 0.0.0.0 --port 5000 docat.app:app"]
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Same thing with `docatl`:
docatl tag --host http://localhost:8000 PROJECT VERSION latest
```

## Advanced `config.json`
## Advanced Frontend `config.json`

It is possible to configure some things after the fact.

Expand All @@ -101,3 +101,10 @@ It is possible to configure some things after the fact.
Supported config options:

- headerHTML

## Advanced System Config

Further proxy configurations can be done through the following environmental variables:
| Varaiable | Default (Link to Definition) | Description |
|---|---|---|
| MAX_UPLOAD_SIZE | [100M](./Dockerfile) | Limits the size of individual archives posted to the API |
2 changes: 1 addition & 1 deletion docat/docat/nginx/default
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ server {
}

location /api {
client_max_body_size 100M;
client_max_body_size $MAX_UPLOAD_SIZE;
proxy_pass http://python_backend;
}

Expand Down

0 comments on commit 6f784be

Please sign in to comment.