feat: 添加完整的部署支持
- 后端多环境配置(dev, prod) - Docker 部署支持(Dockerfile, docker-compose.yml) - Java 部署脚本(deploy.sh) - 前端构建脚本(build.sh,支持自定义后端地址) - 健康检查接口(/api/health) - 完整的部署文档(docs/DEPLOYMENT.md) - 前端环境变量支持(VITE_API_URL, VITE_WS_URL)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.wrbug.polymarketbot.controller
|
||||
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 健康检查控制器
|
||||
* 用于 Docker 健康检查和监控
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/health")
|
||||
class HealthController {
|
||||
|
||||
@GetMapping
|
||||
fun health(): ResponseEntity<Map<String, Any>> {
|
||||
return ResponseEntity.ok(mapOf(
|
||||
"status" to "UP",
|
||||
"timestamp" to System.currentTimeMillis(),
|
||||
"service" to "polymarket-bot-backend"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# 应用配置
|
||||
spring.application.name=polymarket-bot-backend
|
||||
|
||||
# 数据源配置
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/polymarket_bot?useSSL=false&serverTimezone=UTC&characterEncoding=utf8&allowPublicKeyRetrieval=true
|
||||
# 数据源配置(默认配置,可通过环境变量覆盖)
|
||||
spring.datasource.url=${DB_URL:jdbc:mysql://localhost:3306/polymarket_bot?useSSL=false&serverTimezone=UTC&characterEncoding=utf8&allowPublicKeyRetrieval=true}
|
||||
spring.datasource.username=${DB_USERNAME:root}
|
||||
spring.datasource.password=${DB_PASSWORD:11111111}
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
@@ -25,6 +25,10 @@ spring.flyway.baseline-on-migrate=true
|
||||
# 服务器配置
|
||||
server.port=${SERVER_PORT:8000}
|
||||
|
||||
# Spring Profile 配置
|
||||
# 默认使用 dev 环境,可通过 --spring.profiles.active=prod 切换
|
||||
spring.profiles.active=${SPRING_PROFILES_ACTIVE:dev}
|
||||
|
||||
# 日志配置
|
||||
logging.level.root=INFO
|
||||
logging.level.com.wrbug.polymarketbot=DEBUG
|
||||
|
||||
Reference in New Issue
Block a user