分类

链接

2018 年 9 月
 12
3456789
10111213141516
17181920212223
24252627282930

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > 大数据 > 正文
共享办公室出租
Centos 7安装SHIPYARD中文版
大数据 暂无评论 阅读(452)

安装/升级你的Docker客户端

推荐安装1.10.0以上版本的Docker客户端。

您可以通过阿里云的镜像仓库下载:docker-engine、docker-ce

或执行以下命令:

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

如何使用Docker加速器
针对Docker客户端版本大于1.10的用户

您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

TypeScript

这个网站: https://cr.console.aliyun.com/#/accelerator 通过注册 获取自己的加速站点

那么安装好Docker之后就可以安装SHIPYARD管理平台,我自己做的汉化,之前sf的大兄弟的shipyard中文版已经很久没更新了

这里我已经写好了安装脚本,并且可以直接安装阿里云docker(也就是上面的东西可以不做)但是需要你提供加速网站地址

当然你也可以使用官方脚本安装shipyard,然后参考 https://github.com/StarWars-Team/shipyard_zh 把汉化文件覆盖到控制端也是不错的选择

 

  1. #!/bin/bash
  2. cat << EOF
  3. =========================================================================
  4.  _____         _       
  5. |   __|_ _ ___| |_ _ _ 
  6. |   __| | |   | '_| | |
  7. |__|  |___|_|_|_,_|_  |
  8.                   |___|
  9. =========================================================================
  10. Mr.Funky Auto Install GeekCloud-Docker-Manager for CENTOS\REHL 7 
  11. =========================================================================
  12. Author: Mr Funky <QQ:708863861>
  13. =========================================================================
  14. USER: $USER   HOST: $HOSTNAME  KERNEL: `uname -r`  
  15. DISK :`ls  /dev/sd?`
  16. Are you sure to auto install GeekCloud-Docker-Manager?
  17. EOF
  18. green='\e[1;32m' # green
  19. red='\e[1;31m' # red
  20. blue='\e[1;34m' # blue  
  21. nc='\e[0m' # normal
  22. ACTION=${ACTION:-deploy}
  23. IMAGE=${IMAGE:-shipyard/shipyard:latest}
  24. PREFIX=${PREFIX:-shipyard}
  25. SHIPYARD_ARGS=${SHIPYARD_ARGS:-""}
  26. TLS_CERT_PATH=${TLS_CERT_PATH:-}
  27. CERT_PATH="/etc/shipyard"
  28. PROXY_PORT=${PROXY_PORT:-2375}
  29. SWARM_PORT=3375
  30. SHIPYARD_PROTOCOL=http
  31. SHIPYARD_PORT=${PORT:-8080}
  32. SHIPYARD_IP=${IP}
  33. DISCOVERY_BACKEND=etcd
  34. DISCOVERY_PORT=4001
  35. DISCOVERY_PEER_PORT=7001
  36. ENABLE_TLS=0
  37. CERT_FINGERPRINT=""
  38. LOCAL_CA_CERT=""
  39. LOCAL_SSL_CERT=""
  40. LOCAL_SSL_KEY=""
  41. LOCAL_SSL_CLIENT_CERT=""
  42. LOCAL_SSL_CLIENT_KEY=""
  43. SSL_CA_CERT=""
  44. SSL_CERT=""
  45. SSL_KEY=""
  46. SSL_CLIENT_CERT=""
  47. SSL_CLIENT_KEY=""
  48.  
  49. setselinux(){
  50.     echo -n "Closing Selinx ..."
  51.     sleep 0.3
  52.     sed -i  's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  53.     echo -n "."
  54.     sleep 0.3
  55.     echo -n "."
  56.     i=`setenforce 0`  
  57.     echo -n $i
  58.     echo -n "Config Selinux ....."
  59.     if [ $? == 0 -o $? == 1  ];then
  60.         echo -e " [${green}Success${nc}]"
  61.     else
  62.         echo -e "[${red}Failed${nc}]"
  63.         echo "Please check your config.."
  64.         exit 2
  65.     fi
  66. }
  67. check_certs() {
  68.     if [ -z "$TLS_CERT_PATH" ]; then
  69.         return
  70.     fi
  71.  
  72.     if [ ! -e $TLS_CERT_PATH ]; then
  73.         echo "Error: unable to find certificates in $TLS_CERT_PATH"
  74.         show_cert_help
  75.         exit 1
  76.     fi
  77.  
  78.     if [ "$PROXY_PORT" = "2375" ]; then
  79.         PROXY_PORT=2376
  80.     fi
  81.     SWARM_PORT=3376
  82.     SHIPYARD_PROTOCOL=https
  83.     LOCAL_SSL_CA_CERT="$TLS_CERT_PATH/ca.pem"
  84.     LOCAL_SSL_CERT="$TLS_CERT_PATH/server.pem"
  85.     LOCAL_SSL_KEY="$TLS_CERT_PATH/server-key.pem"
  86.     LOCAL_SSL_CLIENT_CERT="$TLS_CERT_PATH/cert.pem"
  87.     LOCAL_SSL_CLIENT_KEY="$TLS_CERT_PATH/key.pem"
  88.     SSL_CA_CERT="$CERT_PATH/ca.pem"
  89.     SSL_CERT="$CERT_PATH/server.pem"
  90.     SSL_KEY="$CERT_PATH/server-key.pem"
  91.     SSL_CLIENT_CERT="$CERT_PATH/cert.pem"
  92.     SSL_CLIENT_KEY="$CERT_PATH/key.pem"
  93.     CERT_FINGERPRINT=$(openssl x509 -noout -in $LOCAL_SSL_CERT -fingerprint -sha256 | awk -F= '{print $2;}')
  94.  
  95.     if [ ! -e $LOCAL_SSL_CA_CERT ] || [ ! -e $LOCAL_SSL_CERT ] || [ ! -e $LOCAL_SSL_KEY ] || [ ! -e $LOCAL_SSL_CLIENT_CERT ] || [ ! -e $LOCAL_SSL_CLIENT_KEY ]; then
  96.         echo "Error: unable to find certificates"
  97.         show_cert_help
  98.         exit 1
  99.     fi
  100.  
  101.     ENABLE_TLS=1
  102. }
  103.  
  104. start_certs() {
  105.     ID=$(docker run \
  106.         -ti \
  107.         -d \
  108.         --restart=always \
  109.         --name $PREFIX-certs \
  110.         -v $CERT_PATH \
  111.         alpine \
  112.         sh)
  113.     if [ $ENABLE_TLS = 1 ]; then
  114.         docker cp $LOCAL_SSL_CA_CERT $PREFIX-certs:$SSL_CA_CERT
  115.         docker cp $LOCAL_SSL_CERT $PREFIX-certs:$SSL_CERT
  116.         docker cp $LOCAL_SSL_KEY $PREFIX-certs:$SSL_KEY
  117.         docker cp $LOCAL_SSL_CLIENT_CERT $PREFIX-certs:$SSL_CLIENT_CERT
  118.         docker cp $LOCAL_SSL_CLIENT_KEY $PREFIX-certs:$SSL_CLIENT_KEY
  119.     fi
  120. }
  121.  
  122.  
  123.  
  124. get_ip() {
  125.     if [ -z "$SHIPYARD_IP" ]; then
  126.         SHIPYARD_IP=`docker run --rm --net=host alpine ip route get 8.8.8.8 | awk '{ print $7;  }'`
  127.     fi
  128. }
  129.  
  130. start_discovery() {
  131.     get_ip
  132.  
  133.     ID=$(docker run \
  134.         -ti \
  135.         -d \
  136.         -p 4001:4001 \
  137.         -p 7001:7001 \
  138.         --restart=always \
  139.         --name $PREFIX-discovery \
  140.         microbox/etcd:latest -addr $SHIPYARD_IP:$DISCOVERY_PORT -peer-addr $SHIPYARD_IP:$DISCOVERY_PEER_PORT)
  141. }
  142. start_rethinkdb() {
  143.     ID=$(docker run \
  144.         -ti \
  145.         -d \
  146.         --restart=always \
  147.         --name $PREFIX-rethinkdb \
  148.         rethinkdb)
  149. }
  150. start_proxy() {
  151.     TLS_OPTS=""
  152.     if [ $ENABLE_TLS = 1 ]; then
  153.         TLS_OPTS="-e SSL_CA=$SSL_CA_CERT -e SSL_CERT=$SSL_CERT -e SSL_KEY=$SSL_KEY -e SSL_SKIP_VERIFY=1"
  154.     fi
  155.     # Note: we add SSL_SKIP_VERIFY=1 to skip verification of the client
  156.     # certificate in the proxy image.  this will pass it to swarm that
  157.     # does verify.  this helps with performance and avoids certificate issues
  158.     # when running through the proxy.  ultimately if the cert is invalid
  159.     # swarm will fail to return.
  160.     ID=$(docker run \
  161.         -ti \
  162.         -d \
  163.         -p $PROXY_PORT:$PROXY_PORT \
  164.         --hostname=$HOSTNAME \
  165.         --restart=always \
  166.         --name $PREFIX-proxy \
  167.         -v /var/run/docker.sock:/var/run/docker.sock \
  168.         -e PORT=$PROXY_PORT \
  169.         --volumes-from=$PREFIX-certs $TLS_OPTS\
  170.         shipyard/docker-proxy:latest)
  171. }
  172. start_swarm_manager() {
  173.     get_ip
  174.  
  175.     TLS_OPTS=""
  176.     if [ $ENABLE_TLS = 1 ]; then
  177.         TLS_OPTS="--tlsverify --tlscacert=$SSL_CA_CERT --tlscert=$SSL_CERT --tlskey=$SSL_KEY"
  178.     fi
  179.  
  180.     EXTRA_RUN_OPTS=""
  181.  
  182.     if [ -z "$DISCOVERY" ]; then
  183.         DISCOVERY="$DISCOVERY_BACKEND://discovery:$DISCOVERY_PORT"
  184.         EXTRA_RUN_OPTS="--link $PREFIX-discovery:discovery"
  185.     fi
  186.     ID=$(docker run \
  187.         -ti \
  188.         -d \
  189.         --restart=always \
  190.         --name $PREFIX-swarm-manager \
  191.         --volumes-from=$PREFIX-certs $EXTRA_RUN_OPTS \
  192.         swarm:latest \
  193.         m --replication --addr $SHIPYARD_IP:$SWARM_PORT --host tcp://0.0.0.0:$SWARM_PORT $TLS_OPTS $DISCOVERY)
  194. }
  195. start_swarm_agent() {
  196.     get_ip
  197.  
  198.     if [ -z "$DISCOVERY" ]; then
  199.         DISCOVERY="$DISCOVERY_BACKEND://discovery:$DISCOVERY_PORT"
  200.         EXTRA_RUN_OPTS="--link $PREFIX-discovery:discovery"
  201.     fi
  202.     ID=$(docker run \
  203.         -ti \
  204.         -d \
  205.         --restart=always \
  206.         --name $PREFIX-swarm-agent $EXTRA_RUN_OPTS \
  207.         swarm:latest \
  208.         j --addr $SHIPYARD_IP:$PROXY_PORT $DISCOVERY)
  209. }
  210. start_controller() {
  211.     #-v $CERT_PATH:/etc/docker:ro \
  212.     TLS_OPTS=""
  213.     if [ $ENABLE_TLS = 1 ]; then
  214.         TLS_OPTS="--tls-ca-cert $SSL_CA_CERT --tls-cert=$SSL_CERT --tls-key=$SSL_KEY --shipyard-tls-ca-cert=$SSL_CA_CERT --shipyard-tls-cert=$SSL_CERT --shipyard-tls-key=$SSL_KEY"
  215.     fi
  216.  
  217.     ID=$(docker run \
  218.         -ti \
  219.         -d \
  220.         --restart=always \
  221.         --name $PREFIX-controller \
  222.         --link $PREFIX-rethinkdb:rethinkdb \
  223.         --link $PREFIX-swarm-manager:swarm \
  224.         -p $SHIPYARD_PORT:$SHIPYARD_PORT \
  225.         --volumes-from=$PREFIX-certs \
  226.         $IMAGE \
  227.         --debug \
  228.         server \
  229.         --listen :$SHIPYARD_PORT \
  230.         -d tcp://swarm:$SWARM_PORT $TLS_OPTS $SHIPYARD_ARGS)
  231. }
  232. wait_for_available() {
  233.     set +e 
  234.     IP=$1
  235.     PORT=$2
  236.     echo Waiting for Shipyard on $IP:$PORT
  237.  
  238.     docker pull ehazlett/curl > /dev/null 2>>1
  239.  
  240.     TLS_OPTS=""
  241.     if [ $ENABLE_TLS = 1 ]; then
  242.         TLS_OPTS="-k"
  243.     fi
  244.  
  245.     until $(docker run --rm ehazlett/curl --output /dev/null --connect-timeout 1 --silent --head --fail $TLS_OPTS $SHIPYARD_PROTOCOL://$IP:$PORT/ > /dev/null 2>>1); do
  246.         printf '.'
  247.         sleep 1 
  248.     done
  249.     printf '\n'
  250. }
  251. read -p "Please input Y to continue" key
  252. if [ $key == 'Y' -o $key == 'y' ];then
  253.     echo "Do you want to install Docker accelerated by AliYun ?"
  254.     read -p "Please input Y to continue" key2
  255.     if [ $key2 == 'Y' -o $key2 == 'y' ];then
  256.     echo "Please Wait ..."
  257.         wget -O /etc/yum.repos.d/geekfan.repo http://mirrors.geekfan.top/YUM/centos7-source.repo
  258.     touch /etc/yum.repos.d/docker.repo
  259.          cat > /etc/yum.repos.d/docker.repo <<KOK
  260. [dockerrepo]
  261. name=Docker Repository
  262. baseurl=http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7/
  263. enabled=1
  264. gpgcheck=1
  265. gpgkey=http://mirrors.aliyun.com/docker-engine/yum/gpg
  266. KOK
  267.     yum clean all >> yum repolist
  268.     yum install -y docker-engine
  269.     systemctl enable docker
  270.     mkdir -p /etc/docker
  271.     read -p "More information: https://cr.console.aliyun.com/#/accelerator  Please input Your Url accelerated by AliYun: " url
  272.     touch /etc/docker/daemon.json
  273.     cat > /etc/docker/daemon.json <<EOF
  274. {
  275.       "registry-mirrors": ["$url"]
  276. }
  277. EOF
  278.     sudo systemctl daemon-reload
  279.     sudo systemctl restart docker
  280.     fi
  281.     setselinux
  282.     set -e
  283.     check_certs
  284.     get_ip 
  285.     echo "Deploying GeekCloud-Docker-Manager"
  286.     echo " -> Starting Database"
  287.     start_rethinkdb >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]" 
  288.     echo " -> Starting Discovery"
  289.     start_discovery >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  290.     echo " -> Starting Cert Volume"
  291.     start_certs >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  292.     echo " -> Starting Proxy"
  293.     start_proxy >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  294.     echo " -> Starting Swarm Manager"
  295.     start_swarm_manager >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  296.     echo " -> Starting Swarm Agent"
  297.     start_swarm_agent >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  298.     echo " -> Starting Controller"
  299.     start_controller >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  300.  
  301.     wait_for_available $SHIPYARD_IP $SHIPYARD_PORT
  302.     echo " -> Setting Chinese "
  303.     docker exec -it shipyard-controller  rm -rf static/app/*
  304.  
  305.     docker exec -it shipyard-controller  rm -f static/index.html
  306.     
  307.     git clone https://github.com/StarWars-Team/shipyard_zh.git
  308.     
  309.     docker cp  shipyard_zh/static/app  shipyard-controller:/static/
  310.  
  311.     docker cp  shipyard_zh/static/index.html  shipyard-controller:/static/
  312.      
  313.     rm -rf shipyard_zh/ >> echo  -e   "[${green}Success${nc}]" || echo -e "[${red}Failed${nc}]"
  314.     echo " -> Setting Firewalld "
  315.     firewall-cmd --permanent --add-port=8080/tcp
  316.     firewall-cmd --permanent --add-port=2375/tcp
  317.     firewall-cmd --permanent --add-service=http
  318.     firewall-cmd --reload
  319.     echo "GeekCloud-Docker-Manager available at $SHIPYARD_PROTOCOL://$SHIPYARD_IP:$SHIPYARD_PORT"
  320.     if [ $ENABLE_TLS = 1 ] >> [ ! -z "$CERT_FINGERPRINT" ]; then
  321.         echo "SSL SHA-256 Fingerprint: $CERT_FINGERPRINT"
  322.     fi
  323.     echo "Username: admin Password: shipyard"
  324. fi

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:Centos 7安装SHIPYARD中文版 | Bruce's Blog

发表评论

留言无头像?