1、安装MYSQL
2、安装Git客户端
3、下载Goploy安装包
mkdir goploy ./goploy
请输入mysql的用户: 请输入mysql的密码: 请输入mysql的主机(默认127.0.0.1,不带端口): 请输入mysql的端口(默认3306): 请输入日志目录的绝对路径(默认stdout): 请输入监听端口(默认80,打开网页时的端口,先检查端口是否被占用): #输入完成稍等片刻即可安装完成
4、新开一个窗口,开放8126端口
firewall-cmd --zone=public --add-port=8126/tcp --permanent systemctl restart firewalld
5、浏览器输入
10.0.0.63:8126
用户名:admin 密码:admin!@#
6、当前机器生成public-key
ssh-keygen #后面一直按Enter键就可以了
7、复制public-key
cd ~ cd .ssh cat id_rsa.pub #复制公钥
8、找到需要部署服务的B机器
cd ~ cd .ssh #查看是否存在authorized_keys文件,如果不存在,新增,否则无需处理 ll
9、新增authorized_keys(不一定需要)
touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
10、复制上面的公钥进入当前文件
vim authorized_keys #复制保存 ESC + :wq cat authorized_keys
之后点击确认,多个服务器可以使用导入
(一)、需要导入的服务器在authorized_keys中添加public-key
(二)、新建一个import.txt
(三)、修改后缀名为import.csv
11、环境配置
12、角色用户配置
(一)、超管有所有权限
(二)、zhangsan(开发者),王五(测试),赵六(产品)
13、根据Git构建流水线
公有云,无需用户名密码,如:码云
私有云的GIt路径,如阿里云
(一)、点击个人设置
(二)、记住用户名,设置密码(如果已经设置无需重复设置)
(三)、设置Git路径
https://username:password@code.aliyun.com/xxxx-xxx-vehicle/vehicle-admin.git
username替换前面Username的名称,password替换私人令牌
14、服务后台启动
(一)、关闭服务Ctrl+C
(二)、编辑启动文件
cd /lib/systemd/system vim goploy.service
[Unit] Description=The Goploy After=network.target [Service] Environment="HOME=/root" #安装goploy的路径 WorkingDirectory=/opt/goploy #执行的路径 ExecStart=/opt/goploy/goploy [Install] WantedBy=multi-user.target
#保存 Esc wq: #重新加载systemctl systemctl daemon-reload #可以设置自动启动,根据实际情况设置 systemctl enable goploy.service #启动 systemctl start goploy.service
()重新启动
15、安装goploy-agent
(一)、下载Goploy-agent启动包
(二)、新建目录
cd /opt/goploy mkdir goploy-agent touch goploy-agent.example.toml chmod +777 goploy-agent.toml vim goploy-agent.toml
env = 'production' [goploy] # goploy server url, empty to use it standalone reportURL = 'http://localhost:3001' # The same as goploy.jwt.key in goploy.toml key = '2021-12-17 10:44:44.5198737 +0800 CST m=+0.003999901' # Support id | name | host uidType = 'id' uid = '1' [log] path = 'stdout' [web] port = '3002'
(三)、上传下载的goploy-agentd到当前目录
(四)、编写启动脚本
cd /lib/systemd/system vim goploy-agent.service
[Unit] Description=The Goploy After=network.target [Service] Environment="HOME=/root" #安装goploy的路径 WorkingDirectory=/opt/goploy/goploy-agent #执行的路径 ExecStart=/opt/goploy/goploy-agent/goploy-agent [Install] WantedBy=multi-user.target
#保存 Esc wq: #重新加载systemctl systemctl daemon-reload #可以设置自动启动,根据实际情况设置 systemctl enable goploy-agent.service #启动 systemctl start goploy-agent.service
(五)开放端口3002
firewall-cmd --zone=public --add-port=3002/tcp --permanent systemctl restart firewalld
浏览器输入 10.0.0.63:3002



