forked from Sefaria/Sefaria-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Sefaria/dev
Dev
- Loading branch information
Showing
28 changed files
with
164 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,14 @@ cronJobs: | |
enabled: true | ||
SEARCH_HOST_ES6: "contextus-es-default-0.elasticsearch.svc" | ||
SEARCH_HOST_ES8: "elasticsearch-8-es-default-0.elasticsearch.svc" | ||
topicsIndexing: | ||
enabled: true | ||
trello: | ||
enabled: true | ||
trends: | ||
enabled: true | ||
weeklyEmailNotifications: | ||
enabled: true | ||
secrets: | ||
localSettings: | ||
ref: local-settings-secrets-production | ||
|
@@ -171,7 +179,7 @@ localSettings: | |
} | ||
MONGO_HOST: "mongo" | ||
APSCHEDULER_NAME: "apscheduler-{{ .Values.deployEnv }}" | ||
SEARCH_ADMIN: "http://contextus-es-http.elasticsearch.svc:9200" | ||
SEARCH_URL: "http://contextus-es-http.elasticsearch.svc:9200" | ||
TURN_SERVER: '' | ||
USE_CLOUDFLARE: false | ||
FRONT_END_URL: "http://contextus.org" | ||
|
@@ -181,7 +189,6 @@ localSettings: | |
GLOBAL_WARNING: false | ||
GLOBAL_WARNING_MESSAGE: "Contextus will be in <b>Read-Only</b> mode for scheduled maintenance from 4:45pm-6:45pm Pacific time. Edits will <b>not</b> be saved during that time." | ||
SITE_PACKAGE: "sites.s4d" | ||
SEARCH_HOST: contextus-es-http.elasticsearch.svc | ||
DEFAULT_FROM_EMAIL: "Contextus <[email protected]>" | ||
SERVER_EMAIL: "[email protected]" | ||
MULTISERVER_ENABLED: "False" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ spec: | |
command: ["bash"] | ||
args: [ | ||
"-c", | ||
"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" | ||
"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/scheduled/reindex_elasticsearch_cronjob.py" | ||
] | ||
restartPolicy: Never | ||
volumes: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{{- if .Values.cronJobs.trends.enabled }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ .Values.deployEnv }}-trends | ||
labels: | ||
{{- include "sefaria.labels" . | nindent 4 }} | ||
spec: | ||
schedule: "0 1 * * 6" | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
backoffLimit: 1 | ||
template: | ||
spec: | ||
volumes: | ||
- name: local-settings | ||
configMap: | ||
name: local-settings-file-{{ .Values.deployEnv }} | ||
items: | ||
- key: local_settings.py | ||
path: local_settings.py | ||
containers: | ||
- name: trends | ||
image: "{{ .Values.web.containerImage.imageRegistry }}:{{ .Values.web.containerImage.tag }}" | ||
env: | ||
- 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 }}" | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.secrets.localSettings.ref }} | ||
optional: true | ||
- 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 | ||
subPath: local_settings.py | ||
readOnly: true | ||
command: ["bash"] | ||
args: [ | ||
"-c", | ||
"/app/run /app/scripts/scheduled/recalculate_trends.py" | ||
] | ||
restartPolicy: OnFailure | ||
successfulJobsHistoryLimit: 1 | ||
failedJobsHistoryLimit: 2 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import django | ||
django.setup() | ||
from sefaria.model import * | ||
|
||
trend.setAllTrends() | ||
|
||
|
||
|
||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
This file is meant to be temporary while we are migrating to elasticsearch 8 | ||
""" | ||
from datetime import datetime | ||
import requests | ||
import traceback | ||
import os | ||
import django | ||
django.setup() | ||
from sefaria.model import * | ||
from sefaria.search_ES6 import index_all | ||
from sefaria.local_settings import SEFARIA_BOT_API_KEY | ||
from sefaria.pagesheetrank import update_pagesheetrank | ||
|
||
""" | ||
Source sheets added after last_sheet_timestamp will be missing from the index process. We want to manually index all | ||
source sheets created after this. Depending on the database being used to index the timestamp will be different. If | ||
running against a production database, last_sheet_timestamp will be the time this script began running. Otherwise, this | ||
value will need to be set to the time at which the last mongo dump was created (assuming the database is using the most | ||
up-to-date mongo dump). | ||
""" | ||
# last_sheet_timestamp = datetime.fromtimestamp(os.path.getmtime("/var/data/sefaria_public/dump/sefaria")).isoformat() | ||
try: | ||
last_sheet_timestamp = datetime.now().isoformat() | ||
update_pagesheetrank() | ||
index_all() | ||
r = requests.post("https://www.sefaria.org/admin/index-sheets-by-timestamp", data={"timestamp": last_sheet_timestamp, "apikey": SEFARIA_BOT_API_KEY}) | ||
if "error" in r.text: | ||
raise Exception("Error when calling admin/index-sheets-by-timestamp API: " + r.text) | ||
else: | ||
print("SUCCESS!", r.text) | ||
except Exception as e: | ||
tb_str = traceback.format_exc() | ||
print("Caught exception") | ||
post_object = { | ||
"icon_emoji": ":facepalm:", | ||
"username": "Reindex ElasticSearch", | ||
"channel": "#engineering-discuss", | ||
"attachments": [ | ||
{ | ||
"fallback": tb_str, | ||
"color": "#a30200", | ||
"pretext": "Cronjob Error", | ||
"text": tb_str | ||
} | ||
] | ||
} | ||
requests.post(os.environ['SLACK_URL'], json=post_object) | ||
raise e |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters