IDEA 一鍵自動(dòng)在Ubuntu 部署 Springboot 的 Jar包
1.創(chuàng)建服務(wù)文件 /etc/systemd/system/test.service
如果不需要指定配置文件自行修改
[Unit]
Description=測(cè)試
After=syslog.target
[Service]
User=root
Restart=always
ExecStart=java -jar /root/test/test.jar --spring.config.additional-location=file:/root/test/test.yml
StandardOutput=append:/root/test/test.log
StandardError=append:/root/test/test.log
[Install]
WantedBy=multi-user.target
2.依次執(zhí)行
重新加載服務(wù):sudo systemctl daemon-reload
啟動(dòng)服務(wù):sudo systemctl start my-service
設(shè)置自啟動(dòng):sudo systemctl enable my-service
3.IDEA安裝 Alibaba Cloud Toolkit 插件,并配置服務(wù)器地址、端口、密碼


4.添加運(yùn)行配置
1)選擇上傳文件以及jar文件路徑
2)選擇剛才添加的主機(jī)
3)選擇上傳目錄
4)設(shè)置上傳后執(zhí)行的命令(重啟服務(wù))
5)設(shè)置運(yùn)行前Maven打包

5.完成
后續(xù)可以使用 tail -fn 500 test/test.log 查看日志
浙公網(wǎng)安備 33010602011771號(hào)