mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 07:56:37 +08:00
优化部署
This commit is contained in:
Binary file not shown.
@@ -11,8 +11,8 @@ services:
|
||||
MYSQL_USER: ${DB_USER} # 数据库用户
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD} # 数据库密码
|
||||
TZ: Asia/Shanghai
|
||||
# ports:
|
||||
# - "3306:3306" # 不暴露到公网,只在容器内部访问
|
||||
ports:
|
||||
- "127.0.0.1:3306:3306" # 只绑定到本机内部,不暴露到公网
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./gost.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
@@ -29,8 +29,8 @@ services:
|
||||
image: redis:alpine
|
||||
container_name: gost-redis
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - "6379:6379" # 不暴露到公网,只在容器内部访问
|
||||
ports:
|
||||
- "127.0.0.1:6379:6379" # 只绑定到本机内部,不暴露到公网
|
||||
networks:
|
||||
- gost-network
|
||||
healthcheck:
|
||||
|
||||
+23
-2
@@ -27,7 +27,20 @@ fi
|
||||
INSTALL_DIR="/etc/gost"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
# 检查gost服务是否存在并运行
|
||||
if systemctl list-units --full -all | grep -Fq "gost.service"; then
|
||||
echo "检测到已存在的gost服务"
|
||||
if systemctl is-active --quiet gost; then
|
||||
echo "停止运行中的gost服务..."
|
||||
systemctl stop gost
|
||||
fi
|
||||
if systemctl is-enabled --quiet gost; then
|
||||
echo "禁用gost服务自启动..."
|
||||
systemctl disable gost
|
||||
fi
|
||||
fi
|
||||
|
||||
# 删除旧文件
|
||||
for FILE in gost config.json gost.json; do
|
||||
if [[ -f "$INSTALL_DIR/$FILE" ]]; then
|
||||
echo "删除已有文件: $INSTALL_DIR/$FILE"
|
||||
@@ -88,6 +101,14 @@ EOF
|
||||
systemctl daemon-reexec
|
||||
systemctl daemon-reload
|
||||
systemctl enable gost
|
||||
systemctl restart gost
|
||||
systemctl start gost
|
||||
|
||||
echo "安装完成,配置文件位于 $INSTALL_DIR,并设置为开机启动。"
|
||||
# 检查服务状态
|
||||
if systemctl is-active --quiet gost; then
|
||||
echo "✅ 安装完成,gost服务已启动并设置为开机启动。"
|
||||
echo "配置文件位于: $INSTALL_DIR"
|
||||
echo "服务状态: $(systemctl is-active gost)"
|
||||
else
|
||||
echo "❌ gost服务启动失败,请检查日志:"
|
||||
echo "journalctl -u gost -f"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user