centos7下docker部署搭建drools-workbench7.5的几点收获

看了qchery大神博客drools系列文章,自己就动手实践了一遍。期间收获很大。但也遇到了几个问题:

1.drools中文规则;

2.drools规则定义涉及时间;

3.drools规则持久化保存;

第1个问题qchery大神系列文章Drools Workbench 中文规则问题已经解决,感谢他无私分享。

第2个问题涉及到centos时间跟docker容器时间同步,百度一下,解决不难

第3个问题规则持久化保存,则是docker容器方面问题,容器删除,容器内数据也会删除;参考jboss/drools-workbench-showcase持久化配置就可以。不过得注意1个细节:

1.centos下创建/home/myuser/web_git/mygit,修改文件夹及其子文件夹文件权限,命令如下:

chomd -R 777 home/;

废话少说。操作步骤如下:

1.拉取基础镜像,命令如下:

docker pull jboss/drools-workbench-showcase:7.5.0.Final

2.启动镜像,copy相关配置文件,命令如下:

docker run -p 8080:8080 -p 8001:8001 -d -- name drools-workbench jboss/drools-workbench-showcase:7.5.0.Final

centos根目录下,执行命令:

cd etc;

mkdir drools;

docker cp drools-workbench:/opt/jboss/wildfly/standalone/configuration/standalone-full-drools.xml drools/

docker cp drools-workbench:/opt/jboss/wildfly/standalone/configuration/drools-users.properties drools/

docker cp drools-workbench:/opt/jboss/wildfly/standalone/configuration/drools-roles.properties drools/

3.创建Dockerflie文件如下:

FROM docker.io/jboss/drools-workbench-showcase:7.5.0.Final
MAINTAINER "SZB" "[email protected]"


####### ENVIRONMENT ############
# Use demo and examples by default in this showcase image (internet connection required).
ENV KIE_SERVER_PROFILE standalone-full-drools
ENV JAVA_OPTS -server -Xms256m -Xmx512m -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8
###docker容器时间同步配置####
ENV TZ=Asia/Shanghai
####### Drools Workbench CUSTOM CONFIGURATION ############
ADD drools/standalone-full-drools.xml $JBOSS_HOME/standalone/configuration/standalone-full-drools.xml
ADD drools/drools-users.properties $JBOSS_HOME/standalone/configuration/drools-users.properties
ADD drools/drools-roles.properties $JBOSS_HOME/standalone/configuration/drools-roles.properties


# Added files are chowned to root user, change it to the jboss one.
USER root

###docker容器时间同步配置####

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN chown jboss:jboss $JBOSS_HOME/standalone/configuration/standalone-full-drools.xml && \
chown jboss:jboss $JBOSS_HOME/standalone/configuration/drools-users.properties && \
chown jboss:jboss $JBOSS_HOME/standalone/configuration/drools-roles.properties

# Switchback to jboss user
USER jboss
####### RUNNING DROOLS-WB ############
WORKDIR $JBOSS_HOME/bin/
CMD ["./start_drools-wb.sh"]

4.构建镜像,命令如下:

docker build -rm -t drools-workbench:Persistent .

5.启动镜像,命令如下:

docker run -p 8080:8080 -p 8001:8001 -v /home/myuser/wb_git:/opt/jboss/wildfly/bin/.niogit:Z -d --name drools-workbench drools-workbench:Persistent

6.浏览器访问,http://localhost:8080/drools-wb



你可能感兴趣的:(centos7下docker部署搭建drools-workbench7.5的几点收获)