diff --git a/charts/shipyard/templates/deployment-shipyard.yaml b/charts/shipyard/templates/deployment-shipyard.yaml index f494a0c7..28c7fe00 100644 --- a/charts/shipyard/templates/deployment-shipyard.yaml +++ b/charts/shipyard/templates/deployment-shipyard.yaml @@ -44,6 +44,11 @@ spec: {{ tuple $envAll $dependencies $mounts_shipyard_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: shipyard + env: + - name: 'SHIPYARD_API_WORKERS' + value: {{ .Values.conf.uwsgi.workers | quote }} + - name: 'SHIPYARD_API_THREADS' + value: {{ .Values.conf.uwsgi.threads | quote }} image: {{ .Values.images.tags.shipyard }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.shipyard_api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} diff --git a/charts/shipyard/values.yaml b/charts/shipyard/values.yaml index ef900453..5b2d1fef 100644 --- a/charts/shipyard/values.yaml +++ b/charts/shipyard/values.yaml @@ -290,6 +290,9 @@ database: db_root_user: postgres conf: + uwsgi: + threads: 1 + workers: 4 policy: admin_required: role:admin workflow_orchestrator:list_actions: rule:admin_required diff --git a/entrypoint.sh b/entrypoint.sh index 2f6475d7..19b2eea6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,7 +17,11 @@ set -ex CMD="shipyard" -PORT="9000" +PORT=${PORT:-9000} +# Number of uWSGI workers to handle API request +SHIPYARD_API_WORKERS=${SHIPYARD_API_WORKERS:-"4"} +#Threads per worker +SHIPYARD_API_THREADS=${SHIPYARD_API_THREADS:-"1"} if [ "$1" = 'server' ]; then # Start shipyard application @@ -26,7 +30,9 @@ if [ "$1" = 'server' ]; then --paste config:/etc/shipyard/api-paste.ini \ --enable-threads \ -L \ - --pyargv "--config-file /etc/shipyard/shipyard.conf" + --pyargv "--config-file /etc/shipyard/shipyard.conf" \ + --threads $SHIPYARD_API_THREADS \ + --workers $SHIPYARD_API_WORKERS else # Execute shipyard command exec ${CMD} $@