Files
telegram_new_socias/docker-compose.yml
google-labs-jules[bot] 4e2b6335a6 feat: Implement multi-database architecture
This commit introduces a three-database architecture to the application,
as specified in the `db_logic.md` file.

The changes include:
- A SQL initialization script (`db/init/init.sql`) to create the
  `USERS_ALMA`, `vanity_hr`, and `vanity_attendance` databases and their
  respective tables.
- SQLAlchemy models for all tables, organized into separate files
  within the `models` directory.
- Refactoring of the database connection logic in `modules/database.py`
  to support connections to all three databases.
- Creation of a `modules/logger.py` to handle request logging to the
  `USERS_ALMA` database.
- Updates to `docker-compose.yml` to mount the initialization script and
  build the bot image locally.
- Updates to `.env.example` to include the new database environment
  variables.
- Restoration of the data dictionary to `db_tasks.md`.
2025-12-18 19:36:40 +00:00

42 lines
883 B
YAML

version: "3.8"
services:
bot:
build: .
container_name: vanessa_bot
restart: always
env_file:
- .env
environment:
- MYSQL_HOST=db
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
depends_on:
db:
condition: service_healthy
volumes:
- .:/app
db:
image: mysql:8.0
container_name: vanessa_db
restart: always
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u${MYSQL_USER} -p${MYSQL_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 6
start_period: 30s
volumes:
- ./db/init:/docker-entrypoint-initdb.d
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
volumes:
mysql_data: