From 6008228d696fdaa94cf865347cf07c0895eb0eaf Mon Sep 17 00:00:00 2001 From: dalaolala Date: Thu, 26 Feb 2026 16:56:50 +0800 Subject: [PATCH] feat: add docker-compose configuration for external database --- docker-compose.external-db.yml | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docker-compose.external-db.yml diff --git a/docker-compose.external-db.yml b/docker-compose.external-db.yml new file mode 100644 index 0000000..f1077a9 --- /dev/null +++ b/docker-compose.external-db.yml @@ -0,0 +1,38 @@ +# 外挂数据库部署模板 +# 使用方式: +# 1. 复制本文件并填写数据库连接信息 +# 2. 初始化数据库:mysql -u root -p < install.sql +# 3. 启动:docker-compose -f docker-compose.external-db.yml up -d + +version: '3.8' + +services: + webssh: + image: dalaolala/webssh:latest + container_name: webssh-app + ports: + - "3000:3000" + environment: + # 数据库配置(填写你的外部 MySQL 信息) + - DB_HOST=your-mysql-host + - DB_PORT=3306 + - DB_USER=webssh_user + - DB_PASSWORD=your-db-password + - DB_NAME=webssh + + # 安全配置(请替换为强随机值,部署后不可更改) + - JWT_SECRET=your-jwt-secret + - ENCRYPTION_KEY=your-32-byte-encryption-key + + # 运行环境 + - NODE_ENV=production + - PORT=3000 + + restart: unless-stopped + + healthcheck: + test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/auth/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s