Commit 5f9aaa37 authored by Ophélie Gagnard's avatar Ophélie Gagnard

installation/automation-script.sh: Update with new macros. Remove "on-the-go"...

installation/automation-script.sh: Update with new macros. Remove "on-the-go" flb.conf.in. Clean up a bit.
parent 929fc154
...@@ -7,15 +7,28 @@ ...@@ -7,15 +7,28 @@
LOG_FILE=/var/log/test-script-deployment.log LOG_FILE=/var/log/test-script-deployment.log
# redirect stdout and stderr to $LOG_FILE # redirect stdout and stderr to $LOG_FILE
exec >> $LOG_FILE 2>&1 exec >> "$LOG_FILE" 2>&1
### INSTALL DEPENDENCIES if [ -z "$WENDELIN_URL" ]; then
WENDELIN_REFERENCE=test-suite-001 echo ERROR: Variable WENDELIN_URL undefined.
WENDELIN_PWD=qxrfkwod echo Exiting.
exit
fi
if [ -z "$WENDELIN_PWD" ]; then
echo ERROR: Variable WENDELIN_PWD undefined.
echo Exiting.
exit
fi
if [ -z "$WENDELIN_REFERENCE" ]; then
echo ERROR: Variable WENDELIN_REFERENCE undefined.
echo Exiting.
exit
fi
### INSTALL DEPENDENCIES ###
MCA_NAME_AND_VERSION=dep--mca--static_1-1 MCA_NAME_AND_VERSION=dep--mca--static_1-1
FLUENTBIT_NAME_AND_VERSION=dep--fluent-bit_1-1 FLUENTBIT_NAME_AND_VERSION=dep--fluent-bit_1-1
URL_PATTERN="https://download.opensuse.org/repositories/home:/fg.nxd/Debian_11/amd64/" URL_PATTERN="https://download.opensuse.org/repositories/home:/oph.nxd/Debian_11/amd64/"
APT_UTILITY_PACKAGES="sudo wget tree" APT_UTILITY_PACKAGES="sudo wget tree"
INSTALL_DEPENDENCIES_PACKAGES="dracut-core dracut dracut-network" INSTALL_DEPENDENCIES_PACKAGES="dracut-core dracut dracut-network"
...@@ -29,48 +42,28 @@ FLUENTBIT_PACKAGE_URL=${URL_PATTERN}${FLUENTBIT_PACKAGE_FILE} ...@@ -29,48 +42,28 @@ FLUENTBIT_PACKAGE_URL=${URL_PATTERN}${FLUENTBIT_PACKAGE_FILE}
FLB_PATH=/opt/${FLUENTBIT_NAME_AND_VERSION} FLB_PATH=/opt/${FLUENTBIT_NAME_AND_VERSION}
MCA_PATH=/opt/${MCA_NAME_AND_VERSION} MCA_PATH=/opt/${MCA_NAME_AND_VERSION}
MCA_CONF_PATH=${MCA_PATH}/etc/ MCA_CONF_PATH=${MCA_PATH}/etc
echo -e "\nInstalling packages from Debian repositories...\n" echo -e "\nInstalling packages from Debian repositories...\n"
# utility packages ## Utility packages
apt -y install ${APT_UTILITY_PACKAGES} apt -y install $APT_UTILITY_PACKAGES
# specific packages ## Specific packages
apt -y install ${APT_SPECIFIC_PACKAGES} apt -y install $APT_SPECIFIC_PACKAGES
# our own packages ## Packages to scan
apt -y install $PACKAGES_TO_SCAN
## Our own packages
echo -e "\nDownloading packages from OBS repositories...\n" echo -e "\nDownloading packages from OBS repositories...\n"
wget ${MCA_PACKAGE_URL} wget "$MCA_PACKAGE_URL"
wget ${FLUENTBIT_PACKAGE_URL} wget "$FLUENTBIT_PACKAGE_URL"
echo -e "\nInstalling packages from OBS repositories...\n" echo -e "\nInstalling packages from OBS repositories...\n"
apt -y install ./${MCA_PACKAGE_FILE} apt -y install "./$MCA_PACKAGE_FILE"
apt -y install ./${FLUENTBIT_PACKAGE_FILE} apt -y install "./$FLUENTBIT_PACKAGE_FILE"
# temporary: while the fluent-bit packages does not come with its own template file "etc/flb.conf.in"
cat > ${MCA_CONF_PATH}flb.conf.in << "EOF"
[SERVICE]
flush 5
[INPUT]
name tail
path /var/log/metadata_collect.log
refresh_interval 2
[output]
name fluentbit_wendelin
match *
streamtool_uri https://softinst157546.host.vifib.net/erp5/portal_ingestion_policies/metadata_upload
user zope
password %WENDELIN_PWD%
buffer_type memory
flush_interval 60s
disable_retry_limit true
reference %WENDELIN_REFERENCE%
EOF
CONF_REGEX="s|%WENDELIN_REFERENCE%|${WENDELIN_REFERENCE}|g;s|%WENDELIN_PWD%|${WENDELIN_PWD}|g" CONF_REGEX="s|%WENDELIN_REFERENCE%|${WENDELIN_REFERENCE}|g;s|%WENDELIN_PWD%|${WENDELIN_PWD}|g"
sed "${CONF_REGEX}" ${MCA_CONF_PATH}/flb.conf.in > ${MCA_CONF_PATH}/flb.conf sed "${CONF_REGEX}" "${MCA_CONF_PATH}/flb.conf.in" > "${MCA_CONF_PATH}/flb.conf"
### SCAN THE DESIRED DIRECTORIES ### SCAN THE DESIRED DIRECTORIES ###
BINARY=${MCA_PATH}/bin/metadata-collect-agent BINARY=${MCA_PATH}/bin/metadata-collect-agent
FLB=${FLB_PATH}/bin/fluent-bit FLB=${FLB_PATH}/bin/fluent-bit
FLB_PLUGIN=${MCA_PATH}/lib/libfluentbit_wendelin.so FLB_PLUGIN=${MCA_PATH}/lib/libfluentbit_wendelin.so
...@@ -79,10 +72,10 @@ LOG=/var/log/metadata_collect.log ...@@ -79,10 +72,10 @@ LOG=/var/log/metadata_collect.log
PATH_TO_SCAN=/bin PATH_TO_SCAN=/bin
echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n" echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n"
${BINARY} ${PATH_TO_SCAN} ${FLB} ${FLB_PLUGIN} ${FLB_CONF} ${LOG} "$BINARY" "$PATH_TO_SCAN" "$FLB" "$FLB_PLUGIN" "$FLB_CONF" "$LOG"
PATH_TO_SCAN=/sbin PATH_TO_SCAN=/sbin
echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n" echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n"
${BINARY} ${PATH_TO_SCAN} ${FLB} ${FLB_PLUGIN} ${FLB_CONF} ${LOG} "$BINARY" "$PATH_TO_SCAN" "$FLB" "$FLB_PLUGIN" "$FLB_CONF" "$LOG"
echo -e "\nBuild successful, connect to:\n" echo -e "\nBuild successful, connect to:\n"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment