From a32ed5ec142a74385fe24f9e1adecfc86847f543 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Tue, 09 Jun 2020 20:57:13 +0000
Subject: [PATCH] [mapproxy] Make number of processes configurable

---
 mapproxy/mapproxy.yaml |    4 ++--
 common.sh              |    2 ++
 mapproxy/Dockerfile    |    2 ++
 mapproxy/start.sh      |    2 +-
 5-mapproxy.sh          |    2 ++
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/5-mapproxy.sh b/5-mapproxy.sh
index 6d26f01..9b80333 100755
--- a/5-mapproxy.sh
+++ b/5-mapproxy.sh
@@ -10,6 +10,7 @@
 chown 500:500 "${HOST_MAPPROXY_DIR}"
 
 docker build -t "${DOCKER_IMAGE}" "${DOCKER_DIR}"
+docker stop "${DOCKER_NAME}"
 docker rm -v "${DOCKER_NAME}"
 docker run -i -t -d \
 	--link "${DOCKER_PREFIX}-postgis:postgres" \
@@ -17,6 +18,7 @@
 	-v "${HOST_MAPPROXY_DIR}:/home/mapproxy/data" \
 	-e "MAPNIK_MAP_FILE=/home/mapproxy/carto/mapnik.xml" \
 	-e "MAPNIK_TILE_DIR=/home/mapproxy/data" \
+	-e "MAPPROXY_PROCESSES=${MAPPROXY_PROCESSES}" \
 	-p 8080:8080 \
 	--name "${DOCKER_NAME}" \
 	"${DOCKER_IMAGE}"
diff --git a/common.sh b/common.sh
index 91f5e1f..67120dc 100644
--- a/common.sh
+++ b/common.sh
@@ -44,3 +44,5 @@
 # MAPPROXY
 
 HOST_MAPPROXY_DIR="${HOST_DIR}/mapproxy"
+
+MAPPROXY_PROCESSES=24
diff --git a/mapproxy/Dockerfile b/mapproxy/Dockerfile
index 9009da5..8fd1ffe 100644
--- a/mapproxy/Dockerfile
+++ b/mapproxy/Dockerfile
@@ -15,6 +15,8 @@
 USER mapproxy
 WORKDIR /home/mapproxy
 
+ENV MAPPROXY_PROCESSES 4
+
 COPY mapproxy.yaml wsgi.py start.sh ./
 COPY mapnik.py /usr/lib/python2.7/dist-packages/mapproxy/source/mapnik.py
 
diff --git a/mapproxy/mapproxy.yaml b/mapproxy/mapproxy.yaml
index 4a36125..6862ffb 100644
--- a/mapproxy/mapproxy.yaml
+++ b/mapproxy/mapproxy.yaml
@@ -51,13 +51,13 @@
   mapnik_pl_x1_source:
     type: mapnik
     mapfile: ../carto/mapnik.xml
-    concurrent_requests: 12
+    concurrent_requests: 1
     coverage: *coverage-extent
   mapnik_pl_x2_source:
     type: mapnik
     mapfile: ../carto/mapnik.xml
     scale_factor: 2
-    concurrent_requests: 12
+    concurrent_requests: 1
     coverage: *coverage-extent
 
 caches:
diff --git a/mapproxy/start.sh b/mapproxy/start.sh
index 9de3d17..7ec982b 100755
--- a/mapproxy/start.sh
+++ b/mapproxy/start.sh
@@ -7,4 +7,4 @@
 	cp carto/extent.geojson data/
 fi
 
-uwsgi --http-socket :8080 --master --processes 12 --plugins python --module wsgi
+uwsgi --http-socket :8080 --master --processes "${MAPPROXY_PROCESSES}" --plugins python --module wsgi

--
Gitblit v1.9.1