在部署SecretFLow和SecretNote之前,分享一下docker和docker compose的安装部署方式。
系统要求:centos7
1.前置准备
1.1.安装docker
curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh usermod -aG docker $(whoami) exec $SHELL docker version //验证是否安装成功
1.2.将docker设置为开机自启
systemctl enable docker //设置docker服务开机自启 systemctl restart docker //重启docker服务
1.3.安装docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-#(uname -s)-#(uname -m)" -o /usr/local/bin/docker-compose //网络问题无法访问github可使用下面这行 curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose version //验证安装
1.4.安装conda
mkdir conda cd conda
#下载conda安装脚本
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
2.从源码编译安装SecretFlow
新建conda环境
隐语
conda create -n sf python=3.8 conda activate sf #克隆 git clone https://github.com/secretflow/secretflow.git cd secretflow python setup.py bdist_wheel
执行成功后如图
pip install dist/*.whl
耐心等待一段时间安装所需的依赖库,等所有依赖均安装成功后进行验证:
进入验证
3.安装SecretNote
新建一个文件夹并新建文件 docker-compose.yml
复制以下内容
services: alice: image: 'secretflow/secretnote:unstable-amd64' platform: linux/amd64 environment: - SELF_PARTY=alice - ALL_PARTIES=alice,bob ports: - 8090:8888 entrypoint: /root/scripts/start.sh volumes: - /root/scripts bob: image: 'secretflow/secretnote:unstable-amd64' platform: linux/amd64 environment: - SELF_PARTY=bob - ALL_PARTIES=alice,bob ports: - 8092:8888 entrypoint: /root/scripts/start.sh volumes: - /root/scripts
在命令行使用docker compose启动,启动成功后命令行显示如下:
在浏览器输入打开 http://localhost:8090
界面如下则部署成功可以开发了: