@saltyang
2019-01-17T09:44:03.000000Z
字数 2629
阅读 944
ems
docker
deploy
- Host VM : Centos 7.x
- Docker Engine Version: 1.12.6
- Docker Compose Version: 1.18.0
- Docker Redis Image Version: 4.0.2
- Docker Rabbitmq Image Version: 3.6.14
- Docker Mysql Image Version: 5.7
- Docker Centos Image Version: 6.7
Note:You can unzip ems_images.tar.gz and load these image:docker load -i ems_base.tar
#Install docker enginee
yum install docker-io
orcurl -fsSL https://get.docker.com/ | sh
#restart docker service
service docker start
#start docker deamon when machine power on
chkconfig docker on
Note: [Centos7装docker][1]
# Install docker-compose (Note : docker-compose version is 1.18.0)
curl -L https://get.daocloud.io/docker/compose/releases/download/1.18.0/\
(Note This is one command, not two commands)
docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
(Check the docker-compose version)
ems/conf
folder and Modify ems.conf
Note : The port of sshd is ems_server: 50001 . The address of mysql/redis/rabbitmq use service name in
docker-compose.yml
. For Example: mysql address should beems_mysql
which is mapping to a ip address via host file in container.Example:
"Recevier": {
"host": "192.168.1.153",
"port": 18443
},
"TargetHost": {
"host": "192.168.1.153"
}, # EMS Server & Portal deploy address
"FileServer": {
"host": "192.168.1.178"
}, # NFS Server address
mysql database address
"Database": {
"engine": "django.db.backends.mysql",
"host": "ems_mysql",
"password": "puyacn#1..",
"name": "ems",
"user": "root"
},
redis address
"Redis": {
"serverIP": "ems_redis",
"servicePort": "6379",
"password": "111111"
},
rabbitmq-server
"RabbitMQ": {
"serverIP": "ems_rabbitmq",
"sericePort": "5672",
"user": "ems",
"password": "emspwd",
"vhost": "vhost_ems",
"smsQueue": "smsqueue",
"emailQueue": "emailqueue"
},
# Prepare:
Deploy machine need install python 2.7.x and install fabric
# Build rpm package
cd ~/project/ems/deploy
./build.sh ems all
# deploy
fab -f deploy.py prepare
fab -f deploy.py launch_ems
fab -f deploy.py install_se_rpm
fab -f deploy.py init_service
# Build rpm package
cd ~/project/ems/deploy
./build.sh recevier
# deploy
fab -f deploy.py prepare
fab -f deploy.py launch_ems (if ems_server has lauched all images, this step need skip)
fab -f deploy.py install_re_rpm
fab -f deploy.py init_re_service
Note:
Volume写入不了,需要disabel Selinux:
- check Selinux的状态:/usr/sbin/sestatus -v
- disable Selinux :
vi /etc/selinux/config
将SELINUX=enforcing
改成SELINUX=disabled
- temporarily fix :
su -c "setenforce 0"
- set selinux rule to fix this:
chcon -Rt svirt_sandbox_file_t /path/to/volume
Iptables 重启后,docker的规则被清除掉:
iptables -t nat --list
查看iptables中转换规则- 修改iptables 配置文件:
vim /etc/sysconfig/iptables-config
将no
改为yes
copy文件到container中:
- 在container中安装scp:
yum install openssh-clients
- Exapmle:
scp -P 50001 -r storageManager.py hosted.py root@192.168.1.142:/opt/ems/