Refactor Docker and configuration files for improved structure and functionality

- Updated `.dockerignore` to include additional development and temporary files, enhancing build efficiency.
- Modified `.gitignore` to remove unnecessary entries and streamline ignored files.
- Enhanced `docker-compose.yml` with health checks, resource limits, and improved environment variable handling for better service management.
- Refactored `Dockerfile.bot` to utilize a multi-stage build for optimized image size and security.
- Improved `Makefile` with new commands for deployment, migration, and backup, along with enhanced help documentation.
- Updated `requirements.txt` to include new dependencies for environment variable management.
- Refactored metrics handling in the bot to ensure proper initialization and collection.
This commit is contained in:
2025-08-29 23:15:06 +03:00
parent f097d69dd4
commit 8f338196b7
27 changed files with 1499 additions and 370 deletions

View File

@@ -17,11 +17,15 @@ from helper_bot.utils.metrics import (
class BotDB:
def __init__(self, current_dir, name):
print(f"DEBUG BotDB: current_dir={current_dir}, name={name}")
# Формируем правильный путь к базе данных
if name.startswith('database/'):
# Если имя уже содержит database/, то используем его как есть
self.db_file = os.path.join(current_dir, name)
else:
# Если имя не содержит database/, то добавляем его
self.db_file = os.path.join(current_dir, 'database', name)
print(f"DEBUG BotDB: db_file={self.db_file}")
self.conn = None
self.cursor = None
self.logger = logger