Skip to content

Commit

Permalink
build: local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxy0551 committed Nov 20, 2024
1 parent 69baf39 commit d10bc1d
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 71 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@ cd yice-performance
> 易测检测系统和我司内部的 devops 系统深度绑定,用于检测我司需要登录的一些页面,但不影响评分功能的实现参考。

## 常见问题

### 1. yice-server 容器无法启动

  可能是 `docker` 版本较低,建议升级到 docker v24 及以上,升级前应当备份。

### 2. gcc 版本过低

  主机部署时建议使用 Ubuntu。
  主机模式部署时 CentOS7 上启动服务时报错:Error: /lib64/libstdc++.so.6: version 'CXXABI_1.3.9' not found,这是因为 CentOS7 的 gcc 版本过低,需要升级到 gcc-4.8.5 以上,执行下方命令可以看到没有 CXXABI_1.3.9。

``` shell
strings /lib64/libstdc++.so.6 | grep CXXABI
```

### 3. MacOS M 系列 arm 芯片本地安装 canvas 时失败

   node@14.21.3 pnpm@6.35.1 代理开增强模式,可以正常安装依赖并启动。出现报错时,可以考虑使用这个依赖版本组合。


## 趋势

[![Stargazers over time](https://starchart.cc/dtstack/yice-performance.svg)](https://starchart.cc/dtstack/yice-performance)
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"cron-parser": "^4.8.1",
"dingtalk-robot-sender": "^1.2.0",
"dotenv": "^16.3.1",
"jsdom": "^22.1.0",
"jsdom": "21.1.2",
"lighthouse": "9.6.8",
"mysql": "^2.18.1",
"mysql2": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN rm -rf /etc/apt/sources.list.d/google-chrome.list \

# 安装 nodejs
RUN apt-get update -y && apt-get install -y curl \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get remove -y curl \
&& apt-get install -y nodejs \
&& npm config set registry https://registry.npmmirror.com/ \
Expand Down
69 changes: 9 additions & 60 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,84 +43,33 @@ tail 200 -f /opt/dtstack/yice-performance/pm2-logs/pm2-out.log

### docker-compose

  当你使用 `docker-compose` 时,[docker-compose.yml](../docker/docker-compose.yml) 如下:

``` yaml
version: '3'

services:
mysql-service:
container_name: yice-mysql
image: registry.cn-hangzhou.aliyuncs.com/liuxy0551/yice-server:latest
ports:
- '3306:3306'
restart: always
networks:
- yice-network

server-service:
container_name: yice-server
image: registry.cn-hangzhou.aliyuncs.com/liuxy0551/yice-mysql:latest
ports:
- '4000:4000'
restart: always
depends_on:
- mysql-service
networks:
- yice-network

networks:
yice-network:
driver: bridge
```
  当你使用 `docker-compose` 时,注意 [docker-compose.yml](../docker/docker-compose.yml) 文件的内容。

  通过 docker-compose 启动程序:

``` shell
docker-compose -f docker/docker-compose.yml -p yice-performance up -d
```

  更新镜像和容器:

``` shell
docker-compose pull
docker-compose -p yice-performance up -d --force-recreate
docker image prune
```

  执行上述命令后可以在浏览器中访问 `http://localhost:4000` 查看效果。


### 修改配置项

  如果 `.env` 文件有需要修改的,可以通过新建一个 `.env.local` 文件来覆盖默认的配置项,将文件修改后复制到容器。

``` shell
docker cp yice-server:/yice-performance/.env /home/app/yice-performance/.env
```
``` shell
vim /home/app/yice-performance/.env
```
``` shell
docker cp /home/app/yice-performance/.env yice-server:/yice-performance/.env
```

``` shell
docker restart yice-server
```


### 常见问题

#### 1、yice-server 容器无法启动

  可能是 `docker` 版本较低,建议升级到 docker v24 及以上,升级前应当备份。

``` shell
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

```
node[1]: ../src/node_platform.cc:61:std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start(): Assertion `(0) == (uv_thread_create(t.get(), start_thread, this))' failed.
1: 0xb090e0 node::Abort() [node]
2: 0xb0915e [node]
3: 0xb7512e [node]
4: 0xb751f6 node::NodePlatform::NodePlatform(int, v8::TracingController*) [node]
5: 0xacbf74 node::InitializeOncePerProcess(int, char**, node::InitializationSettingsFlags, node::ProcessFlags::Flags) [node]
6: 0xaccb59 node::Start(int, char**) [node]
7: 0x7f2ffac64d90 [/lib/x86_64-linux-gnu/libc.so.6]
8: 0x7f2ffac64e40 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
9: 0xa408ec [node]
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@
},
"packageManager": "pnpm@6.35.1",
"engines": {
"node": ">=14"
"node": "=14"
}
}
41 changes: 33 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d10bc1d

Please sign in to comment.