Additional gunicorn exec improvements

master
Drew Bednar 3 years ago
parent b3b04a0af0
commit 30f9ea872e

@ -1,8 +1,8 @@
REGISTRY_NAME=registry.runcible.io
FRONTEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-frontend
FRONTEND_IMAGE_VERSION=1.3.0
FRONTEND_IMAGE_VERSION=1.4.0-dev
API_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-api
API_IMAGE_VERSION=1.3.0
API_IMAGE_VERSION=1.4.0-dev
push-app-image: build-app-image
docker push $(FRONTEND_IMAGE_NAME):$(FRONTEND_IMAGE_VERSION)

@ -2,4 +2,5 @@ requirements.in
.env
tests/
Dockerfile
./api/.env
./api/.env
.git

@ -28,5 +28,4 @@ USER app
ENTRYPOINT ["./entrypoint.sh"]
CMD ["gunicorn", "--worker-tmp-dir", "/dev/shm", "--workers=2", "--log-level=-", "--threads=4", \
"--worker-class", "gthread", "--bind", "0.0.0.0:5000", "wsgi:app"]
CMD ["./bin/demo-helm-api"]

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# TODO add logic to always run from root api application directory
API_LOG_LEVEL="${API_LOG_LEVEL:-info}"
API_WORKER_CLASS="${API_WORKER_CLASS:-gthread}"
API_WORKER_COUNT="${API_WORKER_COUNT:-2}"
API_THREAD_COUNT="${API_THREAD_COUNT:-4}"
if [ -f /.dockerenv ]; then
WORKER_TEMP_DIR="/dev/shm"
else
WORKER_TEMP_DIR="/tmp"
fi
exec python3 -m gunicorn.app.wsgiapp --worker-tmp-dir "$WORKER_TEMP_DIR" --workers "$API_WORKER_COUNT" --access-logfile "-" \
--log-level "$API_LOG_LEVEL" --error-logfile "-" --threads "$API_THREAD_COUNT" \
--worker-class "$API_WORKER_CLASS" --bind 0.0.0.0:5000 wsgi:app

@ -3,10 +3,10 @@ image_pull_secret: regcred
services:
frontend:
image_name: "registry.runcible.io/demo-helm-frontend"
image_version: "1.3.0"
image_version: "1.4.0"
replicas: 1
backend:
image_name: "registry.runcible.io/demo-helm-api"
image_version: "1.3.0"
image_version: "1.4.0"
replicas: 1
random: "tis-random-default"
Loading…
Cancel
Save