From d0b7d347720907afa142214648a28c68a03d878a Mon Sep 17 00:00:00 2001 From: Josh Krawczyk Date: Sun, 16 Feb 2020 19:25:15 -0500 Subject: [PATCH] Fixed file upload issue by modifying the reverse proxy to allow a higher body size --- docker/.env.example | 2 +- docker/api/dockerfile | 4 +++- docker/api/local_settings.py.keep | 2 +- docker/app/.env.local.keep | 4 ++-- docker/docker-compose.yml | 21 +++++++++++++++++++++ docker/nginx-proxy/api.conf | 2 ++ docker/readme.md | 16 ++++++++++++++-- 7 files changed, 44 insertions(+), 7 deletions(-) diff --git a/docker/.env.example b/docker/.env.example index 113e1d12..3760ca6f 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -26,4 +26,4 @@ EMAIL_HOST=smtp.gmail.com EMAIL_USER=example@gmail.com EMAIL_PASS=changeme EMAIL_PORT=587 -EMAIL_ALERT_RECIPIENTS="example@gmail.com", +EMAIL_RECIPIENTS="example@gmail.com", diff --git a/docker/api/dockerfile b/docker/api/dockerfile index d3d0212c..eb205c91 100644 --- a/docker/api/dockerfile +++ b/docker/api/dockerfile @@ -1,5 +1,7 @@ FROM tiangolo/uwsgi-nginx:python3.7 + WORKDIR /app + ARG DJANGO_SEKRET ARG DJANGO_DEBUG ARG POSTGRES_USER @@ -33,4 +35,4 @@ COPY ./docker/api/api.conf /app/api.conf.tmp RUN envsubst '\$APP_HOST, \$API_HOST' < /app/api.conf.tmp > /app/nginx.conf && \ rm /app/api.conf.tmp COPY ./docker/api/local_settings.py.keep ./tacticalrmm/local_settings.py.tmp -RUN envsubst < /app/tacticalrmm/local_settings.py.tmp > /app/tacticalrmm/local_settings.py && rm /app/tacticalrmm/local_settings.py.tmp \ No newline at end of file +RUN envsubst < /app/tacticalrmm/local_settings.py.tmp > /app/tacticalrmm/local_settings.py && rm /app/tacticalrmm/local_settings.py.tmp diff --git a/docker/api/local_settings.py.keep b/docker/api/local_settings.py.keep index f5f9f826..7a2a461b 100644 --- a/docker/api/local_settings.py.keep +++ b/docker/api/local_settings.py.keep @@ -4,7 +4,7 @@ ALLOWED_HOSTS = ['${API_HOST}'] ADMIN_URL = "${ADMIN_URL}" -CORS_ORIGIN_WHITELIST = ["https://${APP_HOST}"] +CORS_ORIGIN_WHITELIST = ["https://${APP_HOST}",] DEBUG = ${DJANGO_DEBUG} diff --git a/docker/app/.env.local.keep b/docker/app/.env.local.keep index ac95db05..fdf07294 100644 --- a/docker/app/.env.local.keep +++ b/docker/app/.env.local.keep @@ -1,2 +1,2 @@ -VUE_APP_PROD_URL = "https://${APP_HOST}" -VUE_APP_DEV_URL = "http://localhost:8000" \ No newline at end of file +VUE_APP_PROD_URL = "https://${API_HOST}" +VUE_APP_DEV_URL = "https://${API_HOST}" \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 0a9bfca4..65cd8fd1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -103,6 +103,7 @@ services: dockerfile: "./docker/api/dockerfile" args: - DJANGO_SEKRET=${DJANGO_SEKRET} + - DJANGO_DEBUG=${DJANGO_DEBUG} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASS=${POSTGRES_PASS} - POSTGRES_HOST=${POSTGRES_HOST} @@ -116,6 +117,12 @@ services: - API_HOST=${API_HOST} - ADMIN_URL=${ADMIN_URL} - TWO_FACTOR_OTP=${TWO_FACTOR_OTP} + - EMAIL_TLS=${EMAIL_TLS} + - EMAIL_HOST=${EMAIL_HOST} + - EMAIL_USER=${EMAIL_USER} + - EMAIL_PASS=${EMAIL_PASS} + - EMAIL_PORT=${EMAIL_PORT} + - EMAIL_RECIPIENTS=${EMAIL_RECIPIENTS} command: celery -A tacticalrmm worker -l info networks: - redis @@ -129,6 +136,7 @@ services: dockerfile: "./docker/api/dockerfile" args: - DJANGO_SEKRET=${DJANGO_SEKRET} + - DJANGO_DEBUG=${DJANGO_DEBUG} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASS=${POSTGRES_PASS} - POSTGRES_HOST=${POSTGRES_HOST} @@ -142,6 +150,12 @@ services: - API_HOST=${API_HOST} - ADMIN_URL=${ADMIN_URL} - TWO_FACTOR_OTP=${TWO_FACTOR_OTP} + - EMAIL_TLS=${EMAIL_TLS} + - EMAIL_HOST=${EMAIL_HOST} + - EMAIL_USER=${EMAIL_USER} + - EMAIL_PASS=${EMAIL_PASS} + - EMAIL_PORT=${EMAIL_PORT} + - EMAIL_RECIPIENTS=${EMAIL_RECIPIENTS} command: celery -A tacticalrmm beat -l info networks: - redis @@ -155,6 +169,7 @@ services: dockerfile: "./docker/api/dockerfile" args: - DJANGO_SEKRET=${DJANGO_SEKRET} + - DJANGO_DEBUG=${DJANGO_DEBUG} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASS=${POSTGRES_PASS} - POSTGRES_HOST=${POSTGRES_HOST} @@ -168,6 +183,12 @@ services: - API_HOST=${API_HOST} - ADMIN_URL=${ADMIN_URL} - TWO_FACTOR_OTP=${TWO_FACTOR_OTP} + - EMAIL_TLS=${EMAIL_TLS} + - EMAIL_HOST=${EMAIL_HOST} + - EMAIL_USER=${EMAIL_USER} + - EMAIL_PASS=${EMAIL_PASS} + - EMAIL_PORT=${EMAIL_PORT} + - EMAIL_RECIPIENTS=${EMAIL_RECIPIENTS} command: celery -A tacticalrmm worker -Q wupdate networks: - redis diff --git a/docker/nginx-proxy/api.conf b/docker/nginx-proxy/api.conf index c0a6629b..3edb27b7 100644 --- a/docker/nginx-proxy/api.conf +++ b/docker/nginx-proxy/api.conf @@ -19,6 +19,8 @@ server { error_log /var/log/nginx/api-error.log; access_log /var/log/nginx/api-access.log; + client_max_body_size 300M; + listen 443 ssl; ssl_certificate /cert/fullchain.pem; ssl_certificate_key /cert/privkey.pem; diff --git a/docker/readme.md b/docker/readme.md index bc5fef7c..682858d3 100644 --- a/docker/readme.md +++ b/docker/readme.md @@ -20,8 +20,8 @@ Copy the fullchain.pem and privkey.pem to the cert directory. ## Run the environment with Docker -Copy the .env.example to .env -Change values in .env to match your environment +Copy the .env.example to .env then +change values in .env to match your environment ``` cd docker @@ -57,3 +57,15 @@ Use the generated code and the username to generate a bar code for your authenti ``` sudo docker exec -it docker_api_1 python manage.py generate_barcode [OTP_CODE] [username] ``` + +## Connect to a container instance shell + +run `docker ps` to get the name of the running container instance + +Then use the name in the below command. It will use the api container instance as an example + +``` +sudo docker exec -it docker_api_1 /bin/bash +``` + +If /bin/bash doesn't work then /bin/sh might need to be used. \ No newline at end of file