Skip to content

Commit

Permalink
Modify the default deployment user of docker-compose to support non r…
Browse files Browse the repository at this point in the history
…oot users.

Signed-off-by: ChenLong Ma <owlet42@126.com>
  • Loading branch information
owlet42 committed May 27, 2020
1 parent a020e82 commit d23a42f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
25 changes: 24 additions & 1 deletion docker-deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,40 @@ Before deploying the FATE system, multiple parties should be defined in the conf
In the following sample of `docker-deploy/parties.conf` , two parities are specified by id as `10000` and `9999`. Their cluster are going to be deployed on hosts with IP addresses of *192.168.7.1* and *192.168.7.2*

```bash
user=root
user=fate
dir=/data/projects/fate
partylist=(10000 9999)
partyiplist=(192.168.7.1 192.168.7.2)
servingiplist=(192.168.7.1 192.168.7.2)
exchangeip=
```

On the host running FATE, the user is non root and needs`/data/projects/fate` folder permission and docker permission. No other action is required if the user is root.

```bash
# Create a fate user whose group is docker
[user@localhost]$ sudo useradd -s /bin/bash -g docker -d /home/fate fate
# Set user password
[user@localhost]$ sudo passwd fate
# Create docker-compose deployment directory
[user@localhost]$ sudo mkdir -p /data/projects/fate
# Modify the corresponding users and groups of docker-compose deployment directory
[user@localhost]$ sudo chown -R fate:docker /data/projects/fate
# Select users
[user@localhost]$ sudo su fate
# Check whether you have docker permission
[fate@localhost]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# View docker-compose deployment directory
[fate@localhost]$ ls -l /data/projects/
total 0
drwxr-xr-x. 2 fate docker 6 May 27 00:51 fate
```

By default, the exchange node won't be deployed. The exchange service runs on port 9371. If a exchange (co-locates on the host of party or standalone) node is needed, update the value of `exchangeip` to the IP address of the desired host.

After completing the above configuration file, use the following commands to generate configuration of target hosts.

```bash
$ cd docker-deploy
$ bash generate_config.sh
Expand Down
24 changes: 23 additions & 1 deletion docker-deploy/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ RegistryURI=192.168.10.1/federatedai
下面是修改好的文件,`party 10000`的集群将部署在*192.168.7.1*上,而`party 9999`的集群将部署在*192.168.7.2*上。

```
user=root # 运行FATE容器的用户
user=fate # 运行FATE容器的用户
dir=/data/projects/fate # docker-compose部署目录
partylist=(10000 9999) # 组织id
partyiplist=(192.168.7.1 192.168.7.2) # id对应训练集群ip
Expand All @@ -104,6 +104,28 @@ exchangeip= # 通信组件标识

在运行部署脚本之前,需要确保部署机器可以ssh免密登录到两个运行节点主机上。user代表免密的用户。

在运行FATE的主机上,user是非root用户的,需要有`/data/projects/fate`文件夹权限和docker权限。如果是root用户则不需要任何其他操作。

```bash
# 创建一个组为docker的fate用户
[user@localhost]$ sudo useradd -s /bin/bash -g docker -d /home/fate fate
# 设置用户密码
[user@localhost]$ sudo passwd fate
# 创建docker-compose部署目录
[user@localhost]$ sudo mkdir -p /data/projects/fate
# 修改docker-compose部署目录对应用户和组
[user@localhost]$ sudo chown -R fate:docker /data/projects/fate
# 选择用户
[user@localhost]$ sudo su fate
# 查看是否拥有docker权限
[fate@localhost]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# 查看docker-compose部署目录
[fate@localhost]$ ls -l /data/projects/
total 0
drwxr-xr-x. 2 fate docker 6 May 27 00:51 fate
```

#### 执行部署脚本
以下修改可在任意机器执行。

Expand Down
2 changes: 1 addition & 1 deletion docker-deploy/parties.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

user=root
user=fate
dir=/data/projects/fate
partylist=(10000 9999)
partyiplist=(192.168.1.1 192.168.1.2)
Expand Down

0 comments on commit d23a42f

Please sign in to comment.