From efd8ea6acac781a5700ccc3f78abe5edc4b27eb7 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Mon, 22 Mar 2021 19:07:40 +0300 Subject: [PATCH 1/4] Moved migration script to eventuate-common. --- _build-and-test-all.sh | 21 +++------------------ docker-compose-mssql-migration-tool.yml | 15 --------------- gradle.properties | 4 +++- migration_scripts/mssql/entrypoint.sh | 3 --- mysql-cli.sh | 2 +- 5 files changed, 7 insertions(+), 38 deletions(-) delete mode 100755 docker-compose-mssql-migration-tool.yml delete mode 100644 migration_scripts/mssql/entrypoint.sh diff --git a/_build-and-test-all.sh b/_build-and-test-all.sh index 701faca7..e09aafa5 100755 --- a/_build-and-test-all.sh +++ b/_build-and-test-all.sh @@ -35,25 +35,10 @@ echo 'show dbs' | ./mongodb-cli.sh -i ./wait-for-services.sh localhost readers/${READER}/finished "8099" -migration_file="migration_scripts/${DATABASE}/migration.sql" -rm -f $migration_file -if [ "${DATABASE}" == "mysql" ]; then - curl https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/wip-db-id-gen/mysql/4.initialize-database-db-id.sql --output $migration_file --create-dirs - cat $migration_file | ./mysql-cli.sh -i -elif [ "${DATABASE}" == "postgres" ]; then - curl https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/wip-db-id-gen/postgres/5.initialize-database-db-id.sql --output $migration_file --create-dirs - cat $migration_file | ./postgres-cli.sh -i -elif [ "${DATABASE}" == "mssql" ]; then - curl https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/wip-db-id-gen/mssql/4.setup-db-id.sql --output $migration_file --create-dirs - docker-compose -f docker-compose-mssql-polling.yml -f docker-compose-mssql-migration-tool.yml up --build --no-deps mssql-migration - docker-compose -f docker-compose-mssql-polling.yml -f docker-compose-mssql-migration-tool.yml stop mssql-migration - docker-compose -f docker-compose-mssql-polling.yml -f docker-compose-mssql-migration-tool.yml rm -f mssql-migration -else - echo "Unknown Database" - exit 99 -fi -rm -f $migration_file +export db_id_migration_repository=https://raw.githubusercontent.com/eventuate-foundation/eventuate-common +curl -s https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/master/migration/db-id/mssql/migration.sh &> /dev/stdout | bash + ${dockerall}Up -P envFile=docker-compose-env-files/db-id-gen.env diff --git a/docker-compose-mssql-migration-tool.yml b/docker-compose-mssql-migration-tool.yml deleted file mode 100755 index ee60abee..00000000 --- a/docker-compose-mssql-migration-tool.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: '3' -services: - mssql-migration: - image: mcr.microsoft.com/mssql-tools@sha256:62556500522072535cb3df2bb5965333dded9be47000473e9e0f84118e248642 - depends_on: - - mssql - environment: - TRAM_DB_SERVER: "mssql" - TRAM_SA_PASSWORD: "Eventuate123!" - TRAM_DB: "eventuate" - TRAM_SCHEMA: "eventuate" - volumes: - - ./migration_scripts/mssql:/scripts - working_dir: /scripts - entrypoint: [ "bash", "./entrypoint.sh"] \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 66603d47..c1bfc554 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,6 @@ eventuateCdcImageVersion=0.10.0.BUILD-SNAPSHOT eventuateCdcKafkaEnableBatchProcessing=false removeContainers=false -eventuateExamplesBaseImageVersion=BUILD-5 +eventuateCommonVersion=0.13.0.RELEASE + +eventuateExamplesBaseImageVersion=BUILD-5 \ No newline at end of file diff --git a/migration_scripts/mssql/entrypoint.sh b/migration_scripts/mssql/entrypoint.sh deleted file mode 100644 index 0970c5df..00000000 --- a/migration_scripts/mssql/entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -/opt/mssql-tools/bin/sqlcmd -S $TRAM_DB_SERVER -U sa -P $TRAM_SA_PASSWORD -b -d $TRAM_DB -I -i migration.sql || exit 1 \ No newline at end of file diff --git a/mysql-cli.sh b/mysql-cli.sh index c3a01f8d..ac30ed90 100755 --- a/mysql-cli.sh +++ b/mysql-cli.sh @@ -1,6 +1,6 @@ #! /bin/bash -e -docker run ${1:--it} \ +docker run $* \ --name mysqlterm --network=${PWD##*/}_default --rm \ -e MYSQL_HOST=mysql \ mysql:5.7.13 \ From 4b93a5bea085fbec451d5bde7d14079461ad1b2b Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Mon, 22 Mar 2021 20:33:08 +0300 Subject: [PATCH 2/4] Fixed eventuate-common-version. --- _build-and-test-all.sh | 3 +-- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/_build-and-test-all.sh b/_build-and-test-all.sh index e09aafa5..fe844189 100755 --- a/_build-and-test-all.sh +++ b/_build-and-test-all.sh @@ -36,8 +36,7 @@ echo 'show dbs' | ./mongodb-cli.sh -i ./wait-for-services.sh localhost readers/${READER}/finished "8099" -export db_id_migration_repository=https://raw.githubusercontent.com/eventuate-foundation/eventuate-common -curl -s https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/master/migration/db-id/mssql/migration.sh &> /dev/stdout | bash +curl -s https://raw.githubusercontent.com/eventuate-foundation/eventuate-common/master/migration/db-id/migration.sh &> /dev/stdout | bash ${dockerall}Up -P envFile=docker-compose-env-files/db-id-gen.env diff --git a/gradle.properties b/gradle.properties index c1bfc554..7b77428b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,6 @@ eventuateCdcImageVersion=0.10.0.BUILD-SNAPSHOT eventuateCdcKafkaEnableBatchProcessing=false removeContainers=false -eventuateCommonVersion=0.13.0.RELEASE +eventuateCommonVersion=0.13.0.BUILD-SNAPSHOT eventuateExamplesBaseImageVersion=BUILD-5 \ No newline at end of file From df38608ebfeb6ee63bcec3fb84876538e86dd470 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 23 Mar 2021 14:55:46 +0300 Subject: [PATCH 3/4] Updated .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1f21e07d..c21378d7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ out deployment/terraform_azure/aks_kubectl_config deployment/terraform_azure/1.setup.sql deployment/terraform_azure/2.setup.sql +tmp-migration From f145d58e4982d114475ba3aabb61a10ae90e2247 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Thu, 25 Mar 2021 15:54:15 +0300 Subject: [PATCH 4/4] moved '-it' back to mysql cli --- mysql-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-cli.sh b/mysql-cli.sh index ac30ed90..c3a01f8d 100755 --- a/mysql-cli.sh +++ b/mysql-cli.sh @@ -1,6 +1,6 @@ #! /bin/bash -e -docker run $* \ +docker run ${1:--it} \ --name mysqlterm --network=${PWD##*/}_default --rm \ -e MYSQL_HOST=mysql \ mysql:5.7.13 \