Merge pull request 'master' (#38) from master into prod

Reviewed-on: #38
This commit is contained in:
2025-09-15 01:08:08 +03:00
5 changed files with 16 additions and 12 deletions

View File

@@ -6,12 +6,12 @@ services:
worker:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.dev.chocomarsh.com"
STAGE: "development"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
networks:
- queues-development
- configurator
- mongo-development
command: worker
deploy:
mode: replicated
@@ -24,12 +24,11 @@ services:
fetch:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.dev.chocomarsh.com"
STAGE: "development"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
networks:
- queues-development
- mongo-development
command: fetch
deploy:
mode: replicated
@@ -42,12 +41,11 @@ services:
notify:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.dev.chocomarsh.com"
STAGE: "development"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
networks:
- queues-development
- mongo-development
command: notify
deploy:
mode: replicated
@@ -62,11 +60,10 @@ services:
networks:
- common-infra-nginx-development
- queues-development
- mongo-development
environment:
MONGO_HOST: "mongo.dev.chocomarsh.com"
STAGE: "development"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
command: api
deploy:
mode: replicated
@@ -83,3 +80,5 @@ networks:
external: true
configurator:
external: true
mongo-development:
external: true

View File

@@ -6,12 +6,12 @@ services:
worker:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.chocomarsh.com"
STAGE: "production"
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
networks:
- queues
- configurator
- mongo
command: worker
deploy:
mode: replicated
@@ -24,13 +24,13 @@ services:
fetch:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.chocomarsh.com"
STAGE: "production"
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
DEBUG: "false"
networks:
- queues
- configurator
- mongo
command: fetch
deploy:
mode: replicated
@@ -43,13 +43,13 @@ services:
notify:
image: mathwave/sprint-repo:ruz-bot
environment:
MONGO_HOST: "mongo.chocomarsh.com"
STAGE: "production"
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
DEBUG: "false"
networks:
- queues
- configurator
- mongo
command: notify
deploy:
mode: replicated
@@ -64,8 +64,8 @@ services:
networks:
- common-infra-nginx
- configurator
- mongo
environment:
MONGO_HOST: "mongo.chocomarsh.com"
STAGE: "production"
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
DEBUG: "false"
@@ -85,3 +85,5 @@ networks:
external: true
configurator:
external: true
mongo:
external: true

View File

@@ -7,6 +7,7 @@ RUN apt-get install -y locales locales-all
ENV LANGUAGE ru_RU.UTF-8
ENV LANG ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8
ENV PYTHONUNBUFFERED=1
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .

View File

@@ -9,7 +9,7 @@ from helpers import now
class Mongo:
def __init__(self):
url = f"mongodb://{settings.MONGO_USER}:{settings.MONGO_PASSWORD}@{settings.MONGO_HOST}:27017/"
url = f"mongodb://{settings.MONGO_USER}:{settings.MONGO_PASSWORD}@mongo:27017/"
self.client = pymongo.MongoClient(url)
self.database = self.client.get_database("ruz-bot")
self.users_collection.create_index([

View File

@@ -1,6 +1,7 @@
from concurrent.futures import ThreadPoolExecutor
import datetime
import os
import traceback
import zoneinfo
import requests
import time
@@ -55,6 +56,7 @@ class TasksHandlerMixin:
success = True
except Exception as exc:
print(f'Error processing message id={task["id"]}, payload={task["payload"]}, exc={exc}')
traceback.print_exc()
success = False
end = datetime.datetime.now(zoneinfo.ZoneInfo("Europe/Moscow"))
if success: