后台使用的 layui 模板来自这个项目 master 分支的 a806fd0a 版本
devops 项目模块:
devops-mgr 和 devops-agent 之间的关系如下图所示:

agent 和 mgr 之间使用 websocket 进行通信
每台被管理的机器上都需要且只能一个部署 agent 实例
在 agent 的配置文件中指定 mgr 的地址
agent 使用 Linux /etc/machine-id 文件中的字符串作为 machineId 在 mgr 中唯一地标识一台机器
如果 VirtualBox 中使用的 vdisk 是通过 clonehd 得到, 那么多台 VM 中 /etc/machine-id 文件的内容是相同的, 此时需要在 VM 中执行 devops/zzz/reset_machine_id.sh 脚本来重置 machine-id
只能部署一个 mgr 实例
构建 jar 包流程:
部署 devops-mgr 流程:
部署 devops-agent 流程:
多节点部署需要用到 devops-deployer 工具, 它本质上是一个 SFTP/SSH 客户端, 在和节点建立 SSH 连接后, 执行相应的 Shell 命令.
devops-mgr 应用通常是经由 Nginx 反向带来来访问, 并且 Nginx 还需要提供对 websocket 的支持.
nginx.conf 文件中配置 websocket:
map $http_connection $connection_upgrade {
"~*Upgrade" $http_connection;
default keep-alive;
}
Nginx 代理配置示例:
server {
listen 80;
server_name devops.reghao.cn;
access_log off;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:4020;
}
location /ws {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache off;
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 100s;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:4020;
}
}
至此, devops 系统已部署并处于运行状态, 你可通过自己域名或直接通过 IP:PORT 访问系统.
devops-mgr 中默认只有一个 admin 用户, 帐号和密码分别为 admin 和 123456
强烈建议首次登录后修改 admin 用户密码