安裝shipyard前提是已安裝好Docker,詳見【Linux安裝筆記九:Linux服務(wù)器安裝Docker】,本次使用操作系統(tǒng)依然是CentOS7
前言
shipyard安裝參照官網(wǎng) https://shipyard-project.com/deploy/ 有兩種方式:
1、自動安裝硫豆,即執(zhí)行curl -sSL https://shipyard-project.com/deploy | bash -s
命令即可,但是放到Linux下執(zhí)行根本跑不通。
2秤标、手動安裝,本文使用手動安裝的方式宙刘,具體步驟如下:
1苍姜、下載所需docker鏡像
docker pull rethinkdb
docker pull microbox/etcd
docker pull shipyard/docker-proxy
docker pull swarm
docker pull dockerclub/shipyard
2、修改原安裝腳本為中文版安裝腳本
注:此步驟兩個下載腳本的鏈接都不好用悬包,終于在網(wǎng)上找到了一個腳本使用衙猪,命名為shipyard-deploy,上傳到/home/script文件夾下
#下載官方腳本
wget https://shipyard-project.com/deploy
若下載失敗請使用
wget https://raw.githubusercontent.com/shipyard/shipyard-project.com/master/site/themes/shipyard/static/deploy
#替換官方腳本
grep -n shipyard:latest deploy
sed -i 's/shipyard\/shipyard:latest/dockerclub\/shipyard:latest/g' deploy
或者找到shipyard-deploy腳本里的shipyard/shipyard:latest
改成dockerclub/shipyard:latest
就行
3布近、設(shè)置web訪問端口(根據(jù)需要修改)
方式一:
#檢查8080端口是否被占用垫释,若占用需修改端口
yum install -y net-tools //安裝net-tools工具包,若已安裝可跳過此步驟
netstat -tlnp | grep 8080 //查看宿主機8080端口是否被占用
#配置修改
grep -n 'PORT:-8080' deploy
SHIPYARD_PORT=${PORT:-8080}
修改為
SHIPYARD_PORT=${PORT:-指定端口}
方式二:直接修改腳本文件
代理端口(PROXY_PORT)改為12375
WEB端口(SHIPYARD_PORT)改為18080
4吊输、安裝與刪除
cd /home/script
#安裝 啟動
sh shipyard-deploy
#刪除 停止
cat shipyard-deploy | ACTION=remove bash
啟動成功提示:
[root@localhost script]# sh shipyard-deploy
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
c9b1b535fdd9: Pulling fs layer
c9b1b535fdd9: Verifying Checksum
c9b1b535fdd9: Download complete
c9b1b535fdd9: Pull complete
Digest: sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
Status: Downloaded newer image for alpine:latest
Deploying Shipyard
-> Starting Database
-> Starting Discovery
-> Starting Cert Volume
-> Starting Proxy
-> Starting Swarm Manager
-> Starting Swarm Agent
-> Starting Controller
Waiting for Shipyard on 192.168.197.91:18080
查看驗證是否安裝或刪除
docker ps
5饶号、使用shipyard
瀏覽器輸入:http://主機IP:8080
默認賬號:admin
默認密碼:shipyard
6、shipyard添加其他節(jié)點主機
比如將172.16.60.220機器節(jié)點加入到上面的shipyard管理中.
則需要在被加入節(jié)點機器上如下操作:
- 在被加入的節(jié)點上上傳腳本文件shipyard-deploy
- 執(zhí)行下面操作 (注意下面etcd地址要寫成shipyard部署機的ip地址. 首次執(zhí)行時會自動下載鏡像,需要等待一段時間)
cat shipyard-deploy| ACTION=node DISCOVERY=etcd://192.168.197.91:4001 bash
Adding Node
-> Starting Cert Volume
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
-> Starting Swarm Agent
Node added to Swarm: 192.168.3.142
查看安裝好的shipyard docker ps
注意:添加節(jié)點時季蚂,上面一鍵腳本需要運行在被添加的節(jié)點主機上茫船,而不是shipyard部署節(jié)點的機器上。
然后登錄http://192.168.3.141:18080,在"容器管理"-"主機節(jié)點"中看到添加的節(jié)點信息了.
7扭屁、刪除節(jié)點機
cat shipyard-deploy |ACTION=remove bash -s
驗證是否刪除成功docker ps
8算谈、遇到問題
1、shipyard可以啟動訪問料滥,但是刷新不出容器然眼,鏡像
解決:因為我們修改了代理端口(PROXY_PORT)改為12375,需要配置防火墻開啟此端口葵腹,
firewall-cmd --zone=public --add-port=12375/tcp --permanent
firewall-cmd --reload
或者關(guān)閉防火墻高每,重啟Docker systemctl restart docker
就好了