mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
178fce0893
Relates to https://github.com/orgs/hasura/projects/142#card-65243091 and https://github.com/hasura/graphql-engine-mono/pull/1862. Issue: Citus test failing on [error message diff](https://app.circleci.com/pipelines/github/hasura/graphql-engine-mono/14388/workflows/4081512d-b443-4862-859b-2f081dd5f6e6/jobs/256507). Cause: I forgot to specify a tag when running the Citus Docker image 🤦 thanks to @codingkarthik for updating the error message, this PR follows that one to pin the tag to avoid failures like this in future. https://github.com/hasura/graphql-engine-mono/pull/1863 Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com> GitOrigin-RevId: 7f5180f8ecdffca3dbcb0eba57037fb15a2b5980
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
### This file is not meant to be run directly, but to be sourced from
|
|
### the dev script. It defines all the functions required to run a
|
|
### citus docker container.
|
|
|
|
|
|
######################
|
|
# Configuration #
|
|
######################
|
|
|
|
if [ "$MODE" = "test" ]; then
|
|
CITUS_PORT=55432
|
|
else
|
|
CITUS_PORT=65432
|
|
fi
|
|
|
|
CITUS_PASSWORD=hasuraCITUS2
|
|
CITUS_CONTAINER_NAME="hasura-dev-citus-single-$CITUS_PORT"
|
|
CITUS_DB_URL="postgres://postgres:$CITUS_PASSWORD@127.0.0.1:$CITUS_PORT/postgres"
|
|
CITUS_DB_DOCKER_URL="postgres://postgres:$CITUS_PASSWORD@127.0.0.1:5432/postgres"
|
|
CITUS_DOCKER="docker exec -u postgres -it $CITUS_CONTAINER_NAME psql $CITUS_DB_DOCKER_URL"
|
|
|
|
|
|
######################
|
|
# Functions #
|
|
######################
|
|
|
|
function citus_launch_container(){
|
|
echo_pretty "Launching Citus container: $CITUS_CONTAINER_NAME"
|
|
docker run \
|
|
--name "$CITUS_CONTAINER_NAME" \
|
|
-p 127.0.0.1:"$CITUS_PORT":5432 \
|
|
--expose="$CITUS_PORT" \
|
|
-e POSTGRES_PASSWORD="$CITUS_PASSWORD" \
|
|
-d citusdata/citus:10.1
|
|
}
|
|
|
|
function citus_wait {
|
|
echo -n "Waiting for citus to come up"
|
|
until ( $CITUS_DOCKER -c "SELECT * FROM citus_version();" ) &>/dev/null; do
|
|
echo -n '.' && sleep 0.2
|
|
done
|
|
echo " Ok"
|
|
}
|
|
|
|
function citus_cleanup(){
|
|
echo_pretty "Removing $CITUS_CONTAINER_NAME and its volumes in 5 seconds!"
|
|
echo_pretty " PRESS CTRL-C TO ABORT removal of all containers, or ENTER to clean up right away"
|
|
read -t5 || true
|
|
docker stop "$CITUS_CONTAINER_NAME"
|
|
docker rm -v "$CITUS_CONTAINER_NAME"
|
|
}
|