Skip to content

Conversation

@PromoFaux
Copy link
Member

What does this PR aim to accomplish?:

This PR take a little logic from #1932, and a little from #1934

Both are good ideas, but I want to combine and tweak them a little. For example, I do not want to use the pihole-FTL wait-for command, as it does not quite suit the purpose we are looking for, but I do want to exit the container if FTL has not started within 30 seconds - else it will just hang.

I also like the idea of reading the FTL log filesize on container start, and then basing all interaction with the log file from that point onwards.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

  • I have read the above and my PR is ready for review. Check this box to confirm

…ng FTL. We will use this as a starting point to:

 - Check that FTL has started when grepping for the "FTL Started" string
 - Position to start tailing from when streaming the log file

We wait for a maximum of 30 seconds for FTL to start, else we exit the container

Co-authored-by: yubiuser <github@yubiuser.dev>
Co-authored-by: casperklein <casperklein@users.noreply.github.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
rdwebdesign
rdwebdesign previously approved these changes Nov 6, 2025
Copy link
Member

@rdwebdesign rdwebdesign left a comment

Choose a reason for hiding this comment

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

Looks like this is working as expected.

@dschaper
Copy link
Member

dschaper commented Nov 6, 2025

Is this for a new container with a new and empty volume or for updated containers with a previously used volume?

@PromoFaux
Copy link
Member Author

Little from column a), little from column b).

It takes into account:

  • New containers (log position will be 0)
  • Containers that have been stopeed and started (but not destroyed)
  • Containers that host mount the log directory.

@dschaper
Copy link
Member

dschaper commented Nov 6, 2025

++ getFTLConfigValue files.log.ftl
++ pihole-FTL --config -q files.log.ftl
+ FTLlogFile=/var/log/pihole/FTL.log
+ local startFrom
++ stat -c%s /var/log/pihole/FTL.log
+ startFrom=7050
+ echo '  [i] Starting pihole-FTL (no-daemon) as pihole'
  [i] Starting pihole-FTL (no-daemon) as pihole
+ echo ''

+ CAPSH_PID=413
+ capsh --user=pihole --keep=1 -- -c '/usr/bin/pihole-FTL no-daemon >/dev/null'
+ + timeout 30 grep tail -q -F -c +7051 -- /var/log/pihole/FTL.log
'########## FTL started'
2025-11-06 19:21:17.808 UTC [416M] INFO: ########## FTL started on 5bd113d534f7! ##########

Looks like it does what it says. I'm not sure how to test the 30 second timeout failure though?

@PromoFaux
Copy link
Member Author

PromoFaux commented Nov 6, 2025

I'm not sure how to test the 30 second timeout failure though?

Change the search for string to something impossible to find and then build the image and run it again - it should timeout

image

Co-authored-by: Dan Schaper <dan.schaper@pi-hole.net>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
@PromoFaux PromoFaux merged commit 36bbaae into development Nov 6, 2025
24 of 26 checks passed
@PromoFaux PromoFaux deleted the improve_startup branch November 6, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants