Compare commits
No commits in common. "ba8c33d8fc7a61154bc81c4c0f6826f1bbc295ff" and "054e9caca065aeb898985579aff69c96c94dfb57" have entirely different histories.
ba8c33d8fc
...
054e9caca0
@ -1,14 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM python:3.10
|
||||
|
||||
RUN useradd -d /code xf
|
||||
RUN useradd -d /code pathogen
|
||||
RUN mkdir /code
|
||||
RUN chown xf:xf /code
|
||||
RUN chown pathogen:pathogen /code
|
||||
|
||||
RUN mkdir /venv
|
||||
RUN chown xf:xf /venv
|
||||
RUN chown pathogen:pathogen /venv
|
||||
|
||||
USER xf
|
||||
USER pathogen
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
WORKDIR /code
|
||||
|
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ stop:
|
||||
docker-compose -f docker-compose.prod.yml --env-file=stack.env down
|
||||
|
||||
log:
|
||||
docker-compose -f docker-compose.prod.yml --env-file=stack.env logs -f --names
|
||||
docker-compose -f docker-compose.prod.yml --env-file=stack.env logs -f
|
||||
|
||||
run-infra:
|
||||
docker-compose -f docker-compose.infra.yml --env-file=stack.env up -d
|
||||
|
21
db.py
21
db.py
@ -14,7 +14,7 @@ from schemas import mc_s
|
||||
from os import getenv
|
||||
from time import sleep
|
||||
|
||||
configuration = manticoresearch.Configuration(host="http://127.0.0.1:9308")
|
||||
configuration = manticoresearch.Configuration(host="http://monolith_db:9308")
|
||||
api_client = manticoresearch.ApiClient(configuration)
|
||||
api_instance = manticoresearch.IndexApi(api_client)
|
||||
|
||||
@ -23,21 +23,17 @@ log = util.get_logger("db")
|
||||
# Redis (legacy)
|
||||
# r = StrictRedis(unix_socket_path="/var/run/redis/redis.sock", db=0)
|
||||
r = StrictRedis(
|
||||
host="127.0.0.1", # Replace with your Redis server's IP address
|
||||
host="ssdb_monolith", # Replace with your Redis server's IP address
|
||||
port=1289, # Replace with your Redis server's port
|
||||
db=0 # Database number
|
||||
)
|
||||
# AIORedis
|
||||
# ar = aioredis.from_url("unix:///var/run/redis/redis.sock", db=0)
|
||||
ar = aioredis.from_url(
|
||||
"redis://127.0.0.1:1289",
|
||||
"redis://ssdb_monolith:1289",
|
||||
db=0
|
||||
)
|
||||
|
||||
# /var/run/neptune-redis.sock
|
||||
# db = 10
|
||||
pr = aioredis.from_url("unix://var/run/neptune-redis.sock", db=10)
|
||||
#pr = aioredis.from_url("redis://redis_neptune:6379", db=10, password=getenv("REDIS_PASSWORD"))
|
||||
pr = aioredis.from_url("redis://redis_neptune:6379", db=10, password=getenv("REDIS_PASSWORD"))
|
||||
|
||||
KEYNAME = "queue"
|
||||
MESSAGE_KEY = "messages"
|
||||
@ -161,20 +157,19 @@ async def store_batch(data):
|
||||
|
||||
body_post = ""
|
||||
for item in total:
|
||||
#print("ITEM", item)
|
||||
print("ITEM", item)
|
||||
body_post += orjson.dumps(item).decode("utf-8")
|
||||
body_post += "\n"
|
||||
|
||||
#print("BODY POST INDEX", index, body_post)
|
||||
# print(body_post)
|
||||
|
||||
|
||||
try:
|
||||
# Bulk index operations
|
||||
api_response = api_instance.bulk(body_post) # , async_req=True
|
||||
except ApiException as e:
|
||||
log.error("Exception when calling IndexApi->bulk: %s\n" % e)
|
||||
log.error("body_post attempted to send", body_post)
|
||||
log.info(f"Completed ingest to MC of length {len(total)}")
|
||||
print("Exception when calling IndexApi->bulk: %s\n" % e)
|
||||
print(f"Completed ingest to MC of length {len(total)}")
|
||||
# END MESSAGES IN SPLIT
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
unixsocket /var/run/monolith-redis.sock
|
||||
unixsocketperm 777
|
||||
port 0
|
||||
# port 6379
|
||||
# requirepass changeme
|
||||
# unixsocket /var/run/socks/redis.sock
|
||||
# unixsocketperm 777
|
||||
port 6379
|
||||
requirepass changeme
|
Loading…
Reference in New Issue
Block a user