summaryrefslogtreecommitdiffstats
path: root/workflow-designer-init
diff options
context:
space:
mode:
authoravigaffa <avi.gaffa@amdocs.com>2019-01-03 14:18:49 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2019-01-03 13:35:56 +0000
commit3bfe76a41d7c46d6b367801a0802eb8d4273dfe4 (patch)
treef7cfd3ba67d07793df4f661d87824d33bda81571 /workflow-designer-init
parentc290365753ae928a3e447615d01342823d0be812 (diff)
workflow replication factor
Change sdc-workflow-designer-init docker to support keyspace configuration Change-Id: I5e5350b00de1702d978d3c7179692c7b0cd04e9e Issue-ID: SDC-2033 Signed-off-by: avigaffa <avi.gaffa@amdocs.com>
Diffstat (limited to 'workflow-designer-init')
-rw-r--r--workflow-designer-init/src/main/docker/Dockerfile3
-rw-r--r--workflow-designer-init/src/main/docker/create_keyspaces.cql12
-rw-r--r--workflow-designer-init/src/main/docker/create_tables.cql (renamed from workflow-designer-init/src/main/docker/create_workflow_db.cql)15
-rw-r--r--workflow-designer-init/src/main/docker/start.sh15
4 files changed, 24 insertions, 21 deletions
diff --git a/workflow-designer-init/src/main/docker/Dockerfile b/workflow-designer-init/src/main/docker/Dockerfile
index 7cd101c9..399f216c 100644
--- a/workflow-designer-init/src/main/docker/Dockerfile
+++ b/workflow-designer-init/src/main/docker/Dockerfile
@@ -2,8 +2,7 @@ FROM python:2.7-alpine3.8
RUN pip install cqlsh==4.0.1
-COPY create_workflow_db.cql .
-COPY start.sh .
+COPY create_keyspaces.cql create_tables.cql start.sh ./
RUN chmod 744 start.sh
diff --git a/workflow-designer-init/src/main/docker/create_keyspaces.cql b/workflow-designer-init/src/main/docker/create_keyspaces.cql
new file mode 100644
index 00000000..47406973
--- /dev/null
+++ b/workflow-designer-init/src/main/docker/create_keyspaces.cql
@@ -0,0 +1,12 @@
+CREATE KEYSPACE IF NOT EXISTS WORKFLOW
+WITH DURABLE_WRITES = TRUE
+AND REPLICATION = {
+ 'class' : 'SimpleStrategy',
+ 'replication_factor' : 1
+};
+
+CREATE KEYSPACE IF NOT EXISTS ZUSAMMEN_WORKFLOW
+WITH REPLICATION = {
+ 'class' : 'SimpleStrategy',
+ 'replication_factor' : 1
+};
diff --git a/workflow-designer-init/src/main/docker/create_workflow_db.cql b/workflow-designer-init/src/main/docker/create_tables.cql
index c6c1f15e..ad9a5cb4 100644
--- a/workflow-designer-init/src/main/docker/create_workflow_db.cql
+++ b/workflow-designer-init/src/main/docker/create_tables.cql
@@ -1,10 +1,3 @@
-CREATE KEYSPACE IF NOT EXISTS WORKFLOW
-WITH DURABLE_WRITES = TRUE
-AND REPLICATION = {
- 'class' : 'SimpleStrategy',
- 'replication_factor' : 1
-};
-
USE WORKFLOW;
CREATE TABLE IF NOT EXISTS UNIQUE_VALUE (
@@ -13,12 +6,6 @@ CREATE TABLE IF NOT EXISTS UNIQUE_VALUE (
PRIMARY KEY (( TYPE, VALUE ))
);
-CREATE KEYSPACE IF NOT EXISTS ZUSAMMEN_WORKFLOW
-WITH REPLICATION = {
- 'class' : 'SimpleStrategy',
- 'replication_factor' : 1
-};
-
USE ZUSAMMEN_WORKFLOW;
CREATE TABLE IF NOT EXISTS ITEM (
@@ -122,4 +109,4 @@ CREATE TABLE IF NOT EXISTS VERSION_STAGE (
PUBLISH_TIME TIMESTAMP,
ACTION TEXT,
PRIMARY KEY (( SPACE, ITEM_ID ), VERSION_ID)
-); \ No newline at end of file
+);
diff --git a/workflow-designer-init/src/main/docker/start.sh b/workflow-designer-init/src/main/docker/start.sh
index 919277fd..8acb2cf6 100644
--- a/workflow-designer-init/src/main/docker/start.sh
+++ b/workflow-designer-init/src/main/docker/start.sh
@@ -25,9 +25,14 @@ if [[ -z "${CS_HOST}" ]]; then
exit 1
fi
-if [ $is_cs_unauthenticated -eq 1 ]; then
- cqlsh -u ${CS_USER} -p ${CS_PASSWORD} -f /create_workflow_db.cql ${CS_HOST} ${CS_PORT}
-else
- cqlsh -f /create_workflow_db.cql ${CS_HOST} ${CS_PORT}
-fi
+cql_from_file() {
+
+ if [ $is_cs_unauthenticated -eq 1 ]; then
+ cqlsh -u ${CS_USER} -p ${CS_PASSWORD} -f $1 ${CS_HOST} ${CS_PORT}
+ else
+ cqlsh -f $1 ${CS_HOST} ${CS_PORT}
+ fi
+}
+cql_from_file /create_keyspaces.cql
+cql_from_file /create_tables.cql