diff options
Diffstat (limited to 'workflow-designer-init')
-rw-r--r-- | workflow-designer-init/src/main/docker/Dockerfile | 3 | ||||
-rw-r--r-- | workflow-designer-init/src/main/docker/create_keyspaces.cql | 12 | ||||
-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.sh | 15 |
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 |