The zookeeper containers entrypoint will try to switch to the user 'zookeeper' if the container is started with uid '0'. This can cause issues when the uid for the zookeeper user inside the container and the users uid outside the container differ since it will lead to zookeeper getting access denied when trying to read the certificates. This also adds logging configuration to make it easier to debug zookeeper in the future. Change-Id: I51db53fe093a294e804148f682053123f54adfe1
54 lines
1.3 KiB
Bash
Executable File
54 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
cd $(dirname $0)
|
|
SCRIPT_DIR="$(pwd)"
|
|
|
|
# Select docker or podman
|
|
if command -v docker > /dev/null; then
|
|
DOCKER=docker
|
|
elif command -v podman > /dev/null; then
|
|
DOCKER=podman
|
|
else
|
|
echo "Please install docker or podman."
|
|
exit 1
|
|
fi
|
|
|
|
# Select docker-compose or podman-compose
|
|
if command -v docker-compose > /dev/null; then
|
|
COMPOSE=docker-compose
|
|
elif command -v podman-compose > /dev/null; then
|
|
COMPOSE=podman-compose
|
|
else
|
|
echo "Please install docker-compose or podman-compose."
|
|
exit 1
|
|
fi
|
|
|
|
|
|
MYSQL="${DOCKER} exec zuul-test-mysql mysql -u root -pinsecure_worker"
|
|
|
|
if [ "${COMPOSE}" == "docker-compose" ]; then
|
|
docker-compose rm -sf
|
|
else
|
|
podman-compose down
|
|
fi
|
|
|
|
CA_DIR=$SCRIPT_DIR/ca
|
|
|
|
mkdir -p $CA_DIR
|
|
$SCRIPT_DIR/zk-ca.sh $CA_DIR zuul-test-zookeeper
|
|
|
|
export USER_ID=$(id -u)
|
|
${COMPOSE} up -d
|
|
|
|
echo "Waiting for mysql"
|
|
timeout 30 bash -c "until ${MYSQL} -e 'show databases'; do sleep 0.5; done"
|
|
echo
|
|
|
|
echo "Setting up permissions for zuul tests"
|
|
${MYSQL} -e "GRANT ALL PRIVILEGES ON *.* TO 'openstack_citest'@'%' identified by 'openstack_citest' WITH GRANT OPTION;"
|
|
${MYSQL} -u openstack_citest -popenstack_citest -e "SET default_storage_engine=MYISAM; DROP DATABASE IF EXISTS openstack_citest; CREATE DATABASE openstack_citest CHARACTER SET utf8;"
|
|
|
|
echo "Finished"
|