0%

Flowable 环境搭建

Flowable 工具集搭建

部署 Docker 环境

创建网桥

docker network create -d bridge flowable-bridge

安装 MYSQL

docker run \
-itd \
--name mysql \
--network flowable-bridge \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
mysql
docker exec -it container_id bash
mysql -uroot -p
123456
create schema flowable;

安装 Flowable-Rest

初始化文件目录

mkdir -p ~/flowable/lib && mkdir -p ~/flowable/env

配置 MYSQL 驱动

cd ~/flowable/lib && \
curl -L https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar -o mysql-connector-java-8.0.21.jar

配置 datasource.env

cd ~/flowable/env && vi datasource.env

SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.cj.jdbc.Driver
SPRING_DATASOURCE_URL=jdbc:mysql://172.18.0.1:3306/flowable?useUnicode=true&characterEncoding=utf8
&allowMultiQueries=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
SPRING_DATASOURCE_USERNAME=root
SPRING_DATASOURCE_PASSWORD=123456

注意,MYSQL Host 使用 Docker 网桥 IP

配置 Flowable-Rest

cd ~/flowable/env && vi flowable-rest.env

FLOWABLE_REST_APP_ADMIN_USER-ID=admin
FLOWABLE_REST_APP_ADMIN_PASSWORD=admin
FLOWABLE_REST_APP_ADMIN_FIRST-NAME=Rest
FLOWABLE_REST_APP_ADMIN_LAST-NAME=Admin

安装 Flowable-Rest Image

cd ~

docker run -d \
-p 9900:8080 \
--name=flowable-rest \
-v ~/flowable/lib:/javalib \
--env-file=flowable/env/datasource.env \
--env-file=flowable/env/flowable-rest.env \
--entrypoint "" \
--network flowable-bridge \
flowable/flowable-rest:6.5.0 java -p /javalib -jar /app.war

验证启动成功

http://localhost:9900/flowable-rest/docs/

安装 Flowable All-In-One

配置 Flowable-IDM

cd ~/flowable/env && vi flowable-idm.env

FLOWABLE_IDM_APP_ADMIN_USER-ID=admin
FLOWABLE_IDM_APP_ADMIN_PASSWORD=admin
FLOWABLE_IDM_APP_ADMIN_FIRST-NAME=IDM
FLOWABLE_IDM_APP_ADMIN_LAST-NAME=Admin
FLOWABLE_IDM_APP_ADMIN_EMAIL=wangzihao13@baijia.com

配置 Flowable-Common

cd ~/flowable/env && vi flowable-common.env

FLOWABLE_COMMON_APP_IDM-URL=http://172.18.0.1:9901/flowable-idm
FLOWABLE_COMMON_APP_IDM-ADMIN_USER=admin
FLOWABLE_COMMON_APP_IDM-ADMIN_PASSWORD=admin

配置 Flowable-Admin

cd ~/flowable/env && vi flowable-admin.env

FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_REST-ROOT=service
FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_PROCESS_password=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_REST-ROOT=cmmn-api
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CMMN_password=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_REST-ROOT=dmn-api
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_DMN_password=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_REST-ROOT=form-api
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_FORM_password=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_REST-ROOT=content-api
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_CONTENT_password=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_SERVER-ADDRESS=http://172.18.0.1
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_PORT=9900
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_CONTEXT-ROOT=flowable-rest
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_REST-ROOT=app-api
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_USER-NAME=admin
FLOWABLE_ADMIN_APP_SERVER-CONFIG_APP_password=admin

配置 Flowable-Modeler

cd ~/flowable/env && vim flowable-modeler.env 

FLOWABLE_MODELER_APP_DEPLOYMENT-API-URL=http://172.18.0.1:9900/flowable-rest/app-api

安装 Flowable All-In-One Image

cd ~

docker run -d --name flowable-aio \
-p 9901:8080 \
-v ~/flowable/lib/mysql-connector-java-8.0.21.jar:/opt/tomcat/lib/mysql-connector-java-8.0.21.jar \
--env-file=flowable/env/datasource.env \
--env-file=flowable/env/flowable-rest.env \
--env-file=flowable/env/flowable-idm.env \
--env-file=flowable/env/flowable-common.env \
--env-file=flowable/env/flowable-admin.env \
--env-file=flowable/env/flowable-modeler.env \
--network flowable-bridge \
flowable/all-in-one:6.5.0

验证启动成功

http://localhost:9901/flowable-idm
http://localhost:9901/flowable-admin
http://localhost:9901/flowable-task
http://localhost:9901/flowable-modeler

部署 Jar 包

下载源码包

Releases · flowable/flowable-engine · GitHub

需要下载对应版本的 SourceCode 压缩包

加载源码

不同版本实现有所区别,以下介绍 6.7.2 release 和 6.3.0 release 两个版本。

6.7.2 release

IDE 打开 flowable-6.7.2-release/module/flowable-ui ,修改以下内容:

  1. flowable-ui-app pom 的打包方式改为 jar

  2. flowable-ui pom 增加 mysql 驱动依赖,建议如下:

    <properties>
      <mysql.version>5.1.47</mysql.version>
    </properties>
    
    <dependencies>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
      </dependency>
    </dependencies>
    
    <dependencyManagement>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.version}</version>
      </dependency>
      </dependencies>
    </dependencyManagement>
  3. 修改 flowable-ui-app/src/main/resources/flowable-default.properties 的 mysql 配置即可。

6.3.0 release

IDE 打开 flowable-6.3.0-release/module/flowable-ui-* ,修改以下内容:

  1. flowable-ui-*-app pom 的打包方式改为 jar

  2. flowable-ui-* pom 增加 mysql 驱动依赖,建议如下:

    <properties>
      <mysql.version>5.1.47</mysql.version>
    </properties>
    
    <dependencies>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
      </dependency>
    </dependencies>
    
    <dependencyManagement>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.version}</version>
      </dependency>
      </dependencies>
    </dependencyManagement>
  3. 修改 flowable-ui-*-app/src/main/resources/application.properties 的 mysql 配置

  4. 修改 flowable-ui-*-app/src/main/resources/application.propertiesflowable.common.app.idm-url 配置(注意 hostname 配置成外网访问 url)

Maven 安装

mvn package

生成文件默认在

flowable-engine-flowable-6.3.0/modules/flowable-ui-*/flowable-ui-*-app/target/flowable-*.jar

上传至服务器

scp 指令上传即可