Fix a bug with starting services on device reboot (#212)

This commit is contained in:
Evgeniy Antonyuk 2024-04-22 18:15:11 +07:00 committed by GitHub
parent b9097d5ef1
commit a3947ac070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1316,6 +1316,7 @@ install_elasticsearch () {
install_fluent_bit () {
if [ "$INSTALL_FLUENT_BIT" == "true" ]; then
curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
systemctl enable fluent-bit
if systemctl list-unit-files --type=service | grep -q "fluent-bit.service"; then
sed -i "s/OPENSEARCH_SCHEME/$(get_env_parameter "ELK_SHEME")/g" "${BASE_DIR}/config/fluent-bit.conf"
@ -1326,6 +1327,13 @@ install_fluent_bit () {
cp -rf ${BASE_DIR}/config/fluent-bit.conf /etc/fluent-bit/fluent-bit.conf
systemctl restart fluent-bit
DOCKER_SYSTEMD_DIR="/etc/systemd/system/docker.service.d"
if [ ! -f "${DOCKER_SYSTEMD_DIR}/fluent-after.conf" ]; then
mkdir -p ${DOCKER_SYSTEMD_DIR}
echo -e "[Unit]\n$(grep After= $(systemctl show -p FragmentPath docker.service | awk -F= '{print $2}')) fluent-bit.service" > "${DOCKER_SYSTEMD_DIR}/fluent-after.conf"
systemctl daemon-reload
fi
DOCKER_DAEMON_FILE="/etc/docker/daemon.json"
if [[ ! -f "${DOCKER_DAEMON_FILE}" ]]; then
echo "{\"log-driver\": \"fluentd\", \"log-opts\": { \"fluentd-address\": \"127.0.0.1:24224\" }}" > "${DOCKER_DAEMON_FILE}"