mirror of
https://github.com/marcogll/telegram_new_socias.git
synced 2026-01-13 13:15:16 +00:00
feat: Dockerize application and add MySQL logging
This commit introduces Docker and Docker Compose to containerize the application and orchestrate it with a MySQL database. Key changes include: - Added a `Dockerfile` to create a container for the Python bot. - Created a `docker-compose.yml` file to manage the bot and MySQL services. - Added a `modules/database.py` module to handle database connections and logging with SQLAlchemy. - Integrated request logging into all command handlers. - Updated `requirements.txt` with necessary dependencies for MySQL. - Updated `.env` and `.gitignore` to manage database credentials securely. - Updated `Readme.md` with instructions on how to run the application using Docker Compose.
This commit is contained in:
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
bot:
|
||||
build: .
|
||||
container_name: vanessa_bot
|
||||
restart: always
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- DATABASE_URL=mysql+mysqlconnector://user:password@db:3306/vanessa_logs
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- .:/app
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
container_name: vanessa_db
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_DATABASE: vanessa_logs
|
||||
MYSQL_USER: user
|
||||
MYSQL_PASSWORD: password
|
||||
MYSQL_ROOT_PASSWORD: rootpassword
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
Reference in New Issue
Block a user