上篇文章介绍用实例主机部署:https://www.cnblogs.com/weavepub/p/11672305.html,本文采用Rancher上部署。
文章所有的文件都托管在Github:https://github.com/weavepub/loonflow-shutongflow
一、安装mysql
1.1 安装
服务名:workflow-db
镜像名:mysql:5.7
环境变量:MYSQL_ROOT_PASSWORD,值:
持久化路径:
/var/run/mysqld
/var/lib/mysql
/etc/mysql/conf.d
1.2 创建数据库
mysql -uroot -p
mysql> CREATE DATABASE loonflow DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE DATABASE shutongflow DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
1.3 导入数据
sql文件放在workflow-sql目录中
mysql -uroot loonflow < loonflownew.sql
mysql -uroot shutongflow < shutongflow.sql
1.4 创建触发器
同步前端账号给后端账号
use shutongflow
DELIMITER //
CREATE TRIGGER user_trigger AFTER INSERT ON user FOR EACH ROW
BEGIN
INSERT INTO loonflow.account_loonuser(username,alias,email,password,phone,creator,dept_id,is_active,is_admin,is_deleted,gmt_created,gmt_modified) VALUES(new.username,new.alias,new.email,new.password,,'ldap',,,,,'2018-05-09 07:22:53.491321','2018-05-09 07:22:53.491321');
END ;
//
DELIMITER ;
二、部署
2.1 制作镜像
文件都放在workflow-docker目录中
docker build -t workflow:r0.3.20 .
docker tag workflow:r0.3.20 reg.nexus.wmq.com/tools/workflow:r0.3.20
docker push reg.nexus.wmq.com/tools/workflow:r0.3.20
上传到私有仓库
2.2 部署镜像
服务名:workflow
镜像名:reg.nexus.wmq.com/tools/workflow:r0.3.20
持久化路径:
/opt/workflow/loonflow/media/notice_script
/opt/workflow/loonflow/media/workflow_script
2.3 配置ingress
域名:workflow.wmq.com,服务:workflow,容器端口:
域名:wf-backend.wmq.com,服务:workflow,容器端口:
域名:wf-backend.wmq.com/admin/,服务:workflow,容器端口:,访问路径:/admin
域名:workflow.admin.wmq.com/admin,服务:workflow,容器端口:,访问路径:/admin
域名:workflow.admin.wmq.com/static,服务:workflow,容器端口:,访问路径:/static
2.4 企业微信通知脚本
send_wechat.py存放在wecaht_script目录中