阿里云部署脚本
2020-08-22 约 1138 字
预计阅读 3 分钟
次阅读
1. 拷贝程序和配置文件
janus_cloud
supervisor配置文件
ngnix配置文件
sql建表语句
2. 安装刷脸服务缺少的库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 1.查看运行脚本
cat run_janus_facealg_orbbec_server.sh
# 2.导出依赖
export LD_LIBRARY_PATH = ./libs:./libs/thirdparty/lib:./libs/thirdparty/amd64-opencv400-world/lib:./libs/thirdparty/syslib
# 3. 查看程序依赖库
ldd janus_facealg_orbbec_server
# 3.1 或者通过日志查看缺失的库
tail -fn100 /home/janus/janus_cloud/janus_api/janus_facealg_orbbec_server_v031.log
# 方式一:sudo apt-get install 安装
sudo apt-get install libpython2.7-dev liborc-dev libgtk2.0-dev libunwind-dev libjasper-dev libraw1394-dev libwebp-dev libwavpack-dev libtheora-dev libvorbis-dev libspeex-dev libgtk2.0-0:i386 libraw1394-dev libjasper-dev libwebp-dev libwavpack-dev liborc-dev libunwind-dev libpython2.7-dev libopus-dev libvorbis-dev libspeex-dev
# 方式二:安装不了的库可以从已有环境拷贝
3. 软件安装配置
3.1 Docker 安装&配置
1
2
3
4
5
6
7
8
9
10
11
12
13
# 1.脚本安装docker
curl -sSL https://get.daocloud.io/docker | sh
# 2.配置阿里云镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://r4jvqmjn.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
3.2 supervisor 安装&配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 1.安装supervisor
sudo apt-get install supervisor
# 2.创建supervisor日志文件
mkdir -p logs/supervisor
# 3.替换文件夹下所有包含local的文件为系统的实际用户名
sudo sed -i "s/local/tester/g" ` find . -type f| xargs grep -rl "local" `
# 常用命令
# 更新 supervisorctl配置
sudo supervisorctl update
# 查看 supervisorctl 子进程状态
sudo supervisorctl status
3.3 minio 安装&配置
1
2
3
4
5
6
7
8
9
10
11
# 1.提前创建好挂载出来的目录
mkdir -p /home/janus/minio/data
mkedi -p /home/janus/minio/config
# 2.拉取镜像&配置和启动容器
sudo docker run -p 19001:9000 --name minio --restart= always -e "MINIO_ACCESS_KEY" = minio -e "MINIO_SECRET_KEY" = dean_minio_2019 -v /home/janus/minio/data:/data -v /home/janus/minio/config:/root/.minio -d minio/minio server /data
# 3.登录web管理界面
# 4.创建bucket 并授予写权限
3.4 consul 安装&配置
1
2
3
# 1.拉取镜像&配置和启动容器
docker run --name consul -d -p 8500:8500 consul
3.5 mysql 安装&配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 程序连接信息
# user:123456@tcp(127.0.0.1:3306)/operate?charset=utf8&loc=Local
# 1.拉取镜像&配置和启动容器
sudo docker run -p 3306:3306 --name mysql --restart= always -e MYSQL_ROOT_PASSWORD = orbbec2020 -d mysql:5.7
# 2.进入MySQL容器
docker exec -it mysql /bin/bash
# 3.创建用户名、密码、授权、刷新权限
CREATE USER 'user' @'%' IDENTIFIED BY '123456' ;
grant all privileges on *.* to user@'%' identified by "123456" ;
flush privileges;
3.6 redis 安装&配置
1
2
3
# 设置redis密码
docker run --name redis -p 6379:6379 -d --restart= always redis:latest redis-server --appendonly yes --requirepass "Orbbec20171109"
3.7 emqx 安装&配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
sudo docker run -d --restart= always --name emqx -p 1883:1883 -p 8084:8083 -p 8883:8883 -p 8085:8084 -p 18083:18083 emqx/emqx:v4.0.0
sudo docker run --name emqx -p 1883:1883 -p 8084:8083 -p 8883:8883 -p 8085:8084 -p 18083:18083 --restart= always -d emqx/emqx:v4.0.0
# 进入容器 编辑基础连接信息
docker exec -it emqx /bin/sh
# 1.生产环境禁用匿名认证 EMQ X 默认配置中启用了匿名认证,任何客户端都能接入 EMQ X
# etc/emqx.conf
## Value: true | false
allow_anonymous = false
# 2.配置MySQL认证信息
# etc/plugins/emqx_auth_mysql.conf
## 服务器地址,注意 此处应为MySQL的连接用户名和密码,而非mqtt_user表中的用户和密码
auth.mysql.server = 127.0.0.1:3306
auth.mysql.pool = 8
auth.mysql.username = emqx
auth.mysql.password = public
auth.mysql.database = mqtt
auth.mysql.query_timeout = 5s
# ACL 规则配置
# 允许 所有地址 订阅 主题
{ allow, all, subscribe, [ " $SYS /#" , { eq, "#" }]} .
3.8 nginx 安装&配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 拷贝 已经配好的服务器上 /etc/nginx/conf.d下面的3个配置文件
sudo apt-get install nginx
# nginx 配置 https/ ssl 证书
# http 80 端口转发
server {
listen 80;
server_name janus.orbbec.me;
rewrite ^( .*) $ https://${ server_name } $1 permanent;
}
server {
listen 443 ssl;
server_name janus.orbbec.me;
....
# SSL 证书配置
ssl_certificate /etc/nginx/cert/4388408_janus.orbbec.me.pem;
ssl_certificate_key /etc/nginx/cert/4388408_janus.orbbec.me.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
.....
}
# 配置完成后重启
nginx -s reload
4. 阿里云端口开放
1
2
3
4
mysql 3306
minio 19001
emqx 18083