
* Update the docker compose file to make /Tests/tests_all.sh can run successfully. * Create database gorm in the compose file. * Fix connection failure to local GaussDB instance (127.0.0.1:9950) that resulted in "unexpected EOF" errors during initialization in tests.
66 lines
1.9 KiB
YAML
66 lines
1.9 KiB
YAML
services:
|
|
mysql:
|
|
image: 'mysql:latest'
|
|
ports:
|
|
- "127.0.0.1:9910:3306"
|
|
environment:
|
|
- MYSQL_DATABASE=gorm
|
|
- MYSQL_USER=gorm
|
|
- MYSQL_PASSWORD=gorm
|
|
- MYSQL_RANDOM_ROOT_PASSWORD="yes"
|
|
postgres:
|
|
image: 'postgres:latest'
|
|
ports:
|
|
- "127.0.0.1:9920:5432"
|
|
environment:
|
|
- TZ=Asia/Shanghai
|
|
- POSTGRES_DB=gorm
|
|
- POSTGRES_USER=gorm
|
|
- POSTGRES_PASSWORD=gorm
|
|
mssql:
|
|
image: '${MSSQL_IMAGE}:latest'
|
|
ports:
|
|
- "127.0.0.1:9930:1433"
|
|
environment:
|
|
- TZ=Asia/Shanghai
|
|
- ACCEPT_EULA=Y
|
|
- MSSQL_SA_PASSWORD=LoremIpsum86
|
|
tidb:
|
|
image: 'pingcap/tidb:v6.5.0'
|
|
ports:
|
|
- "127.0.0.1:9940:4000"
|
|
command: /tidb-server -store unistore -path "" -lease 0s > tidb.log 2>&1 &
|
|
gaussdb:
|
|
image: 'opengauss/opengauss:7.0.0-RC1.B023'
|
|
hostname: opengauss-server
|
|
ports:
|
|
- "127.0.0.1:9950:5432"
|
|
environment:
|
|
- TZ=Asia/Shanghai
|
|
- GS_PASSWORD=Gaussdb@123
|
|
- GS_CLUSTER_NAME=opengauss_cluster
|
|
- PGDATA=/var/lib/opengauss/data
|
|
entrypoint: ""
|
|
command: |-
|
|
/bin/sh -c 'set -euo pipefail;
|
|
/usr/local/bin/entrypoint.sh gaussdb &
|
|
counter=1;
|
|
while [ "$$counter" -le 20 ]; do
|
|
if su - omm -c "gsql -U omm -d postgres -c \"SELECT 1;\""; then
|
|
echo "Creating database gorm...";
|
|
su - omm -c "gsql -U omm -d postgres -c \"CREATE DATABASE gorm DBCOMPATIBILITY '\'PG\'';\"";
|
|
echo "Database initialized successfully";
|
|
break;
|
|
fi;
|
|
echo "Waiting for database to be ready... ($$counter/12)";
|
|
sleep 5;
|
|
counter=$$(($$counter + 1));
|
|
done;
|
|
# timeout handling
|
|
if [ $$counter -gt 20 ]; then
|
|
echo "Error: Database failed to start within timeout";
|
|
exit 1;
|
|
fi;
|
|
# keep the container running: wait for the database process in the foreground
|
|
wait
|
|
' |