Merge branch 'master' of https://github.com/unias/docklet into network
This commit is contained in:
commit
46141091fb
26
prepare.sh
26
prepare.sh
|
@ -12,6 +12,17 @@ if [[ "`whoami`" != "root" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# install packages that docklet needs (in ubuntu)
|
||||
# some packages' name maybe different in debian
|
||||
apt-get install -y cgmanager lxc lxcfs lxc-templates lvm2 bridge-utils curl exim4 openssh-server openvswitch-switch
|
||||
apt-get install -y python3 python3-netifaces python3-flask python3-flask-sqlalchemy python3-pampy python3-httplib2
|
||||
apt-get install -y python3-psutil
|
||||
apt-get install -y python3-lxc
|
||||
apt-get install -y python3-requests python3-suds
|
||||
apt-get install -y nodejs nodejs-legacy npm
|
||||
apt-get install -y etcd
|
||||
apt-get install -y glusterfs-client
|
||||
|
||||
# check cgroup control
|
||||
which cgm &> /dev/null || { echo "FAILED : cgmanager is required, please install cgmanager" && exit 1; }
|
||||
cpucontrol=$(cgm listkeys cpu)
|
||||
|
@ -25,15 +36,6 @@ if [[ -z $(echo $memcontrol | grep limit_in_bytes) ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# install packages that docklet needs (in ubuntu)
|
||||
# some packages' name maybe different in debian
|
||||
apt-get install -y cgmanager lxc lxcfs lxc-templates lvm2 bridge-utils curl exim4 openssh-server openvswitch-switch
|
||||
apt-get install -y python3 python3-netifaces python3-flask python3-flask-sqlalchemy python3-pampy python3-httplib2
|
||||
apt-get install -y python3-psutil
|
||||
apt-get install -y python3-lxc
|
||||
apt-get install -y python3-requests python3-suds
|
||||
apt-get install -y nodejs nodejs-legacy npm
|
||||
apt-get install -y etcd
|
||||
|
||||
# check and install configurable-http-proxy
|
||||
which configurable-http-proxy &>/dev/null || npm install -g configurable-http-proxy
|
||||
|
@ -43,6 +45,10 @@ echo ""
|
|||
[[ -f conf/docklet.conf ]] || { echo "Generating docklet.conf from template" && cp conf/docklet.conf.template conf/docklet.conf; }
|
||||
[[ -f web/templates/home.html ]] || { echo "Generating HomePage from home.template" && cp web/templates/home.template web/templates/home.html; }
|
||||
|
||||
mkdir -p /opt/docklet/global
|
||||
mkdir -p /opt/docklet/local
|
||||
echo "directory /opt/docklet have been created"
|
||||
|
||||
echo ""
|
||||
echo "All preparation installations are done."
|
||||
echo "****************************************"
|
||||
|
@ -54,7 +60,7 @@ echo "Before staring : you need a basefs image. "
|
|||
echo "basefs images are provided at: "
|
||||
echo " http://docklet.unias.org/download"
|
||||
echo "please download it to FS_PREFIX/local and then extract it. (defalut FS_PRERIX is /opt/docklet)"
|
||||
echo "you will get a dicectory structure like"
|
||||
echo "you will get a directory structure like"
|
||||
echo " /opt/docklet/local/basefs/etc "
|
||||
echo " /opt/docklet/local/basefs/bin "
|
||||
echo " /opt/docklet/local/basefs/..."
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
if [ $# -lt 1 ]; then
|
||||
echo "please input master ip";
|
||||
exit 1;
|
||||
fi
|
||||
MASTER_IP=$1
|
||||
|
||||
#配置apt源
|
||||
#echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
|
||||
#deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
|
||||
#deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
|
||||
#deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
|
||||
#deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" > /etc/apt/sources.list
|
||||
|
||||
#更新apt
|
||||
apt-get update
|
||||
|
||||
#更新hosts
|
||||
echo "$MASTER_IP docklet-master" >> /etc/hosts
|
||||
|
||||
#下载git包
|
||||
apt-get install git
|
||||
|
||||
#下载docklet源码
|
||||
git clone http://github.com/unias/docklet.git /home/docklet
|
||||
|
||||
#运行prepare.sh
|
||||
/home/docklet/prepare.sh
|
||||
|
||||
#挂载global目录,通过gluster方式
|
||||
mount -t glusterfs docklet-master:/docklet /opt/docklet/global
|
||||
|
||||
#下载base镜像
|
||||
wget http://docklet.unias.org/images/basefs-0.11.tar.bz2 -P /opt/local/temp
|
||||
|
||||
#解压镜像
|
||||
tar -zxvf /opt/local/temp/basefs-0.11.tar.bz2 -C /opt/local/
|
||||
|
||||
#获得docklet.conf
|
||||
cp /home/docklet/conf/docklet.conf.template /home/docklet/conf/docklet.conf
|
||||
|
||||
#获得网卡名称
|
||||
NETWORK_DEVICE=`route | grep default | awk {'print $8'};`
|
||||
|
||||
#更改配置文件
|
||||
echo "DISKPOOL_SIZE=100000
|
||||
ETCD=$MASTER_IP:2379
|
||||
NETWORK_DEVICE=$NETWORK_DEVICE
|
||||
PORTAL_URL=http://iwork.pku.edu.cn
|
||||
PROXY_PORT=80" >> /home/docklet/conf/docklet.conf
|
||||
|
||||
#启动worker
|
||||
/home/docklet/bin/docklet-worker start
|
||||
exit 0
|
Loading…
Reference in New Issue