Compare commits

..

No commits in common. "7702e04286100a1c609f37e02731dd6ff47127c8" and "29333605608ea469b471b31a48ba4c6a3353d76e" have entirely different histories.

4 changed files with 44 additions and 32 deletions

View File

@ -24,7 +24,8 @@ repos:
exclude : ^core/static/css # slow exclude : ^core/static/css # slow
- id: djjs - id: djjs
exclude: ^core/static/js # slow exclude: ^core/static/js # slow
- repo: https://github.com/sirwart/ripsecrets.git # - repo: https://github.com/thibaudcolas/curlylint
rev: v0.1.5 # rev: v0.13.1
hooks: # hooks:
- id: ripsecrets # - id: curlylint
# files: \.(html|sls)$

View File

@ -1,37 +1,40 @@
# OpenSearch settings # OpenSearch settings
OPENSEARCH_URL = "10.1.0.1" OPENSEARCH_URL = "127.0.0.1"
OPENSEARCH_PORT = 9200 OPENSEARCH_PORT = 9200
OPENSEARCH_TLS = True OPENSEARCH_TLS = True
OPENSEARCH_USERNAME = "admin" OPENSEARCH_USERNAME = "admin"
OPENSEARCH_PASSWORD = "secret" OPENSEARCH_PASSWORD = ""
OPENSEARCH_INDEX_MAIN = "pathogen-main"
OPENSEARCH_INDEX_META = "pathogen-meta"
OPENSEARCH_INDEX_INT = "pathogen-int"
OPENSEARCH_MAIN_SIZES = ["20", "50", "100", "200", "400", "800"]
OPENSEARCH_MAIN_SIZES_ANON = ["20", "50", "100"]
OPENSEARCH_MAIN_SOURCES = ["dis", "4ch", "all"]
OPENSEARCH_SOURCES_RESTRICTED = ["irc"]
# Manticore settings # Manticore settings
MANTICORE_URL = "http://example-db-1:9308" MANTICORE_URL = "http://monolith-db-1:9308"
MANTICORE_INDEX_MAIN = "main"
MANTICORE_INDEX_META = "meta"
MANTICORE_INDEX_INT = "internal"
DB_BACKEND = "ELASTICSEARCH" MANTICORE_MAIN_SIZES = ["20", "50", "100", "200", "400", "800"]
MANTICORE_MAIN_SIZES_ANON = ["20", "50", "100"]
# Common DB settings MANTICORE_MAIN_SOURCES = ["dis", "4ch", "all"]
INDEX_MAIN = "main" MANTICORE_SOURCES_RESTRICTED = ["irc"]
INDEX_RESTRICTED = "restricted" MANTICORE_CACHE = True
INDEX_META = "meta" MANTICORE_CACHE_TIMEOUT = 60
INDEX_INT = "internal"
MAIN_SIZES = ["1", "5", "15", "30", "50", "100", "250", "500", "1000"]
MAIN_SIZES_ANON = ["1", "5", "15", "30", "50", "100"]
MAIN_SOURCES = ["dis", "4ch", "all"]
SOURCES_RESTRICTED = ["irc"]
CACHE = False
CACHE_TIMEOUT = 2
DRILLDOWN_RESULTS_PER_PAGE = 15 DRILLDOWN_RESULTS_PER_PAGE = 15
DRILLDOWN_DEFAULT_PARAMS = { DRILLDOWN_DEFAULT_PARAMS = {
"size": "15", "size": "20",
"index": "main", "index": "main",
"sorting": "desc", "sorting": "desc",
"source": "4ch", "source": "4ch",
} }
# Encryption # Encryption
# ENCRYPTION = False # ENCRYPTION = False
# ENCRYPTION_KEY = b"" # ENCRYPTION_KEY = b""
@ -58,8 +61,7 @@ DRILLDOWN_DEFAULT_PARAMS = {
# # Delay results by this many days # # Delay results by this many days
# DELAY_DURATION = 10 # DELAY_DURATION = 10
OPENSEARCH_BLACKLISTED = { OPENSEARCH_BLACKLISTED = {}
}
# URLs\ # URLs\
@ -87,8 +89,8 @@ SECRET_KEY = "a"
STRIPE_ADMIN_COUPON = "" STRIPE_ADMIN_COUPON = ""
# Threshold # Threshold
THRESHOLD_ENDPOINT = "http://threshold:13869" THRESHOLD_ENDPOINT = "http://threshold-app-1:13869"
THRESHOLD_API_KEY = "api_1" THRESHOLD_API_KEY = ""
THRESHOLD_API_TOKEN = "" THRESHOLD_API_TOKEN = ""
THRESHOLD_API_COUNTER = "" THRESHOLD_API_COUNTER = ""
@ -103,4 +105,13 @@ META_MAX_CHUNK_SIZE = 500
META_QUERY_SIZE = 10000 META_QUERY_SIZE = 10000
DEBUG = True DEBUG = True
PROFILER = False PROFILER = False
if DEBUG:
import socket # only if you haven't already imported this
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips] + [
"127.0.0.1",
"10.0.2.2",
]

View File

@ -13,9 +13,9 @@ from core.db.processing import annotate_results, parse_results
from core.views.helpers import dedup_list from core.views.helpers import dedup_list
class ElasticsearchBackend(StorageBackend): class OpensearchBackend(StorageBackend):
def __init__(self): def __init__(self):
super().__init__("Elasticsearch") super().__init__("Opensearch")
def initialise(self, **kwargs): def initialise(self, **kwargs):
""" """

View File

@ -6,8 +6,8 @@ def get_db():
from core.db.druid import DruidBackend from core.db.druid import DruidBackend
return DruidBackend() return DruidBackend()
elif settings.DB_BACKEND == "ELASTICSEARCH": elif settings.DB_BACKEND == "OPENSEARCH":
from core.db.elastic import ElasticSearchBackend from core.db.opensearch import OpensearchBackend
return OpensearchBackend() return OpensearchBackend()
elif settings.DB_BACKEND == "MANTICORE": elif settings.DB_BACKEND == "MANTICORE":