Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilise FTL's native config upgrade functionality #1683

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

PromoFaux
Copy link
Member

What does this PR aim to accomplish?:

Taking inspiration from pi-hole/pi-hole#5830 - we use the new functionality within FTL to ensure V5 configs are properly migrated to V6.

Also taken a couple of tricks to improve the output of the docker container.

Example output from a new v6 container with 5 volumes:

pihole  |   [i] v5 files detected that have not yet been migrated to v6
pihole  | 
pihole  |   [i] Migrating dnsmasq configuration files
pihole  | 
pihole  |   [i] Migrating config to Pi-hole v6.0 format
pihole  |       Reading legacy config files from /etc/pihole/pihole-FTL.conf
pihole  |          PIDFILE: Empty path is not possible, using default
pihole  |          SETUPVARSFILE: Empty path is not possible, using default
pihole  |          GRAVITYDB: Empty path is not possible, using default
pihole  |          WEBROOT: Empty path is not possible, using default
pihole  |          WEBHOME: Empty path is not possible, using default
pihole  |          API_INFO_LOG: Empty path is not possible, using default
pihole  |          WEBDOMAIN: Empty path is not possible, using default
pihole  |       Moving /etc/pihole/pihole-FTL.conf to /etc/pihole/migration_backup_v6/pihole-FTL.conf
pihole  |       Migrating config from /etc/pihole/setupVars.conf
pihole  |       setupVars.conf:WEBPASSWORD -> Setting webserver.api.pwhash to 06eae68f1ca3493598cb993d99a9e64179d6e740627f8426a2bfa9ed9a26733f
pihole  |       setupVars.conf:BLOCKING_ENABLED -> Setting dns.blocking.active to true
pihole  |       setupVars.conf:TEMPERATURE_LIMIT -> Not set
pihole  |       setupVars.conf:TEMPERATURE_UNIT -> Not set
pihole  |       setupVars.conf:WEBUIBOXEDLAYOUT -> Not set
pihole  |       setupVars.conf:WEBTHEME -> Not set
pihole  |       setupVars.conf:PIHOLE_DNS_1 -> Setting dns.upstreams[1] = 8.8.8.8
pihole  |       setupVars.conf:PIHOLE_DNS_2 -> Setting dns.upstreams[2] = 8.8.4.4
pihole  |       setupVars.conf:PIHOLE_DOMAIN -> Not set
pihole  |       setupVars.conf:DNS_FQDN_REQUIRED -> Not set
pihole  |       setupVars.conf:DNS_FQDN_REQUIRED -> Not set
pihole  |       setupVars.conf:DNS_bogusPriv -> Not set
pihole  |       setupVars.conf:DNSSEC -> Not set
pihole  |       setupVars.conf:PIHOLE_INTERFACE -> Setting dns.interface to eth0
pihole  |       setupVars.conf:HOSTRECORD -> Not set
pihole  |       setupVars.conf:DNSMASQ_LISTENING -> Not set
pihole  |       setupVars.conf:REV_SERVER -> Not set
pihole  |       setupVars.conf:DHCP_ACTIVE -> Not set
pihole  |       setupVars.conf:DHCP_START -> Not set
pihole  |       setupVars.conf:DHCP_END -> Not set
pihole  |       setupVars.conf:DHCP_ROUTER -> Not set
pihole  |       setupVars.conf:DHCP_LEASETIME -> Not set
pihole  |       setupVars.conf:DHCP_IPv6 -> Not set
pihole  |       setupVars.conf:DHCP_RAPID_COMMIT -> Not set
pihole  |       setupVars.conf:queryLogging -> Not set
pihole  |       setupVars.conf:GRAVITY_TMPDIR -> Not set
pihole  |       setupVars.conf:WEB_PORTS -> Not set
pihole  |       Moved /etc/pihole/setupVars.conf to /etc/pihole/migration_backup_v6/setupVars.conf
pihole  |       setupVars.conf migration complete
pihole  |       Moving /etc/pihole/custom.list to /etc/pihole/migration_backup_v6/custom.list
pihole  |       Config initialized with webserver ports 80 (HTTP) and 443 (HTTPS), IPv6 support is enabled
pihole  |       Wrote config file:
pihole  |        - 151 total entries
pihole  |        - 145 entries are default
pihole  |        - 6 entries are modified
pihole  |        
pihole  |       Config file written to /etc/pihole/pihole.toml
pihole  | 
pihole  |   [i] Setting up user & group for the pihole user
pihole  |   [i] PIHOLE_UID not set in environment, using default (100)
pihole  |   [i] PIHOLE_GID not set in environment, using default (101)
pihole  | 
pihole  |   [i] Starting FTL configuration
pihole  |   [i] Assigning password defined by Environment Variable
pihole  |   [i] Starting crond for scheduled scripts. Randomizing times for gravity and update checker
pihole  | 
pihole  |   [i] Ensuring logrotate script exists in /etc/pihole
pihole  | 
pihole  |   [i] Gravity migration checks
pihole  |   [i] No adlist file found, creating one with a default blocklist
pihole  |   [i] Existing gravity database found - schema will be upgraded if necessary
pihole  |         Upgrading gravity database from version 15 to 16
pihole  |         Upgrading gravity database from version 16 to 17
pihole  |         Upgrading gravity database from version 17 to 18
pihole  |         Upgrading gravity database from version 18 to 19
pihole  | 
pihole  |   [i] pihole-FTL pre-start checks
pihole  |   [i] Setting capabilities on pihole-FTL where possible
pihole  |   [i] Applying the following caps to pihole-FTL:
pihole  |         * CAP_CHOWN
pihole  |         * CAP_NET_BIND_SERVICE
pihole  |         * CAP_NET_RAW
pihole  |         * CAP_NET_ADMIN
pihole  | 
pihole  |   [i] Starting pihole-FTL (no-daemon) as pihole
pihole  | 
pihole  |   [i] Version info:
pihole  |       Core
pihole  |           Version is efaa0f4 (Latest: null)
pihole  |           Branch is development
pihole  |           Hash is efaa0f42 (Latest: efaa0f42)
pihole  |       Web
pihole  |           Version is 603f35d (Latest: null)
pihole  |           Branch is development
pihole  |           Hash is 603f35d5 (Latest: 603f35d5)
pihole  |       FTL
pihole  |           Version is vDev-d01a265 (Latest: null)
pihole  |           Branch is development
pihole  |           Hash is d01a2652 (Latest: d01a2652)
pihole  | 
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: ########## FTL started on c5127ed948b8! ##########
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: FTL branch: development
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: FTL version: vDev-d01a265
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: FTL commit: d01a2652
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: FTL date: 2025-01-14 18:59:14 +0100
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: FTL user: pihole
pihole  | 2025-01-14 18:17:57.592 GMT [67M] INFO: Compiled for linux/arm64/v8 (compiled on CI) using cc (Alpine 14.2.0) 14.2.0
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO: 2 FTLCONF environment variables found (2 used, 0 invalid, 0 ignored)
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:    [✓] FTLCONF_webserver_api_password is used
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:    [✓] FTLCONF_dns_upstreams is used
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO: Wrote config file:
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:  - 151 total entries
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:  - 145 entries are default
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:  - 6 entries are modified
pihole  | 2025-01-14 18:17:57.683 GMT [67M] INFO:  - 1 entry is forced through environment
pihole  | 2025-01-14 18:17:57.686 GMT [67M] INFO: Parsed config file /etc/pihole/pihole.toml successfully
pihole  | 2025-01-14 18:17:57.686 GMT [67M] WARNING: Insufficient permissions to set process priority to -10 (CAP_SYS_NICE required), process priority remains at 0

Subsequent runs will not display the output messages as the configs will have already been migrated.


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

… to defer the startup of FTL as we were previously doing.

Signed-off-by: Adam Warner <[email protected]>
…fit with the container output. Supress message in FTL migration output about environment variables, as these are not read in until FTLs first proper start

Signed-off-by: Adam Warner <[email protected]>
@PromoFaux PromoFaux requested review from DL6ER and a team January 14, 2025 18:24
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.

1 participant