You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by im...@apache.org on 2021/07/30 17:59:46 UTC

[oodt] 03/04: Dockerized workflow manager

This is an automated email from the ASF dual-hosted git repository.

imesha pushed a commit to branch development
in repository https://gitbox.apache.org/repos/asf/oodt.git

commit c20ceec91d2a2c3f2681b788f5e9a5c950d4b936
Author: Imesha Sudasingha <im...@gmail.com>
AuthorDate: Fri Jul 30 23:26:32 2021 +0530

    Dockerized workflow manager
---
 deployment/docker-compose.yml                      | 12 +++++--
 filemgr/src/main/bin/filemgr                       |  2 +-
 .../workflowManager/WorkflowList/WorkflowList.js   |  4 +--
 .../swagger-implementations/workflow_manager.yaml  |  2 +-
 workflow/Dockerfile                                |  8 +++++
 workflow/pom.xml                                   | 12 +++++--
 workflow/src/main/bin/wmgr                         | 38 ++++++++++++++++------
 workflow/src/main/resources/workflow.properties    |  8 ++---
 8 files changed, 64 insertions(+), 22 deletions(-)

diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml
index c846093..5e56a34 100644
--- a/deployment/docker-compose.yml
+++ b/deployment/docker-compose.yml
@@ -14,6 +14,14 @@ services:
     volumes:
       - filemgr-data:/filemgr/data
 
+  workflowmgr:
+    image: oodt/workflowmgr:latest
+    restart: "no"
+    ports:
+      - 9001:9001
+    environment:
+      - SOLR_URL=http://solr:8983
+
   opsui:
     image: oodt/opsui:latest
     restart: "no"
@@ -27,10 +35,10 @@ services:
       - 8080:8080
     environment:
       FILEMGR_URL: http://filemgr:9000
-      WORKFLOW_URL: http://wmgr:9001
+      WORKFLOW_URL: http://workflowmgr:9001
       FILEMGR_WORKINGDIR: /tmp
     volumes:
       - filemgr-data:/filemgr/data
 
-volumes: 
+volumes:
   filemgr-data:
\ No newline at end of file
diff --git a/filemgr/src/main/bin/filemgr b/filemgr/src/main/bin/filemgr
index 567c665..806a15e 100644
--- a/filemgr/src/main/bin/filemgr
+++ b/filemgr/src/main/bin/filemgr
@@ -38,7 +38,7 @@ FILEMGR_HOME=`cd ..; pwd`
 export FILEMGR_HOME
 RUN_HOME=${FILEMGR_HOME}/run
 export RUN_HOME
-CAS_FILEMGR_PROPS=../etc/filemgr.properties
+CAS_FILEMGR_PROPS=${FILEMGR_HOME}/etc/filemgr.properties
 export CAS_FILEMGR_PROPS
 
 PATH=${JAVA_HOME}/bin:${FILEMGR_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin
diff --git a/react-components/oodt_opsui_sample_app/src/components/workflowManager/WorkflowList/WorkflowList.js b/react-components/oodt_opsui_sample_app/src/components/workflowManager/WorkflowList/WorkflowList.js
index 34cf5d9..49af77a 100644
--- a/react-components/oodt_opsui_sample_app/src/components/workflowManager/WorkflowList/WorkflowList.js
+++ b/react-components/oodt_opsui_sample_app/src/components/workflowManager/WorkflowList/WorkflowList.js
@@ -55,7 +55,7 @@ class WorkflowList extends Component {
 
   componentWillMount() {
     wmconnection
-      .get("/workflows/firstpage")
+      .get("/workflow/firstpage")
       .then(result => {
         this.setState({
           rows: result.data.workflowPageInstance.pageWorkflows
@@ -96,7 +96,7 @@ class WorkflowList extends Component {
 
   reloadWorkflow() {
     wmconnection
-      .get("/workflows/firstpage")
+      .get("/workflow/firstpage")
       .then(result => {
         this.setState({
           rows: result.data.workflowPageInstance.pageWorkflows
diff --git a/react-components/swagger-implementations/workflow_manager.yaml b/react-components/swagger-implementations/workflow_manager.yaml
index 4c34cc5..4f7c1b1 100644
--- a/react-components/swagger-implementations/workflow_manager.yaml
+++ b/react-components/swagger-implementations/workflow_manager.yaml
@@ -60,7 +60,7 @@ paths:
         404:
           description: Workflow not Found
 
-  /workflows/firstpage:
+  /workflow/firstpage:
     get:
       tags:
         - Workflows
diff --git a/workflow/Dockerfile b/workflow/Dockerfile
new file mode 100644
index 0000000..1caf290
--- /dev/null
+++ b/workflow/Dockerfile
@@ -0,0 +1,8 @@
+FROM openjdk:8-jre-alpine
+
+ADD target/cas-workflow-1.9-SNAPSHOT-dist.tar.gz /
+RUN mv cas-workflow-1.9-SNAPSHOT /workflowmgr
+
+WORKDIR /workflowmgr/bin
+
+ENTRYPOINT ["sh", "./wmgr", "run"]
\ No newline at end of file
diff --git a/workflow/pom.xml b/workflow/pom.xml
index c63a23b..42fd7a2 100644
--- a/workflow/pom.xml
+++ b/workflow/pom.xml
@@ -26,11 +26,19 @@ the License.
   </parent>
   <artifactId>cas-workflow</artifactId>
   <name>Catalog and Archive Workflow Management Component</name>
-  <description>The workflow management component of a Catalog and Archive Service. This component
+  <description>
+    The workflow management component of a Catalog and Archive Service. This component
      purposefully separates workflow repositories and workflow engines standard interfaces, and
      provides some out of the box backend implementations of them (including one based
      on the javax.sql.DataSource interface). This component provides everything that you need
-     to execute workflows, and science processing pipelines.</description>
+     to execute workflows, and science processing pipelines.
+  </description>
+
+  <properties>
+    <docker.build.disabled>false</docker.build.disabled>
+    <docker.image.name>oodt/workflowmgr:latest</docker.image.name>
+  </properties>
+
   <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
      Once the dependency is in the core pom, it can then be used in other modules without the version tags.
      For example, within core/pom.xml:
diff --git a/workflow/src/main/bin/wmgr b/workflow/src/main/bin/wmgr
index 994dc6c..572a391 100644
--- a/workflow/src/main/bin/wmgr
+++ b/workflow/src/main/bin/wmgr
@@ -34,27 +34,45 @@ else
 fi
 
 export JAVA_HOME
-CAS_WORKFLOW_HOME=..
+CAS_WORKFLOW_HOME=`cd ..; pwd`
 export CAS_WORKFLOW_HOME
-RUN_HOME=${CAS_WORKFLOW_HOME}/../run
+RUN_HOME=${CAS_WORKFLOW_HOME}/run
 export RUN_HOME
-CAS_WORKFLOW_PROPS=../etc/workflow.properties
+CAS_WORKFLOW_PROPS=${CAS_WORKFLOW_HOME}/etc/workflow.properties
 export CAS_WORKFLOW_PROPS
 
 PATH=${JAVA_HOME}/bin:${CAS_WORKFLOW_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin
 export PATH
 
+if [ ! -z $DEBUG ]; then
+    echo "Running in debug mode on port: ${DEBUG}"
+    JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${DEBUG}"
+fi
+
 # See how we were called.
 case "$1" in
+  run)
+        echo -n "Starting cas workflow manager: "
+        $JAVA_HOME/bin/java ${JAVA_OPTS} \
+            -Djava.ext.dirs=${CAS_WORKFLOW_HOME}/lib \
+            -Dlog4j.configurationFile=${CAS_WORKFLOW_HOME}/etc/log4j2.xml \
+            -Djava.util.logging.config.file=${CAS_WORKFLOW_HOME}/etc/logging.properties \
+            -Dorg.apache.oodt.cas.workflow.properties=${CAS_WORKFLOW_PROPS} \
+            -Dorg.apache.oodt.cas.pge.task.metkeys.legacyMode="true" \
+            -Dorg.apache.oodt.cas.pge.task.status.legacyMode="true" \
+            org.apache.oodt.cas.workflow.system.WorkflowManagerStarter \
+            --portNum $SERVER_PORT
+        ;;
   start)
         echo -n "Starting cas workflow manager: "
-        $JAVA_HOME/bin/java -Djava.ext.dirs=${CAS_WORKFLOW_HOME}/lib \
-        -Dlog4j.configurationFile=${CAS_WORKFLOW_HOME}/etc/log4j2.xml \
-        -Djava.util.logging.config.file=${CAS_WORKFLOW_HOME}/etc/logging.properties \
-        -Dorg.apache.oodt.cas.workflow.properties=${CAS_WORKFLOW_PROPS} \
-        -Dorg.apache.oodt.cas.pge.task.metkeys.legacyMode="true" \
-        -Dorg.apache.oodt.cas.pge.task.status.legacyMode="true" \
-        org.apache.oodt.cas.workflow.system.WorkflowManagerStarter --portNum $SERVER_PORT &
+        $JAVA_HOME/bin/java ${JAVA_OPTS} -Djava.ext.dirs=${CAS_WORKFLOW_HOME}/lib \
+            -Dlog4j.configurationFile=${CAS_WORKFLOW_HOME}/etc/log4j2.xml \
+            -Djava.util.logging.config.file=${CAS_WORKFLOW_HOME}/etc/logging.properties \
+            -Dorg.apache.oodt.cas.workflow.properties=${CAS_WORKFLOW_PROPS} \
+            -Dorg.apache.oodt.cas.pge.task.metkeys.legacyMode="true" \
+            -Dorg.apache.oodt.cas.pge.task.status.legacyMode="true" \
+            org.apache.oodt.cas.workflow.system.WorkflowManagerStarter \
+            --portNum $SERVER_PORT &
         echo $! >${RUN_HOME}/cas.workflow.pid 
         echo "OK"
         sleep 5
diff --git a/workflow/src/main/resources/workflow.properties b/workflow/src/main/resources/workflow.properties
index 328d991..582ff1a 100644
--- a/workflow/src/main/resources/workflow.properties
+++ b/workflow/src/main/resources/workflow.properties
@@ -60,7 +60,7 @@ org.apache.oodt.cas.workflow.wengine.asynchronous.runner.num.threads=25
 org.apache.oodt.cas.workflow.instanceRep.pageSize=20
 
 # lucene workflow instance repository properties
-org.apache.oodt.cas.workflow.instanceRep.lucene.idxPath=/path/to/index
+org.apache.oodt.cas.workflow.instanceRep.lucene.idxPath=[CAS_WORKFLOW_HOME]/data/workflow
 
 # data source workflow instance repository properties
 org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.url=jdbc:url
@@ -70,7 +70,7 @@ org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.driver=your.jdbc.Driver
 org.apache.oodt.cas.workflow.instanceRep.datasource.quoteFields=false
 
 # XML workflow repository properties
-org.apache.oodt.cas.workflow.repo.dirs=file:///path/to/your/repo1, file:///path/to/your/repo2
+org.apache.oodt.cas.workflow.repo.dirs=file://[CAS_WORKFLOW_HOME]/policy
 # uncomment the following line and set the value to true to recursively parse repository directories
 #org.apache.oodt.cas.workflow.repo.dirs.recursive=false
 
@@ -84,8 +84,8 @@ org.apache.oodt.cas.workflow.repo.datasource.jdbc.pass=pass
 org.apache.oodt.cas.workflow.repo.datasource.jdbc.driver=your.jdbc.Driver
 
 # Spring command line option and action store properties
-org.apache.oodt.cas.cli.action.spring.config=src/main/resources/cmd-line-actions.xml
-org.apache.oodt.cas.cli.option.spring.config=src/main/resources/cmd-line-options.xml
+org.apache.oodt.cas.cli.action.spring.config=file://[CAS_WORKFLOW_HOME]/policy/cmd-line-actions.xml
+org.apache.oodt.cas.cli.option.spring.config=file://[CAS_WORKFLOW_HOME]/policy/cmd-line-options.xml
 
 # workflow lifecycle Manager
 org.apache.oodt.cas.workflow.lifecycle.filePath=/path/to/workflow-lifecycle.xml