diff --git a/caretech/map/Dockerfile b/caretech/map/Dockerfile index 9a8849ad973ada0ae0e417afe41e256e79b587df..5bfedf0c0aeb32d7784b97692e971c223d656c82 100644 --- a/caretech/map/Dockerfile +++ b/caretech/map/Dockerfile @@ -3,8 +3,7 @@ FROM python:3.8-buster ARG UMAP_VERSION=1.2.1 ENV PYTHONUNBUFFERED=1 \ - UMAP_SETTINGS=/srv/umap/settings.py \ - PORT=8000 + UMAP_SETTINGS=/srv/umap/settings.py # Create a user account and group to run uMap RUN mkdir -p /srv/umap/static /srv/umap/uploads && \ @@ -44,14 +43,15 @@ RUN pip install umap-project==${UMAP_VERSION} # Install Docker dependencies RUN pip install -r requirements-docker.txt -COPY entrypoint.sh / +COPY entrypoint.sh . +COPY uwsgi.init . -RUN chmod +x /entrypoint.sh +RUN chmod +x ./entrypoint.sh RUN chown -R 10001:10001 /srv/umap USER umap EXPOSE 8000 -ENTRYPOINT [ "/entrypoint.sh" ] -CMD [ "umap", "runserver", "0.0.0.0:8000" ] +ENTRYPOINT [ "/srv/umap/entrypoint.sh" ] +CMD [ "uwsgi", "--ini", "uwsgi.ini" ] diff --git a/caretech/map/docker-compose.yml b/caretech/map/docker-compose.yml index 29298258db0861fc921b6f5439532580a23c7dd7..56c8187c3e22271276320ecf646482e609dc27f3 100644 --- a/caretech/map/docker-compose.yml +++ b/caretech/map/docker-compose.yml @@ -1,8 +1,6 @@ version: '3.7' volumes: - app_static: - name: umap-caretech-static app_uploads: name: umap-caretech-uploads db: @@ -23,12 +21,12 @@ services: container_name: umap-caretech env_file: ./secrets/umap.secrets environment: - - REDIS_URL=redis://redis:6379/0 - - SITE_URL=https://carte.caretech.picasoft.net + REDIS_URL: redis://redis:6379/0 + SITE_URL: https://carte.caretech.picasoft.net # Do not allow non-authenticated users to create maps - - LEAFLET_STORAGE_ALLOW_ANONYMOUS=False + LEAFLET_STORAGE_ALLOW_ANONYMOUS: False + PORT: 8000 volumes: - - app_static:/srv/umap/static - app_uploads:/srv/umap/uploads - ./settings.py:/srv/umap/settings.py init: true diff --git a/caretech/map/settings.py b/caretech/map/settings.py index 668e80787aad3d8c33cf49d0448d20489572f2ad..2b3f0369156140b71a20342e223aef75d2fd24e3 100644 --- a/caretech/map/settings.py +++ b/caretech/map/settings.py @@ -97,3 +97,30 @@ LEAFLET_STORAGE_KEEP_VERSIONS = env.int( 'LEAFLET_STORAGE_KEEP_VERSIONS', default=10, ) + +import sys + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format': '[django] %(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + } + }, + 'handlers': { + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'stream': sys.stdout, + 'formatter': 'verbose' + }, + }, + 'loggers': { + 'django': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': True, + }, + }, +} diff --git a/caretech/map/uwsgi.ini b/caretech/map/uwsgi.ini new file mode 100644 index 0000000000000000000000000000000000000000..2cf2c279982112764ba3fca9c04f8143c12e1268 --- /dev/null +++ b/caretech/map/uwsgi.ini @@ -0,0 +1,10 @@ +[uwsgi] +http = :$(PORT) +module = umap.wsgi:application +master = True +vacuum = True +max-requests = 5000 +processes = 4 +enable-threads = true +static-map = /static=/srv/umap/static +static-map = /uploads=/srv/umap/uploads