From ab3bd84f3b0b2d27f6c37cca6104f3b1c8c431f2 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Thu, 4 Jul 2024 09:37:13 +0200 Subject: [PATCH] # Docker enhancement * adds logging for gunicorn by default * adds image tagging * drops docker-compose environment setting in favor of .env usage (needs to be copied from .env.sample) --- Dockerfile | 3 +++ docker-compose.yml | 12 +----------- docker-entrypoint.sh | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index deb523f6..44816bf3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ RUN pip install -r requirements.txt RUN rm /etc/nginx/sites-enabled/default COPY ./nginx.conf /etc/nginx/conf.d +# Create log folders +RUN mkdir /var/log/gunicorn + # Copy rest of project into workspace COPY . /konova/ diff --git a/docker-compose.yml b/docker-compose.yml index 0955abbd..47f6f17e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: - postgis:db - arnova-nginx-server:arnova build: . + image: "ksp/konova:1.7" container_name: "konova-docker" command: ./docker-entrypoint.sh restart: always @@ -13,17 +14,6 @@ services: - /data/apps/konova/uploaded_files:/konova_uploaded_files ports: - "1337:80" - environment: - - POSTGRES_NAME=konova - - POSTGRES_PORT=5432 - - POSTGRES_PASSWORD=CHANGE_ME - - POSTGRES_USER=konova - - POSTGRES_HOST=db - - REDIS_HOST=localhost - - SSO_HOST=CHANGE_ME_TO_SSO_HOST_URL - - SMTP_HOST=172.17.0.1 - - SMTP_PORT=25 - - SMTP_REAL_REPLY_MAIL=ksp-servicestelle@sgdnord.rlp.de # Instead of an own, new network, we need to connect to the existing one, which is provided by the postgis container # NOTE: THIS NETWORK MUST EXIST diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e9f2cea2..51470f22 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -4,4 +4,4 @@ service nginx start service redis-server start celery -A konova worker --detach # Rule of thumb: (2*CPU)+1 as worker_num -> Use 5 as default (matches a dual core) -gunicorn --workers=5 konova.wsgi:application --bind=0.0.0.0:8000 \ No newline at end of file +gunicorn --workers=5 konova.wsgi:application --bind=0.0.0.0:8000 --access-logfile /var/log/gunicorn/access.log --error-logfile /var/log/gunicorn/error.log \ No newline at end of file