一、spug介紹
Spug面向中小型企業設計的輕量級無 Agent 的自動化運維平台,整合了主機管理、主機批量執行、主機線上終端、檔案線上上傳下載下傳、應用釋出部署、線上任務計劃、配置中心、監控、報警等一系列功能。
1、Spug的功能
- 批量執行: 主機指令線上批量執行
- 線上終端: 主機支援浏覽器線上終端登入
- 檔案管理: 主機檔案線上上傳下載下傳
- 任務計劃: 靈活的線上任務計劃
- 釋出部署: 支援自定義釋出部署流程
- 配置中心: 支援 KV、文本、json 等格式的配置
- 監控中心: 支援站點、端口、程序、自定義等監控
- 報警中心: 支援短信、郵件、釘釘、微信等報警方式
- 優雅美觀: 基于 Ant Design 的 UI 界面
- 開源免費: 前後端代碼完全開源
2、安裝環境要求
- Docker
- 現代浏覽器
- Python 3.6+
- Django 2.2
- Node 12.14
- React 16.11
二、spug安裝
說明:示例作業系統為centos7.6
1、安裝docker
[[email protected] ~]# yum install docker
2、啟動docker
[[email protected] ~]# systemctl start docker
3、拉取spug鏡像
[[email protected] ~]# docker pull registry.aliyuncs.com/openspug/spug
Using default tag: latest
Trying to pull repository registry.aliyuncs.com/openspug/spug …
latest: Pulling from registry.aliyuncs.com/openspug/spug
9b4ebb48de8d: Pull complete
c4510a8c9615: Pull complete
5f4c55c74ba4: Pull complete
e4e46853876c: Pull complete
82b3cf722df5: Pull complete
93c1074bb114: Pull complete
b95e855f7d2e: Pull complete
fdac384598ed: Pull complete
02b944ba420f: Pull complete
c6c8b641b69a: Pull complete
2441ff86a83e: Pull complete
66d215f4ee5e: Pull complete
Digest: sha256:38e6509b136743a1e8a51a382c45eb8939ce2f8c3d37eeda4763da81c8d271c8
Status: Downloaded newer image for registry.aliyuncs.com/openspug/spug:latest
4、建立資料庫資料存儲目錄
[[email protected] ~]# mkdir -p /mydata/mysql
5、啟動spug容器
[[email protected] ~]# docker run -d --restart=always --name=spug -p 80:80 -v /mydata/:/mysql registry.aliyuncs.com/openspug/spug
440aa5291975640432ea0f0a1dc10e709bd8578167b55f1b27eb3cf5de294137
6、初始化spug
其中admin為使用者名,spug.test為密碼,可以自定義
[[email protected] ~]# docker exec spug init_spug admin spug.test
Migrations for ‘account’:
data/spug/spug_api/apps/account/migrations/0001_initial.py
…
Applying setting.0001_initial… OK
初始化/更新成功
建立使用者成功
7、重新開機spug容器
[[email protected] ~]# docker restart spug
spug
8、通路并登入spug
通路http://ip:80連結,登入spug,80為預設端口,在第5步時可以自定義spug服務的監聽端口。
9、開啟spug之旅
本人對于spug使用功能還較少,主要使用批量執行和監控中心。通過spug批量執行時間同步,hosts檔案同步、磁盤檢查、統計系統運作時間等。通過監控中心監控網站URL通路是否正常,程序是否正常等,通過微信及時告警。後面希望重點研究使用下應用釋出功能。
詳細使用手冊見官網文檔https://www.spug.dev/docs/about-spug/
三、FAQ
1、啟動spug時報錯
報錯内容
Error response from daemon: driver failed programming external connectivity on endpoint spug
原因:網絡發生了變化,比如firewalld執行了關閉、重新開機等,或者docker執行了重新開機等操作
解決方法:重新開機docker,然後重新開機spug