Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions github-actions-tests/tools/zabbix_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ ZBX_VERSION_MAJOR=${ZBX_VERSION_ARRAY[0]}
ZBX_VERSION_MINOR=${ZBX_VERSION_ARRAY[1]}

OLD_ZABBIX=" "
if ((ZBX_VERSION_MAJOR <= 4))
if ((ZBX_VERSION_MAJOR < 4))
then
if ((ZBX_VERSION_MINOR <= 2))
then
OLD_ZABBIX=" --old-zabbix "
fi
OLD_ZABBIX=" --old-zabbix "
fi

echo && echo "------> mamonsu zabbix version"
Expand Down
29 changes: 26 additions & 3 deletions github-actions-tests/zbx_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,37 @@ esac
done

echo "================================================================================================================="
sudo mkdir 775 -p /docker/zabbix-docker/
sudo mkdir -m 775 -p /docker/zabbix-docker/
cd /docker/zabbix-docker/ 2>&1 1>/dev/null
sudo wget https://github.com/zabbix/zabbix-docker/archive/refs/tags/${ZBX_VERSION}.zip
sudo unzip ${ZBX_VERSION}.zip
cd zabbix-docker-${ZBX_VERSION} 2>&1 1>/dev/null
echo "---> Setting up docker with Zabbix ${ZBX_VERSION}..."
# docker-compose dirty hack: it uses only file named 'docker-compose.yml'
yes | sudo cp docker-compose_v3_alpine_mysql_latest.yaml docker-compose.yml

# Pin MySQL to 8.0.33 to avoid mysql_native_password deprecation in 8.0.34+
sudo sed -i 's/mysql:8\.0/mysql:8.0.33/g' docker-compose.yml

# Replace MYSQL_ROOT_PASSWORD_FILE with plain MYSQL_ROOT_PASSWORD to avoid:
# - "Secret file not found" in Zabbix 6.0+ web container (secret not mounted)
# - "Both X and X_FILE are set" in MySQL 8.0.46+ entrypoint
# 6.4+ compose files also set _FILE in environment: sections.
sudo sed -i 's/^\(MYSQL_ROOT_PASSWORD_FILE=.*\)/# \1/' env_vars/.env_db_mysql
sudo sed -i 's/^# MYSQL_ROOT_PASSWORD=$/MYSQL_ROOT_PASSWORD=root_pwd/' env_vars/.env_db_mysql
sudo sed -i 's/MYSQL_ROOT_PASSWORD_FILE=\/run\/secrets\/MYSQL_ROOT_PASSWORD/MYSQL_ROOT_PASSWORD=root_pwd/' compose_databases.yaml 2>/dev/null

docker-compose -f ./docker-compose.yml up -d
# wait for full set up
sleep 1m

echo "---> Waiting for Zabbix ..."
WAITED=0
until curl -sf http://localhost:80/ > /dev/null 2>&1; do
sleep 5
WAITED=$((WAITED + 5))
if [ $WAITED -ge 300 ]; then
echo "ERROR: Zabbix not ready after 300s"
docker-compose -f ./docker-compose.yml ps
docker-compose -f ./docker-compose.yml logs --tail=20
exit 1
fi
done