2020-11-19 09:50:16 -05:00
|
|
|
#! /bin/bash
|
|
|
|
|
2022-04-06 12:52:56 -04:00
|
|
|
if command -v podman > /dev/null; then
|
|
|
|
CONTAINER_CLI=$(command -v podman)
|
|
|
|
HEALTCHECK_PATH="{{.State.Healthcheck.Status}}"
|
|
|
|
# Only use sudo for podman
|
|
|
|
if command -v sudo > /dev/null; then
|
|
|
|
PRIVILEGED_CLI="sudo"
|
|
|
|
else
|
|
|
|
PRIVILEGED_CLI=""
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
CONTAINER_CLI=$(command -v docker)
|
|
|
|
HEALTCHECK_PATH="{{.State.Health.Status}}"
|
|
|
|
PRIVILEGED_CLI=""
|
|
|
|
fi
|
|
|
|
|
2022-09-20 03:26:06 -04:00
|
|
|
mysql() {
|
2022-11-03 10:15:01 -04:00
|
|
|
mysql_8_0
|
2022-09-20 03:26:06 -04:00
|
|
|
}
|
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
mysql_5_7() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f mysql || true
|
2022-11-03 10:15:01 -04:00
|
|
|
$CONTAINER_CLI run --name mysql -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=hibernate_orm_test -p3306:3306 -d docker.io/mysql:5.7.40 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-character-set-client-handshake --log-bin-trust-function-creators=1
|
2021-07-26 11:18:34 -04:00
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# Need to access STDERR. Thanks for the snippet https://stackoverflow.com/a/56577569/412446
|
2022-04-06 12:52:56 -04:00
|
|
|
{ OUTPUT="$( { $CONTAINER_CLI logs mysql; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
2021-07-26 11:18:34 -04:00
|
|
|
if [[ $OUTPUT == *"ready for connections"* ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
n=$((n+1))
|
|
|
|
echo "Waiting for MySQL to start..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "MySQL failed to start and configure after 15 seconds"
|
|
|
|
else
|
|
|
|
echo "MySQL successfully started"
|
|
|
|
fi
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mysql_8_0() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f mysql || true
|
2022-11-03 10:15:01 -04:00
|
|
|
$CONTAINER_CLI run --name mysql -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=hibernate_orm_test -p3306:3306 -d docker.io/mysql:8.0.31 --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_as_cs --skip-character-set-client-handshake --log-bin-trust-function-creators=1
|
2021-07-26 11:18:34 -04:00
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# Need to access STDERR. Thanks for the snippet https://stackoverflow.com/a/56577569/412446
|
2022-04-06 12:52:56 -04:00
|
|
|
{ OUTPUT="$( { $CONTAINER_CLI logs mysql; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
2021-07-26 11:18:34 -04:00
|
|
|
if [[ $OUTPUT == *"ready for connections"* ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
n=$((n+1))
|
|
|
|
echo "Waiting for MySQL to start..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "MySQL failed to start and configure after 15 seconds"
|
|
|
|
else
|
|
|
|
echo "MySQL successfully started"
|
|
|
|
fi
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mariadb() {
|
2022-11-03 10:15:01 -04:00
|
|
|
mariadb_10_9
|
|
|
|
}
|
|
|
|
|
|
|
|
mariadb_10_3() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f mariadb || true
|
2022-11-03 10:15:01 -04:00
|
|
|
$CONTAINER_CLI run --name mariadb -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=hibernate_orm_test -p3306:3306 -d docker.io/mariadb:10.3.36 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-character-set-client-handshake
|
|
|
|
OUTPUT=
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# Need to access STDERR. Thanks for the snippet https://stackoverflow.com/a/56577569/412446
|
|
|
|
{ OUTPUT="$( { $CONTAINER_CLI logs mariadb; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
|
|
|
if [[ $OUTPUT == *"ready for connections"* ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
n=$((n+1))
|
|
|
|
echo "Waiting for MariaDB to start..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "MariaDB failed to start and configure after 15 seconds"
|
|
|
|
else
|
|
|
|
echo "MariaDB successfully started"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
mariadb_10_9() {
|
|
|
|
$CONTAINER_CLI rm -f mariadb || true
|
|
|
|
$CONTAINER_CLI run --name mariadb -e MYSQL_USER=hibernate_orm_test -e MYSQL_PASSWORD=hibernate_orm_test -e MYSQL_DATABASE=hibernate_orm_test -e MYSQL_ROOT_PASSWORD=hibernate_orm_test -p3306:3306 -d docker.io/mariadb:10.9.3 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-character-set-client-handshake
|
2021-07-26 11:18:34 -04:00
|
|
|
OUTPUT=
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# Need to access STDERR. Thanks for the snippet https://stackoverflow.com/a/56577569/412446
|
2022-04-06 12:52:56 -04:00
|
|
|
{ OUTPUT="$( { $CONTAINER_CLI logs mariadb; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
2021-07-26 11:18:34 -04:00
|
|
|
if [[ $OUTPUT == *"ready for connections"* ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
n=$((n+1))
|
|
|
|
echo "Waiting for MariaDB to start..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "MariaDB failed to start and configure after 15 seconds"
|
|
|
|
else
|
|
|
|
echo "MariaDB successfully started"
|
|
|
|
fi
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
2022-09-20 03:26:06 -04:00
|
|
|
postgresql() {
|
2022-11-03 10:15:01 -04:00
|
|
|
postgresql_14
|
2022-09-20 03:26:06 -04:00
|
|
|
}
|
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
postgresql_9_5() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f postgres || true
|
|
|
|
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:9.5-2.5
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
2022-09-21 07:58:41 -04:00
|
|
|
postgresql_10() {
|
|
|
|
$CONTAINER_CLI rm -f postgres || true
|
|
|
|
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:10-2.5
|
|
|
|
}
|
|
|
|
|
2020-12-17 12:16:09 -05:00
|
|
|
postgresql_13() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f postgres || true
|
|
|
|
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:13-3.1
|
2020-12-17 12:16:09 -05:00
|
|
|
}
|
|
|
|
|
2022-09-21 07:58:41 -04:00
|
|
|
postgresql_14() {
|
|
|
|
$CONTAINER_CLI rm -f postgres || true
|
|
|
|
$CONTAINER_CLI run --name postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p5432:5432 -d docker.io/postgis/postgis:14-3.3
|
|
|
|
}
|
|
|
|
|
2021-06-23 08:56:57 -04:00
|
|
|
edb() {
|
2022-11-03 10:15:01 -04:00
|
|
|
edb_14
|
2022-10-19 13:25:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
edb_10() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f edb || true
|
2022-10-19 13:25:16 -04:00
|
|
|
# We need to build a derived image because the existing image is mainly made for use by a kubernetes operator
|
2022-11-03 10:15:01 -04:00
|
|
|
(cd edb; $CONTAINER_CLI build -t edb-test:10 -f edb10.Dockerfile .)
|
|
|
|
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d edb-test:10
|
|
|
|
}
|
|
|
|
|
|
|
|
edb_14() {
|
|
|
|
$CONTAINER_CLI rm -f edb || true
|
|
|
|
# We need to build a derived image because the existing image is mainly made for use by a kubernetes operator
|
|
|
|
(cd edb; $CONTAINER_CLI build -t edb-test:14 -f edb14.Dockerfile .)
|
|
|
|
$CONTAINER_CLI run --name edb -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -p 5444:5444 -d edb-test:14
|
2021-02-08 17:33:03 -05:00
|
|
|
}
|
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
db2() {
|
2022-11-03 10:15:01 -04:00
|
|
|
db2_11_5
|
|
|
|
}
|
|
|
|
|
|
|
|
db2_11_5() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI rm -f db2 || true
|
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI run --name db2 --privileged -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false -p 50000:50000 -d docker.io/ibmcom/db2:11.5.7.0
|
2020-11-19 09:50:16 -05:00
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
2020-12-17 12:16:09 -05:00
|
|
|
while [[ $OUTPUT != *"INSTANCE"* ]]; do
|
2020-11-19 09:50:16 -05:00
|
|
|
echo "Waiting for DB2 to start..."
|
|
|
|
sleep 10
|
2022-04-06 12:52:56 -04:00
|
|
|
OUTPUT=$($PRIVILEGED_CLI $CONTAINER_CLI logs db2)
|
2020-11-19 09:50:16 -05:00
|
|
|
done
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2 su - orm_test bash -c ". /database/config/orm_test/sqllib/db2profile && /database/config/orm_test/sqllib/bin/db2 'connect to orm_test' && /database/config/orm_test/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
2022-11-03 10:15:01 -04:00
|
|
|
db2_10_5() {
|
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI rm -f db2 || true
|
|
|
|
# The sha represents the tag 10.5.0.5-3.10.0
|
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI run --name db2 --privileged -e DB2INST1_PASSWORD=db2inst1-pwd -e LICENSE=accept -p 50000:50000 -d docker.io/ibmoms/db2express-c@sha256:a499afd9709a1f69fb41703e88def9869955234c3525547e2efc3418d1f4ca2b db2start
|
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
|
|
|
while [[ $OUTPUT != *"DB2START"* ]]; do
|
|
|
|
echo "Waiting for DB2 to start..."
|
|
|
|
sleep 10
|
|
|
|
OUTPUT=$($PRIVILEGED_CLI $CONTAINER_CLI logs db2)
|
|
|
|
done
|
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2 su - db2inst1 bash -c "/home/db2inst1/sqllib/bin/db2 create database orm_test &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'connect to orm_test' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE BUFFERPOOL BP8K pagesize 8K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE SYSTEM TEMPORARY TABLESPACE STB_8 PAGESIZE 8K BUFFERPOOL BP8K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE BUFFERPOOL BP16K pagesize 16K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE SYSTEM TEMPORARY TABLESPACE STB_16 PAGESIZE 16K BUFFERPOOL BP16K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE BUFFERPOOL BP32K pagesize 32K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE SYSTEM TEMPORARY TABLESPACE STB_32 PAGESIZE 32K BUFFERPOOL BP32K' &&
|
|
|
|
/home/db2inst1/sqllib/bin/db2 'CREATE USER TEMPORARY TABLESPACE usr_tbsp MANAGED BY AUTOMATIC STORAGE'"
|
|
|
|
}
|
|
|
|
|
2021-02-11 14:13:09 -05:00
|
|
|
db2_spatial() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI rm -f db2spatial || true
|
2021-02-11 14:13:09 -05:00
|
|
|
temp_dir=$(mktemp -d)
|
|
|
|
cat <<EOF >${temp_dir}/ewkt.sql
|
|
|
|
create or replace function db2gse.asewkt(geometry db2gse.st_geometry)
|
|
|
|
returns clob(2G)
|
|
|
|
specific db2gse.asewkt1
|
|
|
|
language sql
|
|
|
|
deterministic
|
|
|
|
no external action
|
|
|
|
reads sql data
|
|
|
|
return 'srid=' || varchar(db2gse.st_srsid(geometry)) || ';' || db2gse.st_astext(geometry)
|
|
|
|
;
|
|
|
|
|
|
|
|
-- Create SQL function to create a geometry from EWKT format
|
|
|
|
create or replace function db2gse.geomfromewkt(instring varchar(32000))
|
|
|
|
returns db2gse.st_geometry
|
|
|
|
specific db2gse.fromewkt1
|
|
|
|
language sql
|
|
|
|
deterministic
|
|
|
|
no external action
|
|
|
|
reads sql data
|
|
|
|
return db2gse.st_geometry(
|
|
|
|
substr(instring,posstr(instring,';')+1, length(instring) - posstr(instring,';')),
|
|
|
|
integer(substr(instring,posstr(instring,'=')+1,posstr(instring,';')-(posstr(instring,'=')+1)))
|
|
|
|
)
|
|
|
|
;
|
|
|
|
-- Create a DB2 transform group to return and accept EWKT
|
|
|
|
CREATE TRANSFORM FOR db2gse.ST_Geometry EWKT (
|
|
|
|
FROM SQL WITH FUNCTION db2gse.asewkt(db2gse.ST_Geometry),
|
|
|
|
TO SQL WITH FUNCTION db2gse.geomfromewkt(varchar(32000)) )
|
|
|
|
;
|
|
|
|
|
|
|
|
-- Redefine the default DB2_PROGRAM to return and accept EWKT instead of WKT
|
|
|
|
DROP TRANSFORM DB2_PROGRAM FOR db2gse.ST_Geometry;
|
|
|
|
CREATE TRANSFORM FOR db2gse.ST_Geometry DB2_PROGRAM (
|
|
|
|
FROM SQL WITH FUNCTION db2gse.asewkt(db2gse.ST_Geometry),
|
|
|
|
TO SQL WITH FUNCTION db2gse.geomfromewkt(varchar(32000)) )
|
|
|
|
;
|
|
|
|
EOF
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI run --name db2spatial --privileged -e DB2INSTANCE=orm_test -e DB2INST1_PASSWORD=orm_test -e DBNAME=orm_test -e LICENSE=accept -e AUTOCONFIG=false -e ARCHIVE_LOGS=false -e TO_CREATE_SAMPLEDB=false -e REPODB=false \
|
2021-02-11 14:13:09 -05:00
|
|
|
-v ${temp_dir}:/conf \
|
2022-04-06 12:52:56 -04:00
|
|
|
-p 50000:50000 -d docker.io/ibmcom/db2:11.5.5.0
|
2021-02-11 14:13:09 -05:00
|
|
|
|
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
|
|
|
while [[ $OUTPUT != *"Setup has completed."* ]]; do
|
|
|
|
echo "Waiting for DB2 to start..."
|
|
|
|
sleep 10
|
2022-04-06 12:52:56 -04:00
|
|
|
OUTPUT=$($PRIVILEGED_CLI $CONTAINER_CLI logs db2spatial)
|
2021-02-11 14:13:09 -05:00
|
|
|
done
|
|
|
|
sleep 10
|
|
|
|
echo "Enabling spatial extender"
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2spatial su - orm_test bash -c "/database/config/orm_test/sqllib/db2profile && /database/config/orm_test/sqllib/bin/db2se enable_db orm_test"
|
2021-02-11 14:13:09 -05:00
|
|
|
echo "Installing required transform group"
|
2022-04-06 12:52:56 -04:00
|
|
|
$PRIVILEGED_CLI $CONTAINER_CLI exec -t db2spatial su - orm_test bash -c "/database/config/orm_test/sqllib/db2profile && /database/config/orm_test/sqllib/bin/db2 'connect to orm_test' && /database/config/orm_test/sqllib/bin/db2 -tvf /conf/ewkt.sql"
|
2021-02-11 14:13:09 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
mssql() {
|
2022-11-03 10:15:01 -04:00
|
|
|
mssql_2022
|
|
|
|
}
|
|
|
|
|
|
|
|
mssql_2017() {
|
|
|
|
$CONTAINER_CLI rm -f mssql || true
|
|
|
|
#This sha256 matches a specific tag of mcr.microsoft.com/mssql/server:2017-latest :
|
|
|
|
$CONTAINER_CLI run --name mssql -d -p 1433:1433 -e "SA_PASSWORD=Hibernate_orm_test" -e ACCEPT_EULA=Y mcr.microsoft.com/mssql/server@sha256:7d194c54e34cb63bca083542369485c8f4141596805611e84d8c8bab2339eede
|
|
|
|
sleep 5
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# We need a database that uses a non-lock based MVCC approach
|
|
|
|
# https://github.com/microsoft/homebrew-mssql-release/issues/2#issuecomment-682285561
|
|
|
|
$CONTAINER_CLI exec mssql bash -c 'echo "create database hibernate_orm_test collate SQL_Latin1_General_CP1_CS_AS; alter database hibernate_orm_test set READ_COMMITTED_SNAPSHOT ON" | /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Hibernate_orm_test -i /dev/stdin' && break
|
|
|
|
echo "Waiting for SQL Server to start..."
|
|
|
|
n=$((n+1))
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "SQL Server failed to start and configure after 25 seconds"
|
|
|
|
else
|
|
|
|
echo "SQL Server successfully started"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
mssql_2022() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f mssql || true
|
2022-11-03 10:15:01 -04:00
|
|
|
#This sha256 matches a specific tag of mcr.microsoft.com/mssql/server:2022-latest :
|
|
|
|
$CONTAINER_CLI run --name mssql -d -p 1433:1433 -e "SA_PASSWORD=Hibernate_orm_test" -e ACCEPT_EULA=Y mcr.microsoft.com/mssql/server@sha256:5439be9edc3b514cf647bcd3651779fa13f487735a985f40cbdcfecc60fea273
|
2020-12-17 12:16:09 -05:00
|
|
|
sleep 5
|
|
|
|
n=0
|
|
|
|
until [ "$n" -ge 5 ]
|
|
|
|
do
|
|
|
|
# We need a database that uses a non-lock based MVCC approach
|
|
|
|
# https://github.com/microsoft/homebrew-mssql-release/issues/2#issuecomment-682285561
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI exec mssql bash -c 'echo "create database hibernate_orm_test collate SQL_Latin1_General_CP1_CS_AS; alter database hibernate_orm_test set READ_COMMITTED_SNAPSHOT ON" | /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Hibernate_orm_test -i /dev/stdin' && break
|
2020-12-17 12:16:09 -05:00
|
|
|
echo "Waiting for SQL Server to start..."
|
|
|
|
n=$((n+1))
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
if [ "$n" -ge 5 ]; then
|
|
|
|
echo "SQL Server failed to start and configure after 25 seconds"
|
|
|
|
else
|
|
|
|
echo "SQL Server successfully started"
|
|
|
|
fi
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
2021-06-23 08:56:57 -04:00
|
|
|
sybase() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f sybase || true
|
2021-06-23 08:56:57 -04:00
|
|
|
# Yup, that sucks, but on ubuntu we need to use -T11889 as per: https://github.com/DataGrip/docker-env/issues/12
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI run -d -p 5000:5000 -p 5001:5001 --name sybase --entrypoint /bin/bash docker.io/nguoianphu/docker-sybase -c "source /opt/sybase/SYBASE.sh
|
2021-06-23 08:56:57 -04:00
|
|
|
/opt/sybase/ASE-16_0/bin/dataserver \
|
|
|
|
-d/opt/sybase/data/master.dat \
|
|
|
|
-e/opt/sybase/ASE-16_0/install/MYSYBASE.log \
|
|
|
|
-c/opt/sybase/ASE-16_0/MYSYBASE.cfg \
|
|
|
|
-M/opt/sybase/ASE-16_0 \
|
|
|
|
-N/opt/sybase/ASE-16_0/sysam/MYSYBASE.properties \
|
|
|
|
-i/opt/sybase \
|
|
|
|
-sMYSYBASE \
|
|
|
|
-T11889
|
|
|
|
RET=\$?
|
|
|
|
exit 0
|
|
|
|
"
|
|
|
|
|
|
|
|
sybase_check() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI exec sybase bash -c "source /opt/sybase/SYBASE.sh;
|
2021-06-23 08:56:57 -04:00
|
|
|
/opt/sybase/OCS-16_0/bin/isql -Usa -P myPassword -S MYSYBASE <<EOF
|
|
|
|
Select name from sysdatabases where status2 & 48 > 0
|
|
|
|
go
|
|
|
|
quit
|
|
|
|
EOF
|
|
|
|
"
|
|
|
|
}
|
|
|
|
START_STATUS=0
|
|
|
|
j=1
|
|
|
|
while (( $j < 30 )); do
|
|
|
|
echo "Waiting for Sybase to start..."
|
|
|
|
sleep 1
|
|
|
|
j=$((j+1))
|
|
|
|
START_STATUS=$(sybase_check | grep '(0 rows affected)' | wc -c)
|
|
|
|
if (( $START_STATUS > 0 )); then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if (( $j == 30 )); then
|
|
|
|
echo "Failed starting Sybase"
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI ps -a
|
|
|
|
$CONTAINER_CLI logs sybase
|
2021-06-23 08:56:57 -04:00
|
|
|
sybase_check
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
export SYBASE_DB=hibernate_orm_test
|
|
|
|
export SYBASE_USER=hibernate_orm_test
|
|
|
|
export SYBASE_PASSWORD=hibernate_orm_test
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI exec sybase bash -c "source /opt/sybase/SYBASE.sh;
|
2021-06-23 08:56:57 -04:00
|
|
|
cat <<-EOSQL > init1.sql
|
|
|
|
use master
|
|
|
|
go
|
|
|
|
disk resize name='master', size='256m'
|
|
|
|
go
|
|
|
|
create database $SYBASE_DB on master = '96m'
|
|
|
|
go
|
|
|
|
sp_dboption $SYBASE_DB, \"single user\", true
|
|
|
|
go
|
|
|
|
alter database $SYBASE_DB log on master = '50m'
|
|
|
|
go
|
|
|
|
use $SYBASE_DB
|
|
|
|
go
|
|
|
|
exec sp_extendsegment logsegment, $SYBASE_DB, master
|
|
|
|
go
|
|
|
|
use master
|
|
|
|
go
|
|
|
|
sp_dboption $SYBASE_DB, \"single user\", false
|
|
|
|
go
|
|
|
|
use $SYBASE_DB
|
|
|
|
go
|
|
|
|
checkpoint
|
|
|
|
go
|
|
|
|
use master
|
|
|
|
go
|
|
|
|
create login $SYBASE_USER with password $SYBASE_PASSWORD
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'abort tran on log full', true
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'allow nulls by default', true
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'ddl in tran', true
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'trunc log on chkpt', true
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'full logging for select into', true
|
|
|
|
go
|
|
|
|
exec sp_dboption $SYBASE_DB, 'full logging for alter table', true
|
|
|
|
go
|
|
|
|
sp_dboption $SYBASE_DB, \"select into\", true
|
|
|
|
go
|
2021-11-23 12:16:48 -05:00
|
|
|
sp_dboption tempdb, 'ddl in tran', true
|
|
|
|
go
|
2021-06-23 08:56:57 -04:00
|
|
|
EOSQL
|
|
|
|
|
|
|
|
/opt/sybase/OCS-16_0/bin/isql -Usa -P myPassword -S MYSYBASE -i ./init1.sql
|
|
|
|
|
|
|
|
echo =============== CREATING DB ==========================
|
|
|
|
cat <<-EOSQL > init2.sql
|
|
|
|
use $SYBASE_DB
|
|
|
|
go
|
|
|
|
sp_adduser '$SYBASE_USER', '$SYBASE_USER', null
|
|
|
|
go
|
|
|
|
grant create default to $SYBASE_USER
|
|
|
|
go
|
|
|
|
grant create table to $SYBASE_USER
|
|
|
|
go
|
|
|
|
grant create view to $SYBASE_USER
|
|
|
|
go
|
|
|
|
grant create rule to $SYBASE_USER
|
|
|
|
go
|
|
|
|
grant create function to $SYBASE_USER
|
|
|
|
go
|
|
|
|
grant create procedure to $SYBASE_USER
|
|
|
|
go
|
|
|
|
commit
|
|
|
|
go
|
|
|
|
EOSQL
|
|
|
|
|
|
|
|
/opt/sybase/OCS-16_0/bin/isql -Usa -P myPassword -S MYSYBASE -i ./init2.sql"
|
|
|
|
echo "Sybase successfully started"
|
|
|
|
}
|
|
|
|
|
2022-04-06 12:52:56 -04:00
|
|
|
oracle_setup() {
|
|
|
|
HEALTHSTATUS=
|
|
|
|
until [ "$HEALTHSTATUS" == "healthy" ];
|
2021-02-03 04:55:07 -05:00
|
|
|
do
|
|
|
|
echo "Waiting for Oracle to start..."
|
2022-04-06 12:52:56 -04:00
|
|
|
sleep 5;
|
|
|
|
# On WSL, health-checks intervals don't work for Podman, so run them manually
|
|
|
|
if command -v podman > /dev/null; then
|
|
|
|
$CONTAINER_CLI healthcheck run oracle > /dev/null
|
|
|
|
fi
|
|
|
|
HEALTHSTATUS="`$CONTAINER_CLI inspect -f $HEALTCHECK_PATH oracle`"
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS##+( )} #Remove longest matching series of spaces from the front
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS%%+( )} #Remove longest matching series of spaces from the back
|
2021-02-03 04:55:07 -05:00
|
|
|
done
|
2022-04-06 12:52:56 -04:00
|
|
|
sleep 2;
|
2021-02-03 04:55:07 -05:00
|
|
|
echo "Oracle successfully started"
|
|
|
|
# We increase file sizes to avoid online resizes as that requires lots of CPU which is restricted in XE
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI exec oracle bash -c "source /home/oracle/.bashrc; bash -c \"
|
2021-02-03 04:55:07 -05:00
|
|
|
cat <<EOF | \$ORACLE_HOME/bin/sqlplus sys/Oracle18@localhost/XE as sysdba
|
2022-11-03 10:15:01 -04:00
|
|
|
alter database tempfile '\$ORACLE_BASE/oradata/XE/temp01.dbf' resize 400M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/system01.dbf' resize 1000M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/sysaux01.dbf' resize 600M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/undotbs01.dbf' resize 300M;
|
|
|
|
alter database add logfile group 4 '\$ORACLE_BASE/oradata/XE/redo04.log' size 500M reuse;
|
|
|
|
alter database add logfile group 5 '\$ORACLE_BASE/oradata/XE/redo05.log' size 500M reuse;
|
|
|
|
alter database add logfile group 6 '\$ORACLE_BASE/oradata/XE/redo06.log' size 500M reuse;
|
2021-02-03 04:55:07 -05:00
|
|
|
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system checkpoint;
|
|
|
|
|
|
|
|
alter database drop logfile group 1;
|
|
|
|
alter database drop logfile group 2;
|
|
|
|
alter database drop logfile group 3;
|
2021-03-12 06:51:38 -05:00
|
|
|
alter system set open_cursors=1000 sid='*' scope=both;
|
2021-02-03 04:55:07 -05:00
|
|
|
EOF\""
|
2020-11-19 09:50:16 -05:00
|
|
|
}
|
|
|
|
|
2022-11-03 10:15:01 -04:00
|
|
|
oracle_setup_old() {
|
|
|
|
HEALTHSTATUS=
|
|
|
|
until [ "$HEALTHSTATUS" == "healthy" ];
|
|
|
|
do
|
|
|
|
echo "Waiting for Oracle to start..."
|
|
|
|
sleep 5;
|
|
|
|
# On WSL, health-checks intervals don't work for Podman, so run them manually
|
|
|
|
if command -v podman > /dev/null; then
|
|
|
|
$CONTAINER_CLI healthcheck run oracle > /dev/null
|
|
|
|
fi
|
|
|
|
HEALTHSTATUS="`$CONTAINER_CLI inspect -f $HEALTCHECK_PATH oracle`"
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS##+( )} #Remove longest matching series of spaces from the front
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS%%+( )} #Remove longest matching series of spaces from the back
|
|
|
|
done
|
|
|
|
# We increase file sizes to avoid online resizes as that requires lots of CPU which is restricted in XE
|
|
|
|
$CONTAINER_CLI exec oracle bash -c "source /home/oracle/.bashrc; bash -c \"
|
|
|
|
cat <<EOF | \$ORACLE_HOME/bin/sqlplus sys/Oracle18@localhost/XE as sysdba
|
|
|
|
alter database tempfile '\$ORACLE_BASE/oradata/XE/temp.dbf' resize 400M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/system.dbf' resize 1000M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/sysaux.dbf' resize 700M;
|
|
|
|
alter database datafile '\$ORACLE_BASE/oradata/XE/undotbs1.dbf' resize 300M;
|
|
|
|
alter database add logfile group 4 '\$ORACLE_BASE/oradata/XE/redo04.log' size 500M reuse;
|
|
|
|
alter database add logfile group 5 '\$ORACLE_BASE/oradata/XE/redo05.log' size 500M reuse;
|
|
|
|
alter database add logfile group 6 '\$ORACLE_BASE/oradata/XE/redo06.log' size 500M reuse;
|
|
|
|
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system switch logfile;
|
|
|
|
alter system checkpoint;
|
|
|
|
|
|
|
|
alter database drop logfile group 1;
|
|
|
|
alter database drop logfile group 2;
|
|
|
|
alter system set open_cursors=1000 sid='*' scope=both;
|
|
|
|
alter system set processes=150 scope=spfile;
|
|
|
|
alter system set filesystemio_options=asynch scope=spfile;
|
|
|
|
alter system set disk_asynch_io=true scope=spfile;
|
|
|
|
EOF\""
|
|
|
|
echo "Waiting for Oracle to restart after configuration..."
|
|
|
|
$CONTAINER_CLI stop oracle
|
|
|
|
$CONTAINER_CLI start oracle
|
|
|
|
HEALTHSTATUS=
|
|
|
|
until [ "$HEALTHSTATUS" == "healthy" ];
|
|
|
|
do
|
|
|
|
echo "Waiting for Oracle to start..."
|
|
|
|
sleep 5;
|
|
|
|
# On WSL, health-checks intervals don't work for Podman, so run them manually
|
|
|
|
if command -v podman > /dev/null; then
|
|
|
|
$CONTAINER_CLI healthcheck run oracle > /dev/null
|
|
|
|
fi
|
|
|
|
HEALTHSTATUS="`$CONTAINER_CLI inspect -f $HEALTCHECK_PATH oracle`"
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS##+( )} #Remove longest matching series of spaces from the front
|
|
|
|
HEALTHSTATUS=${HEALTHSTATUS%%+( )} #Remove longest matching series of spaces from the back
|
|
|
|
done
|
|
|
|
sleep 2;
|
|
|
|
echo "Oracle successfully started"
|
2022-04-06 12:52:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
oracle() {
|
2022-11-03 10:15:01 -04:00
|
|
|
oracle_21
|
2022-04-06 12:52:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
oracle_11() {
|
|
|
|
$CONTAINER_CLI rm -f oracle || true
|
|
|
|
# We need to use the defaults
|
|
|
|
# SYSTEM/Oracle18
|
|
|
|
$CONTAINER_CLI run --name oracle -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle18 \
|
|
|
|
--health-cmd healthcheck.sh \
|
|
|
|
--health-interval 5s \
|
|
|
|
--health-timeout 5s \
|
|
|
|
--health-retries 10 \
|
|
|
|
docker.io/gvenzl/oracle-xe:11.2.0.2-full
|
2022-11-03 10:15:01 -04:00
|
|
|
oracle_setup_old
|
2022-04-06 12:52:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
oracle_18() {
|
|
|
|
$CONTAINER_CLI rm -f oracle || true
|
|
|
|
# We need to use the defaults
|
|
|
|
# SYSTEM/Oracle18
|
|
|
|
$CONTAINER_CLI run --name oracle -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle18 \
|
|
|
|
--health-cmd healthcheck.sh \
|
|
|
|
--health-interval 5s \
|
|
|
|
--health-timeout 5s \
|
|
|
|
--health-retries 10 \
|
|
|
|
docker.io/gvenzl/oracle-xe:18.4.0-full
|
|
|
|
oracle_setup
|
|
|
|
}
|
|
|
|
|
|
|
|
oracle_21() {
|
|
|
|
$CONTAINER_CLI rm -f oracle || true
|
|
|
|
# We need to use the defaults
|
|
|
|
# SYSTEM/Oracle18
|
|
|
|
$CONTAINER_CLI run --name oracle -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle18 \
|
|
|
|
--health-cmd healthcheck.sh \
|
|
|
|
--health-interval 5s \
|
|
|
|
--health-timeout 5s \
|
|
|
|
--health-retries 10 \
|
|
|
|
docker.io/gvenzl/oracle-xe:21.3.0-full
|
|
|
|
oracle_setup
|
|
|
|
}
|
|
|
|
|
2021-02-09 07:03:18 -05:00
|
|
|
hana() {
|
|
|
|
temp_dir=$(mktemp -d)
|
2021-07-06 06:55:10 -04:00
|
|
|
echo '{"master_password" : "H1bernate_test"}' >$temp_dir/password.json
|
2021-02-09 07:03:18 -05:00
|
|
|
chmod 777 -R $temp_dir
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f hana || true
|
|
|
|
$CONTAINER_CLI run -d --name hana -p 39013:39013 -p 39017:39017 -p 39041-39045:39041-39045 -p 1128-1129:1128-1129 -p 59013-59014:59013-59014 \
|
2021-04-06 08:24:13 -04:00
|
|
|
--memory=8g \
|
2021-02-09 07:03:18 -05:00
|
|
|
--ulimit nofile=1048576:1048576 \
|
|
|
|
--sysctl kernel.shmmax=1073741824 \
|
|
|
|
--sysctl net.ipv4.ip_local_port_range='40000 60999' \
|
2021-03-17 15:03:13 -04:00
|
|
|
--sysctl kernel.shmmni=4096 \
|
2021-02-09 07:03:18 -05:00
|
|
|
--sysctl kernel.shmall=8388608 \
|
|
|
|
-v $temp_dir:/config \
|
2022-10-05 05:24:20 -04:00
|
|
|
docker.io/saplabs/hanaexpress:2.00.061.00.20220519.1 \
|
2021-02-09 07:03:18 -05:00
|
|
|
--passwords-url file:///config/password.json \
|
|
|
|
--agree-to-sap-license
|
|
|
|
# Give the container some time to start
|
|
|
|
OUTPUT=
|
|
|
|
while [[ $OUTPUT != *"Startup finished"* ]]; do
|
|
|
|
echo "Waiting for HANA to start..."
|
|
|
|
sleep 10
|
2022-04-06 12:52:56 -04:00
|
|
|
OUTPUT=$($CONTAINER_CLI logs hana)
|
2021-02-09 07:03:18 -05:00
|
|
|
done
|
|
|
|
echo "HANA successfully started"
|
|
|
|
}
|
|
|
|
|
2021-02-12 09:11:44 -05:00
|
|
|
cockroachdb() {
|
2022-11-03 10:15:01 -04:00
|
|
|
cockroachdb_22_1
|
|
|
|
}
|
|
|
|
|
|
|
|
cockroachdb_22_1() {
|
|
|
|
$CONTAINER_CLI rm -f cockroach || true
|
|
|
|
LOG_CONFIG="
|
|
|
|
sinks:
|
|
|
|
stderr:
|
|
|
|
channels: all
|
|
|
|
filter: ERROR
|
|
|
|
redact: false
|
|
|
|
exit-on-error: true
|
|
|
|
"
|
|
|
|
$CONTAINER_CLI run -d --name=cockroach -m 3g -p 26257:26257 -p 8080:8080 docker.io/cockroachdb/cockroach:v22.1.10 start-single-node \
|
|
|
|
--insecure --store=type=mem,size=640MiB --advertise-addr=localhost --log="$LOG_CONFIG"
|
|
|
|
OUTPUT=
|
|
|
|
while [[ $OUTPUT != *"CockroachDB node starting"* ]]; do
|
|
|
|
echo "Waiting for CockroachDB to start..."
|
|
|
|
sleep 10
|
|
|
|
# Note we need to redirect stderr to stdout to capture the logs
|
|
|
|
OUTPUT=$($CONTAINER_CLI logs cockroach 2>&1)
|
|
|
|
done
|
|
|
|
echo "Enabling experimental box2d operators and some optimized settings for running the tests"
|
|
|
|
#settings documented in https://www.cockroachlabs.com/docs/v21.2/local-testing.html#use-a-local-single-node-cluster-with-in-memory-storage
|
|
|
|
$CONTAINER_CLI exec cockroach bash -c "cat <<EOF | ./cockroach sql --insecure
|
|
|
|
SET CLUSTER SETTING sql.spatial.experimental_box2d_comparison_operators.enabled = on;
|
|
|
|
SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = true;
|
|
|
|
SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms';
|
|
|
|
SET CLUSTER SETTING jobs.registry.interval.gc = '30s';
|
|
|
|
SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';
|
|
|
|
SET CLUSTER SETTING jobs.retention_time = '15s';
|
|
|
|
SET CLUSTER SETTING schemachanger.backfiller.buffer_increment = '128 KiB';
|
|
|
|
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
|
|
|
|
SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';
|
|
|
|
SET CLUSTER SETTING timeseries.storage.enabled = false;
|
|
|
|
SET CLUSTER SETTING timeseries.storage.resolution_10s.ttl = '0s';
|
|
|
|
SET CLUSTER SETTING timeseries.storage.resolution_30m.ttl = '0s';
|
|
|
|
ALTER RANGE default CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
|
|
|
ALTER DATABASE system CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
|
|
|
ALTER DATABASE defaultdb CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
|
|
|
quit
|
|
|
|
EOF
|
|
|
|
"
|
|
|
|
echo "Cockroachdb successfully started"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cockroachdb_21_2() {
|
2022-04-06 12:52:56 -04:00
|
|
|
$CONTAINER_CLI rm -f cockroach || true
|
2022-09-23 11:43:11 -04:00
|
|
|
LOG_CONFIG="
|
|
|
|
sinks:
|
|
|
|
stderr:
|
|
|
|
channels: all
|
|
|
|
filter: ERROR
|
|
|
|
redact: false
|
|
|
|
exit-on-error: true
|
|
|
|
"
|
|
|
|
$CONTAINER_CLI run -d --name=cockroach -m 3g -p 26257:26257 -p 8080:8080 docker.io/cockroachdb/cockroach:v21.2.16 start-single-node \
|
|
|
|
--insecure --store=type=mem,size=640MiB --advertise-addr=localhost --log="$LOG_CONFIG"
|
2021-02-12 09:11:44 -05:00
|
|
|
OUTPUT=
|
|
|
|
while [[ $OUTPUT != *"CockroachDB node starting"* ]]; do
|
|
|
|
echo "Waiting for CockroachDB to start..."
|
|
|
|
sleep 10
|
2022-05-03 15:48:00 -04:00
|
|
|
# Note we need to redirect stderr to stdout to capture the logs
|
|
|
|
OUTPUT=$($CONTAINER_CLI logs cockroach 2>&1)
|
2021-02-12 09:11:44 -05:00
|
|
|
done
|
2022-09-23 11:43:11 -04:00
|
|
|
echo "Enabling experimental box2d operators and some optimized settings for running the tests"
|
2022-05-03 15:48:00 -04:00
|
|
|
#settings documented in https://www.cockroachlabs.com/docs/v21.2/local-testing.html#use-a-local-single-node-cluster-with-in-memory-storage
|
2022-09-23 11:43:11 -04:00
|
|
|
$CONTAINER_CLI exec cockroach bash -c "cat <<EOF | ./cockroach sql --insecure
|
2021-03-17 15:03:13 -04:00
|
|
|
SET CLUSTER SETTING sql.spatial.experimental_box2d_comparison_operators.enabled = on;
|
2022-05-03 15:48:00 -04:00
|
|
|
SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = true;
|
|
|
|
SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms';
|
|
|
|
SET CLUSTER SETTING jobs.registry.interval.gc = '30s';
|
|
|
|
SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';
|
|
|
|
SET CLUSTER SETTING jobs.retention_time = '15s';
|
|
|
|
SET CLUSTER SETTING schemachanger.backfiller.buffer_increment = '128 KiB';
|
|
|
|
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
|
|
|
|
SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';
|
2022-09-23 11:43:11 -04:00
|
|
|
SET CLUSTER SETTING timeseries.storage.enabled = false;
|
|
|
|
SET CLUSTER SETTING timeseries.storage.resolution_10s.ttl = '0s';
|
|
|
|
SET CLUSTER SETTING timeseries.storage.resolution_30m.ttl = '0s';
|
|
|
|
ALTER RANGE default CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
|
|
|
ALTER DATABASE system CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
|
|
|
ALTER DATABASE defaultdb CONFIGURE ZONE USING \"gc.ttlseconds\" = 10;
|
2021-03-17 15:03:13 -04:00
|
|
|
quit
|
|
|
|
EOF
|
|
|
|
"
|
2021-02-12 09:11:44 -05:00
|
|
|
echo "Cockroachdb successfully started"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
if [ -z ${1} ]; then
|
|
|
|
echo "No db name provided"
|
|
|
|
echo "Provide one of:"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\tcockroachdb"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tcockroachdb_22_1"
|
|
|
|
echo -e "\tcockroachdb_21_1"
|
2020-11-19 09:50:16 -05:00
|
|
|
echo -e "\tdb2"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tdb2_11_5"
|
|
|
|
echo -e "\tdb2_10_5"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\tdb2_spatial"
|
|
|
|
echo -e "\tedb"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tedb_14"
|
|
|
|
echo -e "\tedb_10"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\thana"
|
|
|
|
echo -e "\tmariadb"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tmariadb_10_9"
|
|
|
|
echo -e "\tmariadb_10_3"
|
2020-11-19 09:50:16 -05:00
|
|
|
echo -e "\tmssql"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tmssql_2022"
|
|
|
|
echo -e "\tmssql_2017"
|
2022-09-20 03:26:06 -04:00
|
|
|
echo -e "\tmysql"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\tmysql_8_0"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\tmysql_5_7"
|
2020-11-19 09:50:16 -05:00
|
|
|
echo -e "\toracle"
|
2022-04-06 12:52:56 -04:00
|
|
|
echo -e "\toracle_21"
|
2022-11-03 10:15:01 -04:00
|
|
|
echo -e "\toracle_18"
|
|
|
|
echo -e "\toracle_11"
|
|
|
|
echo -e "\tpostgresql"
|
2022-09-21 07:58:41 -04:00
|
|
|
echo -e "\tpostgresql_14"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\tpostgresql_13"
|
2022-09-21 07:58:41 -04:00
|
|
|
echo -e "\tpostgresql_10"
|
2021-06-23 08:56:57 -04:00
|
|
|
echo -e "\tpostgresql_9_5"
|
|
|
|
echo -e "\tsybase"
|
2020-11-19 09:50:16 -05:00
|
|
|
else
|
|
|
|
${1}
|
2021-04-06 08:24:13 -04:00
|
|
|
fi
|