Merge branch 'main' of https://gitea.xinghangee.icu/datawhale/whale-town-end into ANGJustinl-main
This commit is contained in:
@@ -40,9 +40,8 @@ sudo mkdir -p /var/www
|
||||
cd /var/www
|
||||
|
||||
# 克隆项目(替换为你的实际仓库地址)
|
||||
sudo git clone https://your-gitea-server.com/username/pixel-game-server.git
|
||||
sudo chown -R $USER:$USER pixel-game-server
|
||||
cd pixel-game-server
|
||||
git clone https://gitea.xinghangee.icu/datawhale/whale-town-end.git
|
||||
cd whale-town-end
|
||||
```
|
||||
|
||||
### 3. 配置环境
|
||||
@@ -111,7 +110,7 @@ pm2 startup
|
||||
创建 Nginx 配置文件:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/nginx/sites-available/pixel-game-server
|
||||
sudo nano /etc/nginx/sites-available/whale-town-end
|
||||
```
|
||||
|
||||
添加以下内容:
|
||||
@@ -147,7 +146,7 @@ server {
|
||||
启用站点:
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/pixel-game-server /etc/nginx/sites-enabled/
|
||||
sudo ln -s /etc/nginx/sites-available/whale-town-end /etc/nginx/sites-enabled/
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
@@ -171,7 +170,7 @@ sudo systemctl reload nginx
|
||||
pm2 status
|
||||
|
||||
# 查看日志
|
||||
pm2 logs pixel-game-server
|
||||
pm2 logs whale-town-end
|
||||
pm2 logs webhook-handler
|
||||
|
||||
# 测试 API
|
||||
@@ -183,10 +182,10 @@ curl http://localhost:3000/api-docs
|
||||
|
||||
```bash
|
||||
# 重启服务
|
||||
pm2 restart pixel-game-server
|
||||
pm2 restart whale-town-end
|
||||
|
||||
# 查看日志
|
||||
pm2 logs pixel-game-server --lines 100
|
||||
pm2 logs whale-town-end --lines 100
|
||||
|
||||
# 手动部署
|
||||
bash deploy.sh
|
||||
@@ -195,7 +194,7 @@ bash deploy.sh
|
||||
git pull origin main
|
||||
pnpm install
|
||||
pnpm run build
|
||||
pm2 reload pixel-game-server
|
||||
pm2 reload whale-town-end
|
||||
```
|
||||
|
||||
## 故障排除
|
||||
|
||||
17
Dockerfile
17
Dockerfile
@@ -1,17 +1,22 @@
|
||||
# 使用官方 Node.js 镜像
|
||||
FROM node:18-alpine
|
||||
FROM node:lts-alpine
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装 pnpm
|
||||
RUN npm install -g pnpm
|
||||
# 设置构建参数
|
||||
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
||||
|
||||
# 复制 package.json 和 pnpm-lock.yaml
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
# 设置 npm 和 pnpm 镜像源
|
||||
RUN npm config set registry ${NPM_REGISTRY} && \
|
||||
npm install -g pnpm && \
|
||||
pnpm config set registry ${NPM_REGISTRY}
|
||||
|
||||
# 复制 package.json
|
||||
COPY package.json pnpm-workspace.yaml ./
|
||||
|
||||
# 安装依赖
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm install
|
||||
|
||||
# 复制源代码
|
||||
COPY . .
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('EmailService', () => {
|
||||
configService.get.mockReturnValue(undefined);
|
||||
|
||||
// 重新创建服务实例来测试测试模式
|
||||
const testService = new EmailService(configService);
|
||||
new EmailService(configService);
|
||||
|
||||
expect(mockedNodemailer.createTransport).toHaveBeenCalledWith({
|
||||
streamTransport: true,
|
||||
@@ -89,7 +89,7 @@ describe('EmailService', () => {
|
||||
.mockReturnValueOnce('test@gmail.com') // EMAIL_USER
|
||||
.mockReturnValueOnce('password'); // EMAIL_PASS
|
||||
|
||||
const testService = new EmailService(configService);
|
||||
new EmailService(configService);
|
||||
|
||||
expect(mockedNodemailer.createTransport).toHaveBeenCalledWith({
|
||||
host: 'smtp.gmail.com',
|
||||
@@ -403,7 +403,7 @@ describe('EmailService', () => {
|
||||
.mockReturnValueOnce(undefined) // EMAIL_USER
|
||||
.mockReturnValueOnce(undefined); // EMAIL_PASS
|
||||
|
||||
const testService = new EmailService(configService);
|
||||
new EmailService(configService);
|
||||
|
||||
expect(configService.get).toHaveBeenCalledWith('EMAIL_HOST', 'smtp.gmail.com');
|
||||
expect(configService.get).toHaveBeenCalledWith('EMAIL_PORT', 587);
|
||||
@@ -418,7 +418,7 @@ describe('EmailService', () => {
|
||||
.mockReturnValueOnce('custom@163.com') // EMAIL_USER
|
||||
.mockReturnValueOnce('custompass'); // EMAIL_PASS
|
||||
|
||||
const testService = new EmailService(configService);
|
||||
new EmailService(configService);
|
||||
|
||||
expect(mockedNodemailer.createTransport).toHaveBeenCalledWith({
|
||||
host: 'smtp.163.com',
|
||||
|
||||
@@ -377,7 +377,7 @@ describe('VerificationService', () => {
|
||||
it('应该返回存在的验证码统计信息', async () => {
|
||||
const codeInfo = {
|
||||
code: '123456',
|
||||
createdAt: Date.now(),
|
||||
createdAt: 1766035834340,
|
||||
attempts: 1,
|
||||
maxAttempts: 3,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user