diff --git a/deployment.zip b/deployment.zip index d35c591..e1d750d 100644 Binary files a/deployment.zip and b/deployment.zip differ diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index b29a5b2..d3c7530 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -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: diff --git a/install.sh b/install.sh index 0513582..127f7a1 100644 --- a/install.sh +++ b/install.sh @@ -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