From 5e88cb0cfa486be72fea3e896c1c88eb56c7b7af Mon Sep 17 00:00:00 2001 From: Mifarse Date: Fri, 5 Nov 2021 15:12:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BB=20SpreadsheetsService=E2=86=92Go?= =?UTF-8?q?ogleService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 14 +++--- .../Dockerfile | 48 +++++++++---------- {SpreadsheetsService => GoogleService}/app.py | 0 .../manager/__init__.py | 0 .../manager/manager.py | 0 .../models/__init__.py | 0 .../models/assignment.py | 0 .../models/const.py | 0 .../models/group.py | 0 .../models/student.py | 0 .../requirements.txt | 0 .../tests/__init__.py | 0 .../tests/test_models.py | 0 .../utils/__init__.py | 0 TelegramBot/bot.py | 10 ++-- TelegramBot/messages/messages.py | 2 +- docker-compose.yml | 8 ++-- 17 files changed, 41 insertions(+), 41 deletions(-) rename {SpreadsheetsService => GoogleService}/Dockerfile (97%) rename {SpreadsheetsService => GoogleService}/app.py (100%) rename {SpreadsheetsService => GoogleService}/manager/__init__.py (100%) rename {SpreadsheetsService => GoogleService}/manager/manager.py (100%) rename {SpreadsheetsService => GoogleService}/models/__init__.py (100%) rename {SpreadsheetsService => GoogleService}/models/assignment.py (100%) rename {SpreadsheetsService => GoogleService}/models/const.py (100%) rename {SpreadsheetsService => GoogleService}/models/group.py (100%) rename {SpreadsheetsService => GoogleService}/models/student.py (100%) rename {SpreadsheetsService => GoogleService}/requirements.txt (100%) rename {SpreadsheetsService => GoogleService}/tests/__init__.py (100%) rename {SpreadsheetsService => GoogleService}/tests/test_models.py (100%) rename {SpreadsheetsService => GoogleService}/utils/__init__.py (100%) diff --git a/.gitignore b/.gitignore index a93c9fe..dbe61d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ .vscode -SpreadsheetsService/models/__pycache__ -SpreadsheetsService/utils/__pycache__ -SpreadsheetsService/tests/__pycache__ -SpreadsheetsService/manager/__pycache__ -SpreadsheetsService/manager/client_secret.json -SpreadsheetsService/manager/token.json +GoogleService/models/__pycache__ +GoogleService/utils/__pycache__ +GoogleService/tests/__pycache__ +GoogleService/manager/__pycache__ +GoogleService/manager/client_secret.json +GoogleService/manager/token.json TelegramBot/.secrets -SpreadsheetsService/.secrets +GoogleService/.secrets TelegramBot/messages/__pycache__ diff --git a/SpreadsheetsService/Dockerfile b/GoogleService/Dockerfile similarity index 97% rename from SpreadsheetsService/Dockerfile rename to GoogleService/Dockerfile index 2f33285..317c246 100644 --- a/SpreadsheetsService/Dockerfile +++ b/GoogleService/Dockerfile @@ -1,24 +1,24 @@ -# For more information, please refer to https://aka.ms/vscode-docker-python -FROM python:3.8-slim-buster - -# Keeps Python from generating .pyc files in the container -ENV PYTHONDONTWRITEBYTECODE=1 - -# Turns off buffering for easier container logging -ENV PYTHONUNBUFFERED=1 - -# Install pip requirements -COPY requirements.txt . -RUN python -m pip install -r requirements.txt - -WORKDIR /app -ADD . /app - -# Не работает, права не знаю как дать больше, аппюзер ограничен -# Creates a non-root user with an explicit UID and adds permission to access the /app folder -# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers -# RUN useradd appuser && chown -R appuser /app -# USER appuser - -# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug -CMD ["python", "app.py"] +# For more information, please refer to https://aka.ms/vscode-docker-python +FROM python:3.8-slim-buster + +# Keeps Python from generating .pyc files in the container +ENV PYTHONDONTWRITEBYTECODE=1 + +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 + +# Install pip requirements +COPY requirements.txt . +RUN python -m pip install -r requirements.txt + +WORKDIR /app +ADD . /app + +# Не работает, права не знаю как дать больше, аппюзер ограничен +# Creates a non-root user with an explicit UID and adds permission to access the /app folder +# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers +# RUN useradd appuser && chown -R appuser /app +# USER appuser + +# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug +CMD ["python", "app.py"] diff --git a/SpreadsheetsService/app.py b/GoogleService/app.py similarity index 100% rename from SpreadsheetsService/app.py rename to GoogleService/app.py diff --git a/SpreadsheetsService/manager/__init__.py b/GoogleService/manager/__init__.py similarity index 100% rename from SpreadsheetsService/manager/__init__.py rename to GoogleService/manager/__init__.py diff --git a/SpreadsheetsService/manager/manager.py b/GoogleService/manager/manager.py similarity index 100% rename from SpreadsheetsService/manager/manager.py rename to GoogleService/manager/manager.py diff --git a/SpreadsheetsService/models/__init__.py b/GoogleService/models/__init__.py similarity index 100% rename from SpreadsheetsService/models/__init__.py rename to GoogleService/models/__init__.py diff --git a/SpreadsheetsService/models/assignment.py b/GoogleService/models/assignment.py similarity index 100% rename from SpreadsheetsService/models/assignment.py rename to GoogleService/models/assignment.py diff --git a/SpreadsheetsService/models/const.py b/GoogleService/models/const.py similarity index 100% rename from SpreadsheetsService/models/const.py rename to GoogleService/models/const.py diff --git a/SpreadsheetsService/models/group.py b/GoogleService/models/group.py similarity index 100% rename from SpreadsheetsService/models/group.py rename to GoogleService/models/group.py diff --git a/SpreadsheetsService/models/student.py b/GoogleService/models/student.py similarity index 100% rename from SpreadsheetsService/models/student.py rename to GoogleService/models/student.py diff --git a/SpreadsheetsService/requirements.txt b/GoogleService/requirements.txt similarity index 100% rename from SpreadsheetsService/requirements.txt rename to GoogleService/requirements.txt diff --git a/SpreadsheetsService/tests/__init__.py b/GoogleService/tests/__init__.py similarity index 100% rename from SpreadsheetsService/tests/__init__.py rename to GoogleService/tests/__init__.py diff --git a/SpreadsheetsService/tests/test_models.py b/GoogleService/tests/test_models.py similarity index 100% rename from SpreadsheetsService/tests/test_models.py rename to GoogleService/tests/test_models.py diff --git a/SpreadsheetsService/utils/__init__.py b/GoogleService/utils/__init__.py similarity index 100% rename from SpreadsheetsService/utils/__init__.py rename to GoogleService/utils/__init__.py diff --git a/TelegramBot/bot.py b/TelegramBot/bot.py index b51d68b..56107b6 100644 --- a/TelegramBot/bot.py +++ b/TelegramBot/bot.py @@ -28,7 +28,7 @@ from utils.inline_keyboard import * from messages import Messages ADMIN = "admin" -HOST = "http://carolyn-spreadsheets:5000" +HOST = "http://carolyn-google:5000" MESSAGES = Messages() SUB_TIME_DELTA = datetime.timedelta(minutes=30) TOKEN = Path(".secrets/bot_token.txt").read_text() @@ -69,7 +69,7 @@ def start(update: Update, context: CallbackContext): ) data = req.json() except requests.exceptions.RequestException: - LOG.exception("@{username} вызвал: Ошибка подключения к сервису Spreadsheets.") + LOG.exception("@{username} вызвал: Ошибка подключения к сервису Google.") update.message.reply_sticker(MESSAGES.Stickers.DEAD) return @@ -321,7 +321,7 @@ def sub(update: Update, context: CallbackContext): ) data = req.json() except requests.exceptions.RequestException: - LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Spreadsheets.") + LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Google.") update.message.reply_sticker(MESSAGES.Stickers.DEAD) return @@ -351,7 +351,7 @@ def unsub(update: Update, context: CallbackContext): ) data = req.json() except requests.exceptions.RequestException: - LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Spreadsheets.") + LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Google.") update.message.reply_sticker(MESSAGES.Stickers.DEAD) return @@ -381,7 +381,7 @@ def variant(update: Update, context: CallbackContext): ) data = req.json() except requests.exceptions.RequestException: - LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Spreadsheets.") + LOG.exception("@{user_id} вызвал: Ошибка подключения к сервису Google.") update.message.reply_sticker(MESSAGES.Stickers.DEAD) return diff --git a/TelegramBot/messages/messages.py b/TelegramBot/messages/messages.py index baab794..b7f297b 100644 --- a/TelegramBot/messages/messages.py +++ b/TelegramBot/messages/messages.py @@ -116,7 +116,7 @@ class Messages: def about(commit_id: str, git_describe): return f"ℹ️ Версия сборки:\n{git_describe}" - class Spreadsheets: + class Google: pass class Stickers: diff --git a/docker-compose.yml b/docker-compose.yml index 782b64f..6944bc7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: "3.9" services: - spreadsheets: - container_name: "carolyn-spreadsheets" + google: + container_name: "carolyn-google" restart: always - build: ./SpreadsheetsService + build: ./GoogleService ports: - "5000:5000" volumes: - - ./SpreadsheetsService:/app + - ./GoogleService:/app telegrambot: container_name: "carolyn-telegrambot" environment: