RPA 服务端迁移 (从k8s到docker)
本文来自于【阿里云官方镜像站:https://developer.aliyun.com/mirror/?utm_content=g_1000307095 】
原文链接:https://developer.aliyun.com/article/748927?spm=a2c6h.12873581.0.0.54c47e46mLfYep
镜像下载、域名解析、时间同步请点击 阿里巴巴开源镜像站
一、以docker方式部署RPA服务端
1. 拷贝资源文件
通过scp 或者其他方式把docker 目录和server 目录传输到部署服务器上的/root根目录下。
(docker和server目录,请联系阿里云RPA同学获取)
scp -r docker root@server_ip:/root
scp -r server root@server_ip:/root
docker资源文件:
├── docker│ ├── docker-ce # docker离线安装包及其依赖
│ │ ├── audit-2.8.4-4.el7.x86_64.rpm│ │ ├── audit-libs-2.8.4-4.el7.x86_64.rpm│ │ ├── audit-libs-python-2.8.4-4.el7.x86_64.rpm│ │ ├── checkpolicy-2.5-8.el7.x86_64.rpm│ │ ├── container-selinux-2.74-1.el7.noarch.rpm│ │ ├── docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm│ │ ├── libcgroup-0.41-20.el7.x86_64.rpm│ │ ├── libselinux-2.5-14.1.el7.x86_64.rpm│ │ ├── libselinux-python-2.5-14.1.el7.x86_64.rpm│ │ ├── libselinux-utils-2.5-14.1.el7.x86_64.rpm│ │ ├── libsemanage-2.5-14.el7.x86_64.rpm│ │ ├── libsemanage-python-2.5-14.el7.x86_64.rpm│ │ ├── libsepol-2.5-10.el7.x86_64.rpm│ │ ├── libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm│ │ ├── pigz-2.3.4-1.el7.x86_64.rpm│ │ ├── policycoreutils-2.5-29.el7.x86_64.rpm│ │ ├── policycoreutils-python-2.5-29.el7.x86_64.rpm│ │ ├── python-IPy-0.75-6.el7.noarch.rpm│ │ ├── selinux-policy-3.13.1-229.el7_6.6.noarch.rpm│ │ ├── selinux-policy-targeted-3.13.1-229.el7_6.6.noarch.rpm│ │ └── setools-libs-3.3.8-4.el7.x86_64.rpm│ └── docker-compose└── server
├── cs-docker.tar # RPA服务端镜像文件
└── docker-compose.yml # docker启动脚本
默认docker是针对centos 7.4版本,如果安装的centos 是其他版本如7.3,在安装过程中缺少相应的依赖包,需要联网下载对应版本的docker-ce里面的离线安装包。
2. 安装和启动docker
进入docker-ce目录,执行
yum localinstall *.rpm # 如果提示选择选Y
安装完成后执行
systemctl start docker
3. 部署阿里云RPA
(1)将编排文件docker-compose拷贝到用户bin目录,并提权
sudo cp -f ~/docker/docker-compose /usr/bin/
sudo chmod +x /usr/bin/docker-compose
(2) 进入到server目录 执行
cd ~/serversudo docker load -i cs-docker.tar
(3) 查看导入的docker镜像
[root@rpa ~]# docker images
REPOSITORY **TAG** **IMAGE** ID CREATED SIZE`
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-mysql V3.3.11 b3cd3de42e96 2 weeks ago 372MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-assets V3.3.11 34fae7fe864b 2 weeks ago 113MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-robot V3.3.11 5b3d3e4faac2 2 weeks ago 667MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-web V3.3.11 07176746202e 2 weeks ago 672MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-file V3.3.11 45d5e6cf95b0 2 weeks ago 664MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-entry-nginx V3.3.11 ac52a2af52f1 3 weeks ago 157MB
registry.cn-hangzhou.aliyuncs.com/codestore/rpa-redis V3.3.11 3ecb7a463946 3 weeks ago 107MB
(4)修改docker-compose.yml文件。
先登陆登陆k8s的 master 节点,查看 mysql 和 redis 配置文件 values.yaml ,找到数据库的密码, 然后将写到 docker-compose.yml 文件的对应位置
# Default values for rpa-mysql.# This is a YAML-formatted file.# Declare variables to be passed into your templates.replicaCount: 1image: repository: work_ip:3443/library/rpa-mysql tag: V3.3.8 pullPolicy: IfNotPresentservice: name: rpa-mysql type: NodePort externalPort: 3306 internalPort: 3306env: TZ: "Asia/Shanghai" MYSQL_ROOT_PASSWORD: "密码" MYSQL_PASSWORD: "密码"persistence: enabled: enable nfsServer: work_ip nfsPath: "/rpadata/data/mysql" accessMode: ReadWriteOnce size: 8Gi
# Default values for rpa-redis.# This is a YAML-formatted file.# Declare variables to be passed into your templates.replicaCount: 1image:
repository: work_ip:3443/library/rpa-redis
tag: V3.3.8
pullPolicy: IfNotPresentservice:
name: rpa-redis
type: ClusterIP
externalPort: 6379
internalPort: 6379env:
TZ: "Asia/Shanghai"
REDIS_PASSWORD: "密码"persistence:
enabled: enable
pv:
- name: redis
nfsServer: work_ip
nfsPath: "/rpadata/data/redis"
accessMode: ReadWriteMany
size: 10Gi
- name: redis-log
nfsServer: work_ip
nfsPath: "/rpadata/log/redis"
accessMode: ReadWriteMany
size: 10Gi
version: '3.2'services:
# rpa-mysql
rpa-mysql:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-mysql:Vx.x.x"
volumes:
- "/rpadata/data/mysql:/var/lib/mysql"
ports:
- "3306:3306"
environment:
- TZ=Asia/Shanghai
- MYSQL_PASSWORD=密码
- MYSQL_ROOT_PASSWORD=密码
# rpa-redis
rpa-redis:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-redis:Vx.x.x"
volumes:
- "/rpadata/data/redis:/data"
- "/rpadata/log/redis:/var/log/redis"
environment:
- TZ=Asia/Shanghai
- REDIS_PASSWORD=密码
# rpa-assets
rpa-assets:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-assets:Vx.x.x"
ports:
- "7000:7000"
environment:
- TZ=Asia/Shanghai
# rpa-file
rpa-file:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-file:Vx.x.x"
volumes:
- "/rpadata/file/file:/data/file"
environment:
- TZ=Asia/Shanghai
- MYSQL_PASSWORD=密码
- REDIS_PASSWORD=密码
depends_on:
- rpa-mysql
- rpa-redis
# rpa-web
rpa-web:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-web:Vx.x.x"
ports:
- "7001:7001"
volumes:
- "/rpadata/web/file:/data/file"
environment:
- TZ=Asia/Shanghai
- MYSQL_PASSWORD=密码
- REDIS_PASSWORD=密码
depends_on:
- rpa-file
# rpa-robot
rpa-robot:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-robot:Vx.x.x"
ports:
- "7002:7002"
volumes:
- "/rpadata/robot/file:/data/file"
environment:
- TZ=Asia/Shanghai
- MYSQL_PASSWORD=密码
- REDIS_PASSWORD=密码
depends_on:
- rpa-web
# rpa-entry-nginx
rpa-entry-nginx:
image: "xxxx.xxxx.aliyuncs.com/xxxx/xxx-nginx:Vx.x.x"
ports:
- "80:80"
- "443:443"
environment:
- SERVER_RESOLVER_IP=127.0.0.11
- SERVER_HOST=rpa.aliyun.net
- CLUSTER_HOST=
depends_on:
- rpa-file
(5)启动docker镜像
sudo docker-compose -f docker-compose.yml up -d
二.拷贝k8s方式部署的RPA服务端数据
1、打包RPA服务端的所有数据
RPA服务端的所有数据都保存在 work 节点的 /rpadata/ 目录下,备份整个/rpadata/目录即可。
[root@linux ~]# tar -czvf ~/rpadata.tar.gz /rpadata/ # 备份数据到home目录下
2、将打包好的RPA服务端数据拷贝到新的服务器上
scp ~/rpadata.tar.gz root@server_ip:/root # 将数据拷贝到新的服务器root目录下
3、将备份的文件解压到/rpadata/目录下
[root@linux ~]# cd /[root@linux ~]# tar -xzvf ~/rpadata.tar.gz
三、启动阿里云RPA服务
(1)启动docker镜像
sudo docker-compose -f docker-compose.yml up -d
(2)设置docker-compose开机启动
vim /etc/rc.d/rc.****local**** # 编辑启动脚本,在末尾添加一行,加入下面的脚本systemctl start docker/usr/bin/docker-compose -f /root/server/docker-compose.yml up -d # 注意修改成自己的docker-compose.yml文件位置sudo chmod +x /etc/rc.d/rc.**local**
四、查看结果
在服务器上执行,需要把IP改成自己的服务器IP
[root@rpa ~]# curl -H "Host:rpa.aliyun.net" http://106.15.137.252/login # 注意把**ip**换成自己服务器的**IP**<!DOCTYPE html><html><head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script type="text/javascript" async="" src="/react-dom.js"></script>
<script type="text/javascript" async="" src="/polyfill.min.js"></script>
<link rel="stylesheet" type="text/css" href="/index.css?v=201812051008">
<link rel="shortcut icon" href="/images/ico/favicon.ico">
<title>阿里云RPA控制台</title>
<!--[****if**** lt IE 9]>
<script>location.href = "//www.taobao.com/markets/tbhome/ali-page-updater"; </script>
<![endif]--></head><**body**>
<**div** **id**="ice_container"></**div**>
<script type="text/javascript" src="/rsa/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/webuploader/webuploader.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/rsa/RSA.js"></script>
<script type="text/javascript" charset="utf-8" src="/rsa/BigInt.js"></script>
<script type="text/javascript" charset="utf-8" src="/rsa/Barrett.js"></script>
<script type="text/javascript" charset="utf-8" src="/index.js?v=201812051008" id="ice-script"></script></**body**></html>
查看日志
sudo docker-compose -f docker-compose.yml logs -f
上一篇: 神经网络实现手写数字识别(MNIST)
下一篇: PHP核心技术与最佳实践PDF