Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dev docker compose #5

Merged
merged 17 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# common settings
FarmerChillax marked this conversation as resolved.
Show resolved Hide resolved
TZ=Asia/Shanghai
NETWORKS_DRIVER=bridge


# resource limit
LIMIT_MEMORY_MYSQL=2G
LIMIT_MEMORY_REDIS=2G


# PATHS
MySQL_PATH=./data/mysql # mysql data storage path
REDIS_PATH=./data/redis # redis data storage path


# MYSQL
MYSQL_PORT=3306
MYSQL_USERNAME=admin
MYSQL_PASSWORD=123456
MYSQL_ROOT_PASSWORD=123456
MYSQL_DATABASE=dev-database # database name
FarmerChillax marked this conversation as resolved.
Show resolved Hide resolved

# REDIS
REDIS_PORT=6379
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ celerybeat.pid
*.sage.py

# Environments
.env
# .env
FarmerChillax marked this conversation as resolved.
Show resolved Hide resolved
.venv
env/
venv/
Expand Down Expand Up @@ -161,3 +161,5 @@ cython_debug/

.pdm-python
*.db

data/**
42 changes: 42 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
networks:
devNetwork:
driver: ${NETWORKS_DRIVER}

services:
mysql:
image: mysql:8.0
privileged: true
environment:
- TZ=${TZ}
- MYSQL_USER=${MYSQL_USERNAME} # MySQL username
- MYSQL_PASSWORD=${MYSQL_PASSWORD} # MySQL user password
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} # MySQL root user password
- MYSQL_DATABASE=${MYSQL_DATABASE}
volumes:
- ${MySQL_PATH}:/var/lib/mysql
ports:
- "${MYSQL_PORT}:3306" # mapping 3306 port
networks:
- devNetwork
deploy:
resources:
limits:
memory: ${LIMIT_MEMORY_MYSQL}
restart: always

redis:
image: redis:5.0
environment:
- TZ=${TZ}
privileged: true
volumes:
- ${REDIS_PATH}:/data
ports:
- "${REDIS_PORT}:6379" # mapping 6379 port
networks:
- devNetwork
deploy:
resources:
limits:
memory: ${LIMIT_MEMORY_REDIS}
restart: always