diff --git a/scripts/helm/helm/database-migrate/files/chalice.sh b/scripts/helm/helm/database-migrate/files/chalice.sh deleted file mode 100644 index a9bf588e2..000000000 --- a/scripts/helm/helm/database-migrate/files/chalice.sh +++ /dev/null @@ -1 +0,0 @@ -#!/bin/bash diff --git a/scripts/helm/helm/database-migrate/files/clickhouse.sh b/scripts/helm/helm/database-migrate/files/clickhouse.sh new file mode 100644 index 000000000..3b2c9680f --- /dev/null +++ b/scripts/helm/helm/database-migrate/files/clickhouse.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e + +clickhousedir=/opt/openreplay/openreplay/scripts/helm/db/init_dbs/clickhouse + +function migrate() { + echo "Starting postgresql migration" + migration_versions=$1 + for version in $migration_versions; do + echo "Migrating postgresql version $version" + clickhouse-client -h clickhouse.db.svc.cluster.local -p 9000 < ${clickhousedir}/${version}/${version}.sql + done +} + +function init() { + echo "Initializing postgresql" + for file in `ls ${clickhousedir}/create/*.sql`; do + clickhouse-client -h clickhouse.db.svc.cluster.local -p 9000 < $file + done +} + +# /bin/bash postgresql.sh migrate $migration_versions +case "$1" in + migrate) + migrate $2 + ;; + init) + init + ;; + *) + echo "Unknown operation for clickhouse migration; exiting." + exit 1 + ;; +esac diff --git a/scripts/helm/helm/database-migrate/files/dbops.sh b/scripts/helm/helm/database-migrate/files/dbops.sh index abe255359..a35f64e23 100644 --- a/scripts/helm/helm/database-migrate/files/dbops.sh +++ b/scripts/helm/helm/database-migrate/files/dbops.sh @@ -46,6 +46,12 @@ function init(){ postgresql) /bin/bash postgresql.sh init ;; + clickhouse) + /bin/bash clickhouse.sh init + ;; + kafka) + /bin/bash kafka.sh init + ;; *) echo "Unknown operation for db init; exiting." exit 1 diff --git a/scripts/helm/helm/database-migrate/templates/Job.yaml b/scripts/helm/helm/database-migrate/templates/Job.yaml index e33101019..074c51954 100644 --- a/scripts/helm/helm/database-migrate/templates/Job.yaml +++ b/scripts/helm/helm/database-migrate/templates/Job.yaml @@ -67,11 +67,12 @@ spec: - name: dbmigrationscript mountPath: /opt/migrations/ - name: clickhouse - image: yandex/clickhouse-server:20.9 + image: yandex/clickhouse-client:20.9 command: - /bin/bash - - /opt/migration.sh + - /opt/migrations/dbops.sh - "{{ .Release.IsUpgrade }}" + - clickhouse volumeMounts: - name: shared mountPath: /opt/openreplay @@ -83,6 +84,7 @@ spec: - /bin/bash - /opt/migration.sh - "{{ .Release.IsUpgrade }}" + - kafka volumeMounts: - name: shared mountPath: /opt/openreplay diff --git a/scripts/helm/helm/values.yaml b/scripts/helm/helm/values.yaml index 496cff708..879225cc0 100644 --- a/scripts/helm/helm/values.yaml +++ b/scripts/helm/helm/values.yaml @@ -1,7 +1,7 @@ postgresql: # For genrating psswords # `openssl rand -hex 20` - postgresqlPassword: "asdfasdfasdcasdc" + postgresqlPassword: "changeMePassword" postgresqlHost: "postgresql.db.svc.cluster.local" postgresqlPort: "5432" postgresqlUser: "postgres" @@ -12,5 +12,8 @@ minio: minio: # For genrating psswords # `openssl rand -hex 20` - accessKey: "sasdcasdcasd" - secretKey: "sdvasdfasdfasdf" + accessKey: "changeMePassword" + secretKey: "changeMePassword" + +global: + enterprise_edition_license: ""