From: Peter Korsgaard <peter@korsgaard.com>
To: Thomas Devoogdt <thomas@devoogdt.com>
Cc: Thomas Devoogdt <thomas.devoogdt@barco.com>,
Samuel Martin <s.martin49@gmail.com>,
Grim Delcour <grim.delcour@barco.com>,
Anton Danneels <anton.danneels@barco.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2] package/fluent-bit: add new package
Date: Mon, 23 Jan 2023 17:11:48 +0100 [thread overview]
Message-ID: <87edrl9qnv.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20230123135253.1733981-1-thomas.devoogdt@barco.com> (Thomas Devoogdt's message of "Mon, 23 Jan 2023 14:52:53 +0100")
>>>>> "Thomas" == Thomas Devoogdt <thomas@devoogdt.com> writes:
> Fluent Bit is a super fast, lightweight, and highly
> scalable logging and metrics processor and forwarder.
> Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Now we just miss the change summary ;)
> +++ b/package/fluent-bit/S99fluent-bit
> @@ -0,0 +1,55 @@
> +#!/bin/sh
> +#
> +# Starts fluent-bit.
> +#
> +NAME=fluent-bit
> +DAEMON=/usr/bin/$NAME
check-package complains about this:
http://nightly.buildroot.org/#adding-packages-start-script
There are also some shellcheck warnings.
> +PID_FILE="/var/run/$NAME.pid"
> +CONF_FILE="/etc/$NAME/$NAME.conf"
> +
> +[ -r /etc/default/$NAME ] && . /etc/default/$NAME
> +
> +start() {
> + printf "Starting fluent-bit: "
> + start-stop-daemon -S -q -b -m -p $PID_FILE --exec $DAEMON -- -c $CONF_FILE
> + [ $? = 0 ] && echo "OK" || echo "FAIL"
> +}
> +
> +stop() {
> + printf "Stopping fluent-bit: "
> + start-stop-daemon -K -q -p $PID_FILE
> + # https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/yaml/configuration-file#config_section
> + # The default grace time is set to 5 seconds, so use 6 seconds to have some margin.
> + TIMEOUT=6
> + PID=$(cat $PID_FILE 2>/dev/null)
> + while kill -0 $PID 2>/dev/null; do
> + [ $TIMEOUT -eq 0 ] && echo "FAIL" && return 1
> + TIMEOUT=$((TIMEOUT - 1))
> + sleep 1
> + done
> + rm -f $PID_FILE
So the pidfile is not removed on timeouts. Is that on purpose?
> +++ b/package/fluent-bit/fluent-bit.mk
> @@ -0,0 +1,43 @@
> +################################################################################
> +#
> +# fluent-bit
> +#
> +################################################################################
> +
> +FLUENT_BIT_VERSION = 2.0.8
> +FLUENT_BIT_SITE = $(call github,fluent,fluent-bit,v$(FLUENT_BIT_VERSION))
> +FLUENT_BIT_LICENSE = Apache-2.0
> +FLUENT_BIT_LICENSE_FILES = LICENSE
> +FLUENT_BIT_DEPENDENCIES = host-bison host-flex libyaml libopenssl
> +
> +FLUENT_BIT_CONF_OPTS += \
> + -DFLB_DEBUG=No \
> + -DFLB_RELEASE=Yes \
> + -DFLB_EXAMPLES=No \
> + -DFLB_CHUNK_TRACE=No \
> + -DFLB_BACKTRACE=No \
> + -DFLB_LUAJIT=No
> +
> +# Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
> +# large file support.
> +# See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information.
> +FLUENT_BIT_CONF_OPTS += \
> + -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
> + -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS"
> +
> +# Move the config files from /usr/etc/ to /etc/.
> +FLUENT_BIT_CONF_OPTS += \
> + -DCMAKE_INSTALL_SYSCONFDIR="/etc/"
Where do you see that it gets set to /usr/etc/? I just dropped this and
ran the configure script and I ended up with the normal:
grep SYSCONFDIR build/fluent-bit-2.0.8/CMakeCache.txt
CMAKE_INSTALL_SYSCONFDIR:PATH=etc
//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR
CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1
And indeed, building it I don't see any references to /usr/etc:
strings build/fluent-bit-2.0.8/bin/fluent-bit | grep /etc
/etc/machine-id
/etc/ssl/certs/ca-bundle.crt
/etc/ssl/certs/
/etc/hosts
/etc/resolv.conf
/etc/nsswitch.conf
/etc/host.conf
/etc/svc.conf
I do see that it gets confused and ends up installing the default config
files in usr/etc/fluent-bit. I don't right away see why this is so, but
indeed explicitly setting it to /etc fixes that. Notice that it does
lead to an invalid service file:
https://github.com/fluent/fluent-bit/issues/6619
So maybe a better fix is to just move the files in a post-install hook?
> +define FLUENT_BIT_POST_INSTALL_TARGET_HOOK
> + cp -dpf $(@D)/lib/libminiz*.so* $(TARGET_DIR)/usr/lib/
> +endef
> +
> +FLUENT_BIT_POST_INSTALL_TARGET_HOOKS += FLUENT_BIT_POST_INSTALL_TARGET_HOOK
Again, why not just build with -DBUILD_SHARED_LIBS=OFF?
I see that the package installs a shared library in a custom
location:
target/usr/lib/fluent-bit/libfluent-bit.so
What is that used for / how does it find it? I see there is a
FLB_SHARED_LIB option to disable it.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-01-23 16:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 13:52 [Buildroot] [PATCH v2] package/fluent-bit: add new package Thomas Devoogdt
2023-01-23 16:11 ` Peter Korsgaard [this message]
2023-01-23 16:32 ` Thomas Devoogdt
2023-01-23 16:58 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edrl9qnv.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=anton.danneels@barco.com \
--cc=buildroot@buildroot.org \
--cc=grim.delcour@barco.com \
--cc=s.martin49@gmail.com \
--cc=thomas.devoogdt@barco.com \
--cc=thomas@devoogdt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.