fix: file upload size limit (#1218)

This commit is contained in:
pablohashescobar 2023-06-06 19:15:42 +05:30 committed by GitHub
parent fae9d8cdc1
commit 705371eaf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 33 deletions

View File

@ -109,8 +109,8 @@ services:
volumes: volumes:
- uploads:/export - uploads:/export
environment: environment:
MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID} MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID}
MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY}
command: server /export --console-address ":9090" command: server /export --console-address ":9090"
createbuckets: createbuckets:
@ -127,13 +127,16 @@ services:
# Comment this if you already have a reverse proxy running # Comment this if you already have a reverse proxy running
plane-proxy: plane-proxy:
container_name: planeproxy container_name: planeproxy
image: makeplane/plane-proxy:latest image: makeplane/plane-proxy:latest
ports: ports:
- ${NGINX_PORT}:80 - ${NGINX_PORT}:80
depends_on: environment:
- plane-web FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880}
- plane-api BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}
depends_on:
- plane-web
- plane-api
volumes: volumes:

View File

@ -4,10 +4,10 @@ services:
plane-web: plane-web:
container_name: planefrontend container_name: planefrontend
build: build:
context: . context: .
dockerfile: ./apps/app/Dockerfile.web dockerfile: ./apps/app/Dockerfile.web
args: args:
NEXT_PUBLIC_API_BASE_URL: http://localhost:8000 NEXT_PUBLIC_API_BASE_URL: http://localhost:8000
restart: always restart: always
command: [ "/usr/local/bin/start.sh" ] command: [ "/usr/local/bin/start.sh" ]
environment: environment:
@ -24,8 +24,8 @@ services:
plane-api: plane-api:
container_name: planebackend container_name: planebackend
build: build:
context: ./apiserver context: ./apiserver
dockerfile: Dockerfile.api dockerfile: Dockerfile.api
restart: always restart: always
command: ./bin/takeoff command: ./bin/takeoff
environment: environment:
@ -61,8 +61,8 @@ services:
plane-worker: plane-worker:
container_name: planebgworker container_name: planebgworker
build: build:
context: ./apiserver context: ./apiserver
dockerfile: Dockerfile.api dockerfile: Dockerfile.api
restart: always restart: always
command: ./bin/worker command: ./bin/worker
environment: environment:
@ -88,8 +88,8 @@ services:
OPENAI_API_KEY: ${OPENAI_API_KEY} OPENAI_API_KEY: ${OPENAI_API_KEY}
GPT_ENGINE: ${GPT_ENGINE} GPT_ENGINE: ${GPT_ENGINE}
SECRET_KEY: ${SECRET_KEY} SECRET_KEY: ${SECRET_KEY}
DEFAULT_EMAIL: ${DEFAULT_EMAIL} DEFAULT_EMAIL: ${DEFAULT_EMAIL:-captain@plane.so}
DEFAULT_PASSWORD: ${DEFAULT_PASSWORD} DEFAULT_PASSWORD: ${DEFAULT_PASSWORD:-password123}
USE_MINIO: ${USE_MINIO} USE_MINIO: ${USE_MINIO}
depends_on: depends_on:
- plane-api - plane-api
@ -130,27 +130,24 @@ services:
createbuckets: createbuckets:
image: minio/mc image: minio/mc
entrypoint: > entrypoint: >
/bin/sh -c " /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; /usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME; /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; "
/usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY;
/usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME;
/usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME;
exit 0;
"
depends_on: depends_on:
- plane-minio - plane-minio
plane-proxy: plane-proxy:
container_name: planeproxy container_name: planeproxy
build: build:
context: ./nginx context: ./nginx
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always restart: always
ports: ports:
- ${NGINX_PORT}:80 - ${NGINX_PORT}:80
environment:
FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880}
BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}
depends_on: depends_on:
- plane-web - plane-web
- plane-api - plane-api
volumes: volumes:
pgdata: pgdata:

View File

@ -1,4 +1,10 @@
FROM nginx:1.21-alpine FROM nginx:1.25.0-alpine
RUN rm /etc/nginx/conf.d/default.conf RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf.template /etc/nginx/nginx.conf.template
COPY ./env.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Update all environment variables
CMD ["/docker-entrypoint.sh"]

4
nginx/env.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
envsubst < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
exec nginx -g 'daemon off;'

View File

@ -8,6 +8,9 @@ server {
listen 80; listen 80;
root /www/data/; root /www/data/;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
client_max_body_size ${FILE_SIZE_LIMIT};
location / { location / {
proxy_pass http://planefrontend:3000/; proxy_pass http://planefrontend:3000/;
} }
@ -16,7 +19,7 @@ server {
proxy_pass http://planebackend:8000/api/; proxy_pass http://planebackend:8000/api/;
} }
location /uploads/ { location /${BUCKET_NAME}/ {
proxy_pass http://plane-minio:9000/uploads/; proxy_pass http://plane-minio:9000/uploads/;
} }
} }