Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm(feat): move nginx entrypoint to file to support elastic input #1572

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions helm-chart/sefaria-project/templates/configmap/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ data:
}
}
{{- end }}
entrpoint.sh: |
#!/bin/bash

set -e

export ELASTIC_AUTH_HEADER=$(echo -n $ELASTIC_USER:$ELASTIC_PASSWORD | base64)
envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG},${ELASTIC_AUTH_HEADER}{{- if .Values.linker.enabled }},${LINKER_HOST}{{- end }}{{- if .Values.instrumentation.enabled }},${NGINX_VERSION}{{- end }}' < /conf/nginx.template.conf > /nginx.conf

nginx -c /nginx.conf -g 'daemon off;'

nginx.template.conf: |-
{{- if .Values.instrumentation.enabled }}
load_module /etc/nginx/modules/ngx_http_opentracing_module.so;
Expand Down
9 changes: 6 additions & 3 deletions helm-chart/sefaria-project/templates/rollout/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ spec:
- name: nginx
image: "{{ .Values.nginx.containerImage.imageRegistry }}:{{ .Values.nginx.containerImage.tag }}"
imagePullPolicy: Always
command: ["bash", "-c"]
# https://serverfault.com/questions/577370/how-can-i-use-environment-variables-in-nginx-conf
args: [ "envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG}{{- if .Values.linker.enabled }},${LINKER_HOST}{{- end }}{{- if .Values.instrumentation.enabled }},${NGINX_VERSION}{{- end }}' < /conf/nginx.template.conf > /nginx.conf && exec nginx -c /nginx.conf -g 'daemon off;'" ]
command:
- /entrypoint.sh
ports:
- containerPort: 80
- containerPort: 443
Expand All @@ -76,6 +75,10 @@ spec:
name: nginx-conf
subPath: nginx.template.conf
readOnly: true
- mountPath: /entrypoint.sh
name: nginx-conf
subPath: entrypoint.sh
defaultMode: 0755
{{- if .Values.instrumentation.enabled }}
- mountPath: /etc/nginx/opentracing.json
name: nginx-conf
Expand Down
Loading