feat(deploy): 添加生产环境部署配置

- 新增 deploy/config/backend/application-prod.yaml 生产环境配置
- 新增 deploy/docker-compose-simple.yml 简化部署脚本
This commit is contained in:
tangweijie 2026-02-04 19:22:13 +08:00
parent 22e05adfe4
commit 43976eeffc
2 changed files with 164 additions and 0 deletions

View File

@ -0,0 +1,114 @@
server:
port: 48080
--- #################### 数据库相关配置 ####################
spring:
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration
- org.springframework.ai.vectorstore.qdrant.autoconfigure.QdrantVectorStoreAutoConfiguration
- org.springframework.ai.vectorstore.milvus.autoconfigure.MilvusVectorStoreAutoConfiguration
# 数据源配置项
datasource:
druid:
web-stat-filter:
enabled: true
stat-view-servlet:
enabled: true
allow: 127.0.0.1
url-pattern: /druid/*
login-username: ${DRUID_USERNAME:admin}
login-password: ${DRUID_PASSWORD:admin123}
filter:
stat:
enabled: true
log-slow-sql: true
slow-sql-millis: 100
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
druid:
initial-size: 2
min-idle: 2
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
max-evictable-idle-time-millis: 900000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
primary: master
datasource:
master:
url: jdbc:mysql://192.168.10.130:3306/xlcp_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true
username: xlcp_dev
password: xlcp_dev
# Redis 配置
data:
redis:
host: 192.168.10.126
port: 46379
database: 0
password: redis_Dbdb2F
--- #################### 定时任务相关配置 ####################
spring:
quartz:
auto-startup: false
scheduler-name: schedulerName
job-store-type: memory
wait-for-jobs-to-complete-on-shutdown: true
--- #################### 微信公众号、小程序相关配置 ####################
wx:
mp:
app-id: wx041349c6f39b268b
secret: 5abee519483bc9f8cb37ce280e814bd0
config-storage:
type: RedisTemplate
key-prefix: wx
http-client-type: HttpClient
miniapp:
appid: wx63c280fe3248a3e7
secret: 6f270509224a7ae1296bbf1c8cb97aed
config-storage:
type: RedisTemplate
key-prefix: wa
http-client-type: HttpClient
--- #################### 芋道相关配置 ####################
yudao:
pay:
order-notify-url: http://localhost:48080/admin-api/pay/notify/order
refund-notify-url: http://localhost:48080/admin-api/pay/notify/refund
transfer-notify-url: http://localhost:48080/admin-api/pay/notify/transfer
demo: false
justauth:
enabled: true
cache:
type: REDIS
prefix: 'social_auth_state:'
timeout: 24h
--- #################### 监控相关配置 ####################
management:
endpoints:
web:
base-path: /actuator
exposure:
include: '*'
logging:
file:
name: ./logs/yudao-server.log

View File

@ -0,0 +1,50 @@
name: xlcp
services:
# 后端服务
backend:
container_name: xlcp-backend
image: eclipse-temurin:21-jre-alpine
restart: unless-stopped
ports:
- "48080:48080"
environment:
SPRING_PROFILES_ACTIVE: local
JAVA_OPTS: -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/logs
TZ: Asia/Shanghai
# 使用现有 dev 数据库配置
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL: jdbc:mysql://192.168.10.130:3306/xlcp_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_USERNAME: xlcp_dev
SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_PASSWORD: xlcp_dev
SPRING_DATA_REDIS_HOST: 192.168.10.126
SPRING_DATA_REDIS_PORT: 46379
SPRING_DATA_REDIS_PASSWORD: redis_Dbdb2F
volumes:
- ./logs/backend:/logs
- ./data/upload:/app/data/upload
- ./config/backend/application-local.yaml:/app/config/application-local.yaml:ro
- /data/projects/backend/yudao-server/target/yudao-server.jar:/app/app.jar:ro
working_dir: /app
command: ["sh", "-c", "apk add --no-cache curl tzdata >/dev/null 2>&1 && java $JAVA_OPTS -jar /app/app.jar --spring.config.additional-location=file:/app/config/"]
networks:
- xlcp-network
# 前端 Nginx
frontend:
container_name: xlcp-frontend
image: nginx:1.25-alpine
user: "0:0"
restart: unless-stopped
ports:
- "18080:80"
volumes:
- ./docker/frontend/nginx.conf:/etc/nginx/nginx.conf:ro
- /data/projects/frontend/dist:/usr/share/nginx/html:ro
- ./logs/nginx:/var/log/nginx
networks:
- xlcp-network
networks:
xlcp-network:
name: xlcp-network
driver: bridge