背景
打包平台目前包含了APP打包构建、包历史展示(蒲公英)、埋点数据展示。
整个系统是部署在一台闲置的mac电脑上,用ip来访问。
Html
部署在nginx上
cd /usr/local/Cellar/nginx/版本号/html
// weeks/index.html 为此次部署的前端资源
Tomcat+Jenkins
● 使用Tomcat+jenkins的集成方式。
● jenkins是部署在tomcat上,同步tomcat的启动、关闭。
8080为Tomcat默认端口
cd /Library/Tomcat/bin // 目录
// 启动前先执行关闭
./startup.sh // 启动
./shutdown.sh // 关闭
egg
node后端使用egg+mysql搭建
● 接口访问地址为ip:7001
● 可通过配置文件进行配置,重启生效
// egg服务端代码
cd /Users/starfish/Desktop/StarFish/weeks_node
npm run start //启动
npm run stop //停止
// 配置信息
// */weeks_node/config/config.default.js
config.cluster = {
listen: {
path: '',
port: 7001, //端口
hostname: '172.16.12.5' // IP
}
}
Nginx(核心)
作为桥接用户、Tomcat、egg的重要核心
// 打开配置文件 nginx.conf
cd /usr/local/etc/nginx
open .
location ~/Jenkins/ {
proxy_pass http://172.16.13.228:8080;
}
location ~/api/ {
proxy_pass http://172.16.13.228:7001;
}
location ~/weeks/ {
root html;
index index.html index.htm;
}
● 用户在访问时,会根据path来做转发。
○ /Jenkins/ 转发到tomcat上 (jenkins部署在tomcat上)
○ /api/ 转发到egg上 (node服务器)
○ /weeks/ 转发到静态资源html上