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

Dev #33

Merged
merged 120 commits into from
Jan 5, 2024
Merged

Dev #33

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
f947614
fix(search): update to use total.value based on new datastructure ret…
nsantacruz Jul 18, 2023
00671fa
chore(search): update elasticsearch to 8
nsantacruz Jul 18, 2023
80d4746
chore(search): make search.py compatible with ES 7
nsantacruz Jul 18, 2023
aa112e6
chore(search): make search_wrapper_api compatible with ES 8
nsantacruz Jul 18, 2023
f5832da
feat(search): connect to ES using a password
nsantacruz Aug 24, 2022
554c82d
chore(search): change to a fork of elasticsearch_dsl which adds suppo…
nsantacruz Jul 25, 2023
36b20bc
Merge branch 'master' into elasticsearch-8
nsantacruz Jul 26, 2023
3ffcacf
refactor: reduce number of local settings required to connect to elas…
nsantacruz Jul 26, 2023
400ccce
helm(search): update search local settings for elasticsearch 8
nsantacruz Jul 26, 2023
d72124d
helm: reorder env priority for reindexing job
BrendanGalloway Jul 31, 2023
785a126
Merge pull request #1554 from Sefaria/es-env-precedence
nsantacruz Jul 31, 2023
2e6ae41
helm: remove unused and confusing SEARCH_HOST declarations.
nsantacruz Aug 2, 2023
126a8c4
ci: remove unused and confusing SEARCH_HOST declarations.
nsantacruz Aug 2, 2023
6beea25
helm(feat): add dedicated elastic secrets
BrendanGalloway Aug 2, 2023
e7249ae
fix(search): make code backwards compatible with elasticsearch 6.
nsantacruz Aug 3, 2023
cb37272
Merge branch 'elasticsearch-8' of https://github.com/Sefaria/Sefaria-…
nsantacruz Aug 3, 2023
7e32bdc
fix(reader): Temporarily have Django connect to ES using admin creds …
nsantacruz Aug 7, 2023
1846327
fix(reader): Temporarily use fallback to SEARCH_ADMIN if SEARCH_NON_A…
nsantacruz Aug 7, 2023
1b2920d
helm(feat): add elastic user to web podd
BrendanGalloway Aug 7, 2023
0dfcd33
Merge pull request #1559 from Sefaria/elastic-secrets
nsantacruz Aug 7, 2023
7f7e161
chore: remove SEARCH_NON_ADMIN which is no longer necessary
nsantacruz Aug 7, 2023
37868d1
Merge branch 'elasticsearch-8' of https://github.com/Sefaria/Sefaria-…
nsantacruz Aug 7, 2023
6a3c561
helm(feat): move nginx entrypoint to file to support elastic input
BrendanGalloway Aug 8, 2023
9d85e03
Merge pull request #1572 from Sefaria/nginx-startup
nsantacruz Aug 8, 2023
f29283e
Merge branch 'elasticsearch-8' of https://github.com/Sefaria/Sefaria-…
nsantacruz Aug 8, 2023
9a532cc
chore: add templating to access elastic auth in nginx and local settings
nsantacruz Aug 8, 2023
a75b493
helm: fix typo in entrypoint filename
nsantacruz Aug 8, 2023
f26d175
helm: fix inconsistency in location of elastic secrets
nsantacruz Aug 9, 2023
d568dda
helm: revert change to location of elasticCertificate location which …
nsantacruz Aug 9, 2023
f2d1f1f
fix: use . to run entrypoint to solve permission issue
nsantacruz Aug 10, 2023
cfa5590
helm: use . to run entrypoint to solve permission issue
nsantacruz Aug 10, 2023
89184d5
Merge remote-tracking branch 'origin/elasticsearch-8' into elasticsea…
nsantacruz Aug 10, 2023
83908f7
helm: remove quotations
nsantacruz Aug 10, 2023
4d5e88f
helm: fix entrypoint location
nsantacruz Aug 10, 2023
b6aea2d
helm: fix entrypoint not running
nsantacruz Aug 13, 2023
fa87c74
helm: fix entrypoint not running
nsantacruz Aug 13, 2023
8bef91e
helm: fix entrypoint not running
nsantacruz Aug 14, 2023
3ea8305
helm: fix entrypoint not running
nsantacruz Aug 14, 2023
bae0e27
helm: fix entrypoint not running
nsantacruz Aug 14, 2023
dc24bd6
helm: fix entrypoint not running
nsantacruz Aug 14, 2023
44cb129
helm: fix entrypoint not running
nsantacruz Aug 14, 2023
5d27543
helm: use envvars located in each deployment for creating SEARCH_ADMIN
nsantacruz Aug 14, 2023
95fcee8
helm: fix quotation marks
nsantacruz Aug 14, 2023
c0cf8d0
helm: fix equals sign
nsantacruz Aug 14, 2023
0c642e3
chore: downgrade es so es client is compatible with elasticsearch 6 s…
nsantacruz Aug 14, 2023
0024c67
helm: allow for connecting to ES without a password
nsantacruz Aug 28, 2023
3cbea0a
Merge branch 'master' into elasticsearch-8
nsantacruz Aug 28, 2023
e83d4c8
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Aug 28, 2023
9e298d1
helm: change to single quotes
nsantacruz Aug 28, 2023
25f022d
test: add test for two normalization steps
nsantacruz Aug 29, 2023
791a74f
fix: dont skip rest of list if new_inds is less than curr_inds becaus…
nsantacruz Aug 29, 2023
6c7c826
refactor: greatly simplify logic for merging replacements
nsantacruz Aug 29, 2023
1a51b6d
fix: off-by-one error in calculation of end index
nsantacruz Aug 29, 2023
3be0156
test: fix tests that were incorrect due to off-by-one error
nsantacruz Aug 29, 2023
304b88c
refactor: incrementally update final_text_to_remove instead of mergin…
nsantacruz Aug 29, 2023
c7f4153
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Aug 29, 2023
b542605
helm: use single quotes
nsantacruz Aug 31, 2023
af86568
helm: use double quotes
nsantacruz Aug 31, 2023
7b583ca
Merge branch 'master' into elasticsearch-8
nsantacruz Aug 31, 2023
11a5649
helm: use double quotes
nsantacruz Aug 31, 2023
3cd0ef4
Merge branch 'master' into elasticsearch-8
nsantacruz Aug 31, 2023
ed5c31c
helm: use double quotes
nsantacruz Aug 31, 2023
82f47c9
chore: merge
nsantacruz Sep 20, 2023
44da07b
feat(search): add + when there are more results than ES can calculate
nsantacruz Sep 20, 2023
2107231
chore: npm install
nsantacruz Sep 20, 2023
6c6af0b
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Sep 20, 2023
e825581
helm: add refs to elastic secrets
nsantacruz Sep 20, 2023
56063c2
helm: read SEARCH_HOST from env vars
nsantacruz Sep 20, 2023
841978e
chore(search): duplicate elasticsearch reindex cronjob and associated…
nsantacruz Sep 20, 2023
fb5a840
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Sep 20, 2023
0597261
chore: merge
nsantacruz Sep 26, 2023
d41f35e
chore: merge
nsantacruz Nov 28, 2023
021ee0a
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Nov 28, 2023
5942d78
refactor(search): change SEARCH_ADMIN to SEARCH_URL which more clearl…
nsantacruz Nov 28, 2023
8a99c92
refactor(search): change SEARCH_ADMIN to SEARCH_URL which more clearl…
nsantacruz Nov 28, 2023
5605887
chore(search): update cronjob schedule so that ES 8 will be indexed ASAP
nsantacruz Nov 28, 2023
fafc835
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Nov 28, 2023
cd7e6b7
fix(search): add in missing elasticUser secret so that nginx can prox…
nsantacruz Nov 28, 2023
c8f84a8
chore(search): remove unused elasticAdmin secret from ES6 cronjob
nsantacruz Nov 28, 2023
b3bd1fc
chore(search): distinguish where each reindex cronjob connects
nsantacruz Nov 28, 2023
9f85c92
Merge branch 'elasticsearch-8' into elasticsearch-8-compat
nsantacruz Nov 28, 2023
1976025
fix(search): update to use total.value based on new datastructure ret…
nsantacruz Jul 18, 2023
f266771
chore(search): update elasticsearch to 8
nsantacruz Jul 18, 2023
7fd8a07
chore(search): make search.py compatible with ES 7
nsantacruz Jul 18, 2023
51ba56e
chore(search): make search_wrapper_api compatible with ES 8
nsantacruz Jul 18, 2023
d641ef6
feat(search): connect to ES using a password
nsantacruz Aug 24, 2022
b6b5e1e
chore(search): change to a fork of elasticsearch_dsl which adds suppo…
nsantacruz Jul 25, 2023
7b932ab
refactor: reduce number of local settings required to connect to elas…
nsantacruz Jul 26, 2023
7f66997
helm(search): update search local settings for elasticsearch 8
nsantacruz Jul 26, 2023
4387975
helm: remove unused and confusing SEARCH_HOST declarations.
nsantacruz Aug 2, 2023
ed53121
ci: remove unused and confusing SEARCH_HOST declarations.
nsantacruz Aug 2, 2023
d8aed82
fix(search): make code backwards compatible with elasticsearch 6.
nsantacruz Aug 3, 2023
1867b71
helm: reorder env priority for reindexing job
BrendanGalloway Jul 31, 2023
1660623
fix(reader): Temporarily have Django connect to ES using admin creds …
nsantacruz Aug 7, 2023
498bfd9
fix(reader): Temporarily use fallback to SEARCH_ADMIN if SEARCH_NON_A…
nsantacruz Aug 7, 2023
fa16195
chore: remove SEARCH_NON_ADMIN which is no longer necessary
nsantacruz Aug 7, 2023
66b6cd8
helm(feat): add dedicated elastic secrets
BrendanGalloway Aug 2, 2023
f00e384
helm(feat): add elastic user to web podd
BrendanGalloway Aug 7, 2023
9b6007d
helm(search): merge
nsantacruz Nov 29, 2023
596b531
helm(fix): correct secret ref
BrendanGalloway Nov 29, 2023
73e3b49
Merge pull request #1730 from Sefaria/elasticsearch-8-compat-secrets
nsantacruz Nov 29, 2023
be27482
helm(search): merge
nsantacruz Nov 29, 2023
fcac874
helm(search): fix formatting of SEARCH_URL
nsantacruz Nov 29, 2023
29ec9de
helm(search): fix location of entrypoint.sh
nsantacruz Nov 29, 2023
9add8a1
helm(search): fix location of entrypoint.sh
nsantacruz Nov 29, 2023
6c2b5e1
helm(search): fix permissions of entrypoint.sh
nsantacruz Nov 29, 2023
b5f3bbe
helm(search): fix add auth header when proxy passing to ES
nsantacruz Nov 29, 2023
7db0ffe
helm(search): fix typo in $ELASTIC_USERNAME
nsantacruz Nov 29, 2023
3561b7c
feat(search): add es6_compat parameter to search wrapper api so that …
nsantacruz Dec 4, 2023
580dc7d
helm(search): update time of reindex cronjob so it runs soon
nsantacruz Dec 4, 2023
740500f
helm(search): move SEARCH_HOST values to prod file
nsantacruz Dec 4, 2023
88cdb49
helm(search): install py_elasticsearch 8 in reindex cronjob
nsantacruz Dec 4, 2023
9089003
helm(search): change time of cronjob
nsantacruz Dec 5, 2023
8e3e747
helm(search): fix typo
nsantacruz Dec 5, 2023
9f0671a
chore: start strapi banner for contextus
stevekaplan123 Dec 14, 2023
a79b112
Merge remote-tracking branch 'contextus/dev' into contextus
stevekaplan123 Dec 14, 2023
715a6c6
feat(banner): banner for contextus
stevekaplan123 Dec 14, 2023
1eb331a
chore: merge elasticsearch-8-compat
nsantacruz Jan 4, 2024
8a2c011
fix: fix merge of production-values.yaml
nsantacruz Jan 4, 2024
2119096
chore: topics bucket -> topicimages
stevekaplan123 Jan 5, 2024
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
2 changes: 1 addition & 1 deletion build/ci/integration-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ localSettings:
DEBUG: true
DOMAIN_LANGUAGE: {}
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}"
SEARCH_ADMIN: "http://elasticsearch-data:9200"
SEARCH_URL: "http://elasticsearch-data:9200"
TURN_SERVER: ''
USE_CLOUDFLARE: false
FRONT_END_URL: "http://${NAME}.integration.sefaria.org"
Expand Down
1 change: 1 addition & 0 deletions build/ci/production-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ instrumentation:
enabled: false
otelEndpoint: "http://otel-collector-collector.monitoring:4317"
jaegerEndpoint: "jaeger-agent-dev.monitoring.svc.cluster.local:6831"

localSettings:
DEBUG: false
DOMAIN_LANGUAGE: {
Expand Down
2 changes: 1 addition & 1 deletion build/ci/sandbox-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ localSettings:
DEBUG: false
DOMAIN_LANGUAGE: {}
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}"
SEARCH_ADMIN: "http://elasticsearch-data:9200"
SEARCH_URL: "http://elasticsearch-data:9200"
TURN_SERVER: ''
USE_CLOUDFLARE: false
FRONT_END_URL: "http://${NAME}.cauldron.sefaria.org"
Expand Down
16 changes: 16 additions & 0 deletions helm-chart/sefaria-project/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ elastic-certificate-{{ .Values.deployEnv }}
{{- end }}
{{- end }}

{{- define "sefaria.secrets.elasticUser" }}
{{- if .Values.secrets.elasticUser.ref -}}
{{- .Values.secrets.elasticUser.ref }}
{{- else -}}
elastic-user-{{ .Values.deployEnv }}
{{- end }}
{{- end }}

{{- define "sefaria.secrets.elasticAdmin" }}
{{- if .Values.secrets.elasticAdmin.ref -}}
{{- .Values.secrets.elasticAdmin.ref }}
{{- else -}}
elastic-admin-{{ .Values.deployEnv }}
{{- end }}
{{- end }}


{{- define "sefaria.secrets.originTls" }}
{{- if .Values.ingress.secrets.originTls.ref -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,11 @@ data:
}
SERVER_EMAIL = os.getenv("SERVER_EMAIL")

SEARCH_HOST = "/api/search"
SEARCH_ADMIN = os.getenv("SEARCH_ADMIN")
SEARCH_ADMIN_USER = os.getenv("SEARCH_ADMIN_USER")
SEARCH_ADMIN_PW = os.getenv("SEARCH_ADMIN_PW")
SEARCH_ADMIN_K8S = os.getenv("SEARCH_ADMIN_K8S")
auth_str = f'{os.getenv("ELASTIC_USERNAME")}:{os.getenv("ELASTIC_PASSWORD")}@' if os.getenv("ELASTIC_USERNAME") else ''
SEARCH_URL = f'http://{auth_str}{os.getenv("SEARCH_HOST")}:9200'
SEARCH_INDEX_ON_SAVE = True
SEARCH_INDEX_NAME = "sefaria"
SEARCH_INDEX_NAME_TEXT = 'text' # name of the ElasticSearch index to use
SEARCH_INDEX_NAME_SHEET = 'sheet'
SEARCH_INDEX_NAME_MERGED = 'merged'

TURN_SERVER = os.getenv("TURN_SERVER") #coturn.cauldron.sefaria.org
TURN_SECRET= os.getenv("TURN_SECRET")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ data:
DEBUG: "{{ .Values.localSettings.DEBUG }}"
DOMAIN_LANGUAGE: {{ .Values.localSettings.DOMAIN_LANGUAGE | toJson | quote }}
APSCHEDULER_NAME: {{ tpl .Values.localSettings.APSCHEDULER_NAME . | quote }}
SEARCH_ADMIN: "http://{{ .Values.nginx.SEARCH_HOST }}:9200"
TURN_SERVER: {{ .Values.localSettings.TURN_SERVER | quote }}
USE_CLOUDFLARE: "{{ .Values.localSettings.USE_CLOUDFLARE }}"
FRONT_END_URL: {{ .Values.localSettings.FRONT_END_URL | quote }}
Expand All @@ -26,3 +25,4 @@ data:
SENTRY_ENVIRONMENT: {{ .Values.deployEnv | quote }}
SENTRY_CODE_VERSION: {{ .Values.web.containerImage.tag }}
FAIL_GRACEFULLY: "{{ .Values.localSettings.FAIL_GRACEFULLY }}"
SEARCH_HOST: {{ .Values.nginx.SEARCH_HOST | quote }}
45 changes: 45 additions & 0 deletions helm-chart/sefaria-project/templates/configmap/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,43 @@ metadata:
deployEnv: "{{ .Values.deployEnv }}"
{{- include "sefaria.labels" . | nindent 4 }}
data:
{{- if .Values.instrumentation.enabled }}
opentracing.json: |-
{
"service_name": "nginx-{{ .Values.deployEnv }}",
"propagation_format": "jaeger",
"sampler": {
"type": "const",
"param": 1,
"samplingServerURL": "http://127.0.0.1:5778/sampling"
},
"reporter": {
"endpoint": "",
"localAgentHostPort": "{{ .Values.instrumentation.jaegerEndpoint }}"
},
"headers": {
"TraceContextHeaderName": "",
"jaegerDebugHeader": "",
"jaegerBaggageHeader": "",
"traceBaggageHeaderPrefix": ""
}
}
{{- end }}
entrypoint.sh: |
#!/bin/bash

set -e

export ELASTIC_AUTH_HEADER=$(echo -n $ELASTIC_USERNAME:$ELASTIC_PASSWORD | base64)
envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG},${STRAPI_LOCATION},${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;
{{- end }}

user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
Expand All @@ -18,6 +54,10 @@ data:
}

http {
{{- if .Values.instrumentation.enabled }}
opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /etc/nginx/opentracing.json;
{{- end }}

# https://nginx.org/en/docs/varindex.html
log_format structured '{ "requestDuration": $request_time, "envName": "${ENV_NAME}", "stackComponent": "nginx", "host": "$hostname", "severity": "info", "httpRequest": { "requestMethod": "$request_method", "requestUrl": "$request_uri", "requestSize": $request_length, "status": $status, "responseSize": $body_bytes_sent, "userAgent": "$http_user_agent", "remoteIp": "$http_x_original_forwarded_for", "referer": "$http_referer", "latency": ${request_time}s, "protocol": "$server_protocol", "forwardedHTTP": "$http_x_forwarded_proto" }, "remoteUser": "$remote_user", "timeLocal": "$time_local" }';
access_log /dev/stdout structured;
Expand Down Expand Up @@ -78,6 +118,7 @@ data:
location /api/search/ {
rewrite ^/(?:api/search)/(.*)$ /$1 break;
proxy_set_header Content-Type application/json; # es 6.0 requires this header
proxy_set_header Authorization "Basic ${ELASTIC_AUTH_HEADER}";
add_header 'Access-Control-Allow-Origin' '';
proxy_pass http://elasticsearch_upstream/;
}
Expand Down Expand Up @@ -108,6 +149,10 @@ data:
}

location / {
{{- if .Values.instrumentation.enabled }}
opentracing on;
opentracing_propagate_context;
{{- end }}
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_set_header Host $host;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{- if .Values.cronJobs.reindexElasticSearch.enabled }}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Values.deployEnv }}-reindex-elastic-search-es6
labels:
{{- include "sefaria.labels" . | nindent 4 }}
spec:
schedule: "20 13 * * 0"
jobTemplate:
spec:
backoffLimit: 1
template:
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- mongo
topologyKey: kubernetes.io.hostname
containers:
- name: reindex-elastic-search-es6
image: "{{ .Values.web.containerImage.imageRegistry }}:{{ .Values.web.containerImage.tag }}"
resources:
limits:
memory: 9Gi
requests:
memory: 7Gi
env:
- name: SEARCH_HOST
value: "{{ .Values.cronjobs.reindexElasticSearch.SEARCH_HOST_ES6 }}"
- name: REDIS_HOST
value: "redis-{{ .Values.deployEnv }}"
- name: NODEJS_HOST
value: "node-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
- name: VARNISH_HOST
value: "varnish-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
- name: SLACK_URL
valueFrom:
secretKeyRef:
name: {{ template "sefaria.secrets.slackWebhook" . }}
key: slack-webhook
envFrom:
- secretRef:
name: {{ .Values.secrets.localSettings.ref }}
optional: true
- configMapRef:
name: local-settings-{{ .Values.deployEnv }}
- secretRef:
name: local-settings-secrets-{{ .Values.deployEnv }}
optional: true
volumeMounts:
- mountPath: /app/sefaria/local_settings.py
name: local-settings
subPath: local_settings.py
readOnly: true
command: ["bash"]
args: [
"-c",
"mkdir -p /log && touch /log/sefaria_book_errors.log && pip install numpy && /app/run /app/scripts/reindex_elasticsearch_cronjob_ES6.py"
]
restartPolicy: Never
volumes:
- name: local-settings
configMap:
name: local-settings-file-{{ .Values.deployEnv }}
items:
- key: local_settings.py
path: local_settings.py
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 2
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
{{- include "sefaria.labels" . | nindent 4 }}
spec:
schedule: "20 13 * * 0"
schedule: "20 13 * * 2"
jobTemplate:
spec:
backoffLimit: 1
Expand All @@ -32,6 +32,8 @@ spec:
requests:
memory: 7Gi
env:
- name: SEARCH_HOST
value: "{{ .Values.cronJobs.reindexElasticSearch.SEARCH_HOST_ES8 }}"
- name: REDIS_HOST
value: "redis-{{ .Values.deployEnv }}"
- name: NODEJS_HOST
Expand All @@ -44,14 +46,16 @@ spec:
name: {{ template "sefaria.secrets.slackWebhook" . }}
key: slack-webhook
envFrom:
- secretRef:
name: {{ template "sefaria.secrets.elasticAdmin" . }}
- secretRef:
name: {{ .Values.secrets.localSettings.ref }}
optional: true
- configMapRef:
name: local-settings-{{ .Values.deployEnv }}
- secretRef:
name: local-settings-secrets-{{ .Values.deployEnv }}
optional: true
- configMapRef:
name: local-settings-{{ .Values.deployEnv }}
volumeMounts:
- mountPath: /app/sefaria/local_settings.py
name: local-settings
Expand All @@ -60,7 +64,7 @@ spec:
command: ["bash"]
args: [
"-c",
"mkdir -p /log && touch /log/sefaria_book_errors.log && pip install numpy && /app/run /app/scripts/reindex_elasticsearch_cronjob.py"
"mkdir -p /log && touch /log/sefaria_book_errors.log && pip install numpy elasticsearch==8.8.2 git+https://github.com/Sefaria/[email protected]#egg=elasticsearch-dsl && /app/run /app/scripts/reindex_elasticsearch_cronjob.py"
]
restartPolicy: Never
volumes:
Expand Down
19 changes: 14 additions & 5 deletions helm-chart/sefaria-project/templates/rollout/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ 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 }}' < /conf/nginx.template.conf > /nginx.conf && exec nginx -c /nginx.conf -g 'daemon off;'" ]
args: [ "envsubst '${ENV_NAME},${VARNISH_HOST},${SEARCH_HOST},${RELEASE_TAG},${STRAPI_LOCATION}{{- 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: ["bash", "-c", "/usr/src/entrypoint.sh"]
ports:
- containerPort: 80
- containerPort: 443
Expand All @@ -73,9 +70,18 @@ spec:
periodSeconds: 30
resources: {{ toYaml .Values.nginx.resources | nindent 10 }}
volumeMounts:
- mountPath: /conf
- mountPath: /conf/nginx.template.conf
name: nginx-conf
subPath: nginx.template.conf
readOnly: true
- mountPath: /usr/src/entrypoint.sh
name: nginx-conf
subPath: entrypoint.sh
{{- if .Values.instrumentation.enabled }}
- mountPath: /etc/nginx/opentracing.json
name: nginx-conf
subPath: opentracing.json
{{- end }}
- mountPath: /app/robots.txt
name: robots-txt
readOnly: true
Expand All @@ -101,6 +107,8 @@ spec:
value: "linker-{{ .Values.deployEnv }}-{{ .Release.Revision }}"
{{- end }}
envFrom:
- secretRef:
name: {{ template "sefaria.secrets.elasticUser" . }}
- configMapRef:
name: local-settings-nginx-{{ .Values.deployEnv }}
optional: true
Expand All @@ -111,6 +119,7 @@ spec:
- name: nginx-conf
configMap:
name: nginx-conf-{{ .Values.deployEnv }}
defaultMode: 0755
- name: robots-txt
configMap:
name: robots-txt-{{ .Values.deployEnv }}
2 changes: 2 additions & 0 deletions helm-chart/sefaria-project/templates/rollout/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ spec:
- name: HELM_REVISION
value: "{{ .Release.Revision }}"
envFrom:
- secretRef:
name: {{ template "sefaria.secrets.elasticUser" . }}
- secretRef:
name: {{ .Values.secrets.localSettings.ref }}
optional: true
Expand Down
11 changes: 11 additions & 0 deletions helm-chart/sefaria-project/templates/secret/elastic-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.secrets.elasticAdmin.data }}
apiVersion: v1
kind: Secret
metadata:
name: elastic-admin-{{ .Values.deployEnv }}
labels:
deployEnv: "{{ .Values.deployEnv }}"
{{- include "sefaria.labels" . | nindent 4 }}
type: Opaque
stringData: {{ .Values.secrets.elasticAdmin.data | toYaml | nindent 2 }}
{{- end }}
11 changes: 11 additions & 0 deletions helm-chart/sefaria-project/templates/secret/elastic-user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.secrets.elasticUser.data }}
apiVersion: v1
kind: Secret
metadata:
name: elastic-user-{{ .Values.deployEnv }}
labels:
deployEnv: "{{ .Values.deployEnv }}"
{{- include "sefaria.labels" . | nindent 4 }}
type: Opaque
stringData: {{ .Values.secrets.elasticUser.data | toYaml | nindent 2 }}
{{- end }}
14 changes: 11 additions & 3 deletions helm-chart/sefaria-project/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,7 @@ secrets:
# SEFARIA_DB:
# SEFARIA_DB_USER:
# SEFARIA_DB_PASSWORD:
# SEARCH_ADMIN_USER:
# SEARCH_ADMIN_PW:
# SEARCH_ADMIN_K8S:
# SEARCH_URL
# TURN_SECRET:
# TURN_USER:
# SEFARIA_BOT_API_KEY:
Expand Down Expand Up @@ -372,6 +370,16 @@ secrets:
# should be commented out and vice-versa.
ref: trello-secret
# data:
elasticUser:
# If you're using a reference to an existing secret then the data: section
# should be commented out and vice-versa.
ref: elastic-user
# data:
elasticAdmin:
# If you're using a reference to an existing secret then the data: section
# should be commented out and vice-versa.
ref: elastic-admin
# data:


# Settings for various cronjobs
Expand Down
Loading
Loading