Skip to content

Conversation

shaerpour
Copy link

@shaerpour shaerpour commented Jan 2, 2024

Description

This PR is completed version of #8330 that is closed. In Debian packages, we have maintainer scripts with (prerm, preinst, postrm and postinst) extensions that will run before or after extracting and installing package. They will do important tasks like adding user or creating directories for main app to run correctly.

Issues

The issue with fluent-bit deb packages is that it does not have this scripts so if someone activates and enables fluent-bit, after purging or removing package the OS still shows package is running and it can make issues during boot, etc.

Solution

In this branch, I added prerm, postinst and postrm scripts for resolving issue. Scripts are built with debhelper collection and customized some parts for better performance.

I already built and installed packages for ubuntu/20.04, debian/bullseye and debian/bookworm and they work totally fine.

Troubles

As mentioned, debhelper is a collection of tools for building deb packages. It creates different parts like maintainer scripts, systemd services and etc.
But the main problem was to match CPACK with it! They are different platforms for making deb packages and doing their own work so I couldn't connect them. I used CPackDebHelper inside fluent-bit codes but it just conflicts in many parts. At the end, I just built scripts with it and added statically in cpack/debian directory to be copied and used by systemd.

@aminvakil
Copy link

CI has failed:

NMAKE : fatal error U1052: file 'Makefile' not found
Stop.
Test project C:/projects/fluent-bit-2e87g/build
No tests were found!!!

@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch 3 times, most recently from 346b8d0 to 0732c52 Compare January 2, 2024 10:41
@patrick-stephens
Copy link
Contributor

Is there any impact on the RPM packages and/or should we be doing the same?
It sounds like some kind of dirty state is left so it probably needs fixing for RPMs as well, which have an identical mechanism.

@shaerpour
Copy link
Author

shaerpour commented Jan 9, 2024

Is there any impact on the RPM packages and/or should we be doing the same? It sounds like some kind of dirty state is left so it probably needs fixing for RPMs as well, which have an identical mechanism.

I'm working on that but it needs more research, so it can take some time for building and deploying scripts. I will send another PR for them in the close future but it would be great if we fix debian packages sooner. @patrick-stephens

@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch 2 times, most recently from 12699e7 to e1df359 Compare January 9, 2024 06:25
@aminvakil
Copy link

I'd suggest merging this PR if it fixes the package for deb users and let another rpm users send another PR, as we (me and @ahspw) do not have that much experience in rpm-based distros and it would be much better if someone with expertise and motivation in that scope creates a new PR about that.

@patrick-stephens
Copy link
Contributor

I think the commits have gone a bit wonky rather than be rebased

Copy link
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label May 21, 2024
@aminvakil
Copy link

@shaerpour Please tell me if you do not have time for this and want me to take over this PR.

Although this PR is good to go AFAICS and needs a maintainer attention.

@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch from a65bd53 to a16b81f Compare May 28, 2024 19:06
@github-actions github-actions bot removed the Stale label Jun 8, 2024
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Dec 14, 2024
@aminvakil
Copy link

This comment is only meant to prevent closing the PR.

@github-actions github-actions bot removed the Stale label Dec 25, 2024
@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch from a16b81f to d28c58c Compare January 8, 2025 16:26
@patrick-stephens patrick-stephens added the ok-package-test Run PR packaging tests label Jan 9, 2025
@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch from d28c58c to 762e5bb Compare January 29, 2025 19:00
@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch 2 times, most recently from 98e1df0 to 1d75a9b Compare May 19, 2025 08:41
shaerpour added 3 commits May 19, 2025 12:14
Signed-off-by: shaerpour <amirhosseinshaerpour1@gmail.com>
Signed-off-by: shaerpour <amirhosseinshaerpour1@gmail.com>
Signed-off-by: shaerpour <amirhosseinshaerpour1@gmail.com>
@shaerpour shaerpour force-pushed the apt-maintainer-script-implementation branch from 1d75a9b to e8f3107 Compare May 19, 2025 08:45
@patrick-stephens
Copy link
Contributor

patrick-stephens commented May 19, 2025

The changes look fine to me but I would ask that you test with the actual built binaries made in CI here to confirm? I know you've done it locally but just as a sanity check to confirm that how we build in CI does not impact anything.

There should be a list of "artifacts" attached to the PR build job: https://github.com/fluent/fluent-bit/actions/runs/15108458656?pr=8341
Hopefully it is obvious which is for each platform but you can also get the direct URL for the uploaded package from each matrix job, e.g. the upload... step in this job will print out what the URL is for the package: https://github.com/fluent/fluent-bit/actions/runs/15108458656/job/42477763540?pr=8341

### END INIT INFO

PATH=/opt/fluent-bit/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/fluent-bit/bin/fluent-bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is actually configurable via cmake

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since I've seen an init script - just to confirm this will not break RPM builds or affect them in any way? I know you're focusing on Debian but we still have to make sure there is no impact on others.

@shaerpour
Copy link
Author

Dear @patrick-stephens

Thank you for your reviewing. It's been a long time since I opened this PR and I don't exactly remember. I'm pretty sure that it wont affect other distro types but I will test again and inform you.

Copy link
Contributor

github-actions bot commented Sep 6, 2025

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Sep 6, 2025
@aminvakil
Copy link

@shaerpour Do you still want to work on this PR and are you going to test other distro types?

@shaerpour
Copy link
Author

Dear @aminvakil

Unfortunately I can't continue work on this PR. You can take it over if you are interested.

@aminvakil aminvakil mentioned this pull request Sep 6, 2025
6 tasks
@aminvakil
Copy link

@shaerpour Thanks, I had created #10844 on top of your commits and will continue to work on that, this can be closed.

Thank you again for your work on this!

@shaerpour shaerpour closed this Sep 6, 2025
@shaerpour shaerpour deleted the apt-maintainer-script-implementation branch September 6, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants