提交 c6254ca9 编写于 作者: weixin_46662084's avatar weixin_46662084

Merge branch 'master' into develop

# Conflicts:
#	.github/workflows/main.yml
#	BUILD.bazel
#	config/node0.yaml
#	config/node1.yaml
#	config/node2.yaml
#	python/primihub/executor.py
#	src/primihub/algorithm/logistic.cc
#	src/primihub/operator/aby3_operator.cc
#	src/primihub/operator/aby3_operator.h
#	src/primihub/service/dataset/service.cc
#	src/primihub/task/semantic/parser.cc
PRIMIHUB_FUSION=primihub/primihub-fusion:latest
PRIMIHUB_PLATFORM=primihub/primihub-platform:latest
PRIMIHUB_WEB_MANAGE=primihub/primihub-web:latest
PRIMIHUB_NODE=primihub/primihub-node:latest
\ No newline at end of file
# README
### docker-compose部署
#### 部署要求
* 机器配置最低4核8G,磁盘40G
* 系统支持`CentOS 7``Ubuntu 18.04+` (推荐使用`Ubuntu`)
#### 执行deploy.sh脚本,完成部署
```bash
bash deploy.sh
```
#### 查看部署结果
```
# docker-compose ps -a
NAME COMMAND SERVICE STATUS PORTS
application1 "/bin/sh -c 'java -j…" application1 running
application2 "/bin/sh -c 'java -j…" application2 running
application3 "/bin/sh -c 'java -j…" application3 running
bootstrap-node "/app/simple-bootstr…" simple-bootstrap-node running 4001/tcp
fusion "/bin/sh -c 'java -j…" fusion running
gateway1 "/bin/sh -c 'java -j…" gateway1 running
gateway2 "/bin/sh -c 'java -j…" gateway2 running
gateway3 "/bin/sh -c 'java -j…" gateway3 running
mysql "docker-entrypoint.s…" mysql running 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp
nacos-server "bin/docker-startup.…" nacos running 0.0.0.0:8848->8848/tcp, 0.0.0.0:9555->9555/tcp, 0.0.0.0:9848->9848/tcp, :::8848->8848/tcp, :::9555->9555/tcp, :::9848->9848/tcp
primihub-node0 "/bin/bash -c './pri…" node0 running 50050/tcp
primihub-node1 "/bin/bash -c './pri…" node1 running 50050/tcp
primihub-node2 "/bin/bash -c './pri…" node2 running 50050/tcp
primihub-web1 "/docker-entrypoint.…" nginx1 running 0.0.0.0:30811->80/tcp, :::30811->80/tcp
primihub-web2 "/docker-entrypoint.…" nginx2 running 0.0.0.0:30812->80/tcp, :::30812->80/tcp
primihub-web3 "/docker-entrypoint.…" nginx3 running 0.0.0.0:30813->80/tcp, :::30813->80/tcp
rabbitmq1 "docker-entrypoint.s…" rabbitmq1 running 25672/tcp
rabbitmq2 "docker-entrypoint.s…" rabbitmq2 running 25672/tcp
rabbitmq3 "docker-entrypoint.s…" rabbitmq3 running 25672/tcp
redis "docker-entrypoint.s…" redis running 6379/tcp
```
#### 说明
docker-compose.yaml 文件中的nginx1、nginx2、nginx3 模拟 3 个机构的管理后台,启动完成后在浏览器分别访问
http://机器IP:30811
http://机器IP:30812
http://机器IP:30813
默认用户密码都是 admin / 123456
具体的联邦建模、隐私求交、匿踪查询等功能的操作步骤请参考 [快速试用管理平台](https://docs.primihub.com/docs/quick-start-platform)
\ No newline at end of file
server {
listen 80;
server_name localhost;
location / {
root /usr/local/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~ /prod-api/ {
proxy_pass http://gateway1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /fileimages {
root /data;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name localhost;
location / {
root /usr/local/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~ /prod-api/ {
proxy_pass http://gateway2:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /fileimages {
root /data;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name localhost;
location / {
root /usr/local/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~ /prod-api/ {
proxy_pass http://gateway3:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /fileimages {
root /data;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
daemonize no
pidfile /data/redis.pid
port 6379
bind 0.0.0.0
requirepass primihub
rdbcompression yes
dbfilename dump.rdb
dir /data
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=nacos_config
MYSQL_USER=primihub
MYSQL_PASSWORD=primihub@123
\ No newline at end of file
PREFER_HOST_MODE=hostname
MODE=standalone
SPRING_DATASOURCE_PLATFORM=mysql
MYSQL_SERVICE_HOST=mysql
MYSQL_SERVICE_DB_NAME=nacos_config
MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=primihub
MYSQL_SERVICE_PASSWORD=primihub@123
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=10000&socketTimeout=30000&autoReconnect=true&useSSL=false
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
#!/bin/bash
# primihub deploy script
# First, install docker and docker-compose
centos(){
iptables -F
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config
docker version
if [ $? -eq 0 ];
then
echo "docker installed"
else
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce device-mapper-persistent-data lvm2
systemctl daemon-reload
systemctl start docker && systemctl enable docker
echo "docker install succeed !"
fi
}
ubuntu(){
docker version
if [ $? -eq 0 ];
then
echo "docker installed"
else
apt-get update
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
apt-get -y update
apt-get -y install docker-ce
echo "docker install succeed !"
fi
}
if [ $(uname -s) == "Linux" ];
then
grep "Ubuntu" /etc/issue >> /dev/null
if [ $? -eq 0 ];
then
ubuntu
else
centos
fi
elif [ $(uname -s) == "Darwin" ]; then
which docker-compose > /dev/null
if [ $? != 0 ];
then
echo "Cannot find docker compose, please install it first."
echo "Read the official document from https://docs.docker.com/compose/install/"
exit 1
fi
else
echo "not support yet"
exit 1
fi
docker-compose version
if [ $? -eq 0 ];
then
echo "docker-compose installed"
else
curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
if [ $? -eq 0 ];
then
chmod +x /usr/bin/docker-compose
echo "docker-compose install succeed !"
else
echo "Download docker-compose failed!"
exit
fi
fi
# Pull all the necessary images to avoid pulling multiple times
for i in `cat .env | cut -d '=' -f 2`
do
docker pull $i
done
# Finally, start the application
docker-compose up -d
version: '3'
services:
mysql:
image: nacos/nacos-mysql:5.7
container_name: mysql
restart: always
env_file:
- ./data/env/mysql.env
volumes:
- ./data/mysql:/var/lib/mysql
- ./data/initsql/:/docker-entrypoint-initdb.d/
ports:
- "3306:3306"
networks:
primihub_net:
ipv4_address: 172.28.1.14
redis:
image: redis:5
container_name: redis
restart: always
volumes:
- "./data:/data"
- "./config/redis.conf:/usr/local/etc/redis/redis.conf"
command:
"redis-server /usr/local/etc/redis/redis.conf"
depends_on:
- nacos
networks:
primihub_net:
ipv4_address: 172.28.1.15
rabbitmq1:
image: rabbitmq:3.6.15-management
container_name: rabbitmq1
restart: always
depends_on:
- redis
networks:
primihub_net:
ipv4_address: 172.28.1.16
rabbitmq2:
image: rabbitmq:3.6.15-management
container_name: rabbitmq2
restart: always
depends_on:
- redis
networks:
primihub_net:
ipv4_address: 172.28.1.17
rabbitmq3:
image: rabbitmq:3.6.15-management
container_name: rabbitmq3
restart: always
depends_on:
- redis
networks:
primihub_net:
ipv4_address: 172.28.1.18
nacos:
image: nacos/nacos-server:v2.0.4
container_name: nacos-server
restart: always
env_file:
- ./data/env/nacos-mysql.env
volumes:
- ./data/log/:/home/nacos/logs
#- ./nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
- "9848:9848"
- "9555:9555"
depends_on:
- node0
networks:
primihub_net:
ipv4_address: 172.28.1.19
fusion:
image: $PRIMIHUB_FUSION
container_name: fusion
restart: always
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/fusion.jar --spring.profiles.active=dc --server.port=8080"
# ports:
# - "8080:8080"
depends_on:
- gateway1
networks:
primihub_net:
ipv4_address: 172.28.1.20
application1:
image: $PRIMIHUB_PLATFORM
container_name: application1
restart: always
volumes:
- "./data:/data"
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/application.jar --spring.profiles.active=dc1"
depends_on:
- rabbitmq1
networks:
primihub_net:
ipv4_address: 172.28.1.21
application2:
image: $PRIMIHUB_PLATFORM
container_name: application2
restart: always
volumes:
- "./data:/data"
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/application.jar --spring.profiles.active=dc2"
depends_on:
- rabbitmq2
networks:
primihub_net:
ipv4_address: 172.28.1.22
application3:
image: $PRIMIHUB_PLATFORM
container_name: application3
restart: always
volumes:
- "./data:/data"
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/application.jar --spring.profiles.active=dc3"
depends_on:
- rabbitmq3
networks:
primihub_net:
ipv4_address: 172.28.1.23
gateway1:
image: $PRIMIHUB_PLATFORM
container_name: gateway1
restart: always
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/gateway.jar --spring.profiles.active=dc1 --server.port=8080"
depends_on:
- application1
networks:
primihub_net:
ipv4_address: 172.28.1.24
gateway2:
image: $PRIMIHUB_PLATFORM
container_name: gateway2
restart: always
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/gateway.jar --spring.profiles.active=dc2 --server.port=8080"
depends_on:
- application2
networks:
primihub_net:
ipv4_address: 172.28.1.25
gateway3:
image: $PRIMIHUB_PLATFORM
container_name: gateway3
restart: always
entrypoint:
- "/bin/sh"
- "-c"
- "java -jar -Dfile.encoding=UTF-8 /applications/gateway.jar --spring.profiles.active=dc3 --server.port=8080"
depends_on:
- application3
networks:
primihub_net:
ipv4_address: 172.28.1.26
nginx1:
image: $PRIMIHUB_WEB_MANAGE
container_name: primihub-web1
restart: always
volumes:
- "./config/default1.conf:/etc/nginx/conf.d/default.conf"
- "./data:/data"
ports:
- "30811:80"
depends_on:
- gateway1
networks:
primihub_net:
ipv4_address: 172.28.1.27
nginx2:
image: $PRIMIHUB_WEB_MANAGE
container_name: primihub-web2
restart: always
volumes:
- "./config/default2.conf:/etc/nginx/conf.d/default.conf"
- "./data:/data"
ports:
- "30812:80"
depends_on:
- gateway2
networks:
primihub_net:
ipv4_address: 172.28.1.28
nginx3:
image: $PRIMIHUB_WEB_MANAGE
container_name: primihub-web3
restart: always
volumes:
- "./config/default3.conf:/etc/nginx/conf.d/default.conf"
- "./data:/data"
ports:
- "30813:80"
depends_on:
- gateway3
networks:
primihub_net:
ipv4_address: 172.28.1.29
node0:
image: $PRIMIHUB_NODE
container_name: primihub-node0
restart: "always"
ports:
- "50050:50050"
- "6666:6666"
# - "10120:12120"
# - "10121:12121"
volumes:
- ../../config:/app/config
- ./data:/data
entrypoint:
- "/bin/bash"
- "-c"
- "./primihub-node --service_port=50050 --node_id=node0 --config=/app/config/primihub_node0.yaml"
depends_on:
- simple-bootstrap-node
networks:
primihub_net:
ipv4_address: 172.28.1.10
node1:
image: $PRIMIHUB_NODE
container_name: primihub-node1
restart: "always"
ports:
- "50051:50051"
- "6667:6667"
# - "11120:12120"
# - "11121:12121"
volumes:
- ../../config:/app/config
- ./data:/data
entrypoint:
- "/bin/bash"
- "-c"
- "./primihub-node --service_port=50051 --node_id=node1 --config=/app/config/primihub_node1.yaml"
depends_on:
- simple-bootstrap-node
networks:
primihub_net:
ipv4_address: 172.28.1.11
node2:
image: $PRIMIHUB_NODE
container_name: primihub-node2
restart: "always"
ports:
- "50052:50052"
- "6668:6668"
# - "12120:12120"
# - "12121:12121"
volumes:
- ../../config:/app/config
- ./data:/data
entrypoint:
- "/bin/bash"
- "-c"
- "./primihub-node --service_port=50052 --node_id=node2 --config=/app/config/primihub_node2.yaml"
depends_on:
- simple-bootstrap-node
networks:
primihub_net:
ipv4_address: 172.28.1.12
simple-bootstrap-node:
image: primihub/simple-bootstrap-node:1.0
container_name: bootstrap-node
restart: "always"
# ports:
# - "4001:4001"
entrypoint:
- "/app/simple-bootstrap-node"
depends_on:
- mysql
networks:
primihub_net:
ipv4_address: 172.28.1.13
networks:
primihub_net:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册