-
Notifications
You must be signed in to change notification settings - Fork 1
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: activity functions #2
base: master
Are you sure you want to change the base?
Changes from all commits
bffca07
78ae7a2
85cadfb
7306f09
2c23802
93e8069
2dad571
86f701a
51dc4a2
24064cd
721d689
99975b4
96b4a99
9c0b187
1d4c51e
c6e3356
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
/config/conf.yaml | ||
/docs/思.md | ||
/test | ||
/volumes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
services: | ||
kafka: | ||
image: docker.io/bitnami/kafka:3.9 | ||
container_name: kafka_EG | ||
ports: | ||
- "9092:9092" | ||
volumes: | ||
- ./volumes/kafka:/bitnami | ||
environment: | ||
# KRaft settings | ||
- KAFKA_CFG_NODE_ID=0 | ||
- KAFKA_CFG_PROCESS_ROLES=controller,broker | ||
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 | ||
# Listeners | ||
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 | ||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 | ||
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT | ||
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER | ||
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT | ||
|
||
zookeeper: | ||
container_name: zookeeper_EG | ||
image: docker.io/bitnami/zookeeper:3.9 | ||
ports: | ||
- '2181:2181' | ||
volumes: | ||
- ./volumes/zookeeper:/bitnami/zookeeper | ||
environment: | ||
- ALLOW_ANONYMOUS_LOGIN=yes | ||
|
||
db: | ||
image: mysql:8.0 | ||
container_name: mysql_EG | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 114514 | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- ./volumes/mysql:/var/lib/mysql | ||
|
||
Comment on lines
+31
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Address MySQL security concerns and configuration.
db:
image: mysql:8.0
container_name: mysql_EG
restart: always
environment:
- MYSQL_ROOT_PASSWORD: 114514
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
+ MYSQL_DATABASE: ${MYSQL_DATABASE}
+ MYSQL_USER: ${MYSQL_USER}
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD}
+ MYSQL_CHARACTER_SET_SERVER: utf8mb4
+ MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
ports:
- "3306:3306"
volumes:
- - ./volumes/mysql:/var/lib/mysql
+ - mysql_data:/var/lib/mysql
+ healthcheck:
+ test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
+ interval: 30s
+ timeout: 10s
+ retries: 3 Create a MYSQL_ROOT_PASSWORD=your_secure_password
MYSQL_DATABASE=app_db
MYSQL_USER=app_user
MYSQL_PASSWORD=app_password Add at the end of the file: volumes:
mysql_data:
driver: local |
||
redis: | ||
image: redis:7.0 | ||
container_name: redis_EG | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- ./volumes/redis:/data | ||
|
||
Comment on lines
+42
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance Redis security and performance configuration. Consider the following improvements:
redis:
image: redis:7.0
container_name: redis_EG
restart: always
+ command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 512mb --maxmemory-policy allkeys-lru
ports:
- "6379:6379"
volumes:
- - ./volumes/redis:/data
+ - redis_data:/data
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 30s
+ timeout: 10s
+ retries: 3 Add to REDIS_PASSWORD=your_secure_password Add at the end of the file: volumes:
redis_data:
driver: local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hardcoding database credentials.
The MySQL password should not be hardcoded in the source code. Instead, load it from environment variables or a secure configuration file.
Apply this diff to use environment variables:
Add these imports: