I am strongly determined to pre-populate my pihole mounts using a git repository. My motivation is to manage my server infrastructure and configuration via a DevOps approach.
A local reset! Such a good idea! No need to backup existing files, due to GitOps!
commands used on pihole-1 and pihole-2
cd /srv/pihole
docker compose --file /srv/pihole/compose.yaml down
sudo rm -r /srv/pihole/etc-dnsmasq.d
sudo rm -r /srv/pihole/etc-pihole
ls -lha
git status;git stash push;git rebase --reset
ls -lha
docker compose up --detach
sleep 60
docker compose logs
git status
resulting permissions pihole-1
./etc-dnsmasq.d:
total 32K
drwxr-xr-x 2 idsvc idsvc 4.0K Jul 11 14:48 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul 11 14:48 ..
-rw-r--r-- 1 root root 1.5K Jul 11 14:48 01-pihole.conf
-rw-r--r-- 1 root root 523 Jul 11 14:48 02-pihole-dhcp.conf
-rw-r--r-- 1 idsvc idsvc 1.1K Jul 11 14:48 04-pihole-static-dhcp.conf
-rw-r--r-- 1 idsvc idsvc 2.2K Jul 11 14:48 05-pihole-custom-cname.conf
-rw-r--r-- 1 root root 2.2K Jul 11 14:48 06-rfc6761.conf
-rw-r--r-- 1 idsvc idsvc 269 Jul 11 14:48 07-id-custom.conf
./etc-pihole:
total 400K
drwxrwxr-x 3 999 idsvc 4.0K Jul 11 14:55 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul 11 14:48 ..
-rw-r--r-- 1 idsvc idsvc 896 Jul 11 14:48 custom.list
-rw-r--r-- 1 999 idsvc 0 Jul 11 14:48 dhcp.leases
-rw-r--r-- 1 root root 651 Jul 11 14:48 dns-servers.conf
-rw-rw-r-- 1 999 idsvc 96K Jul 11 14:48 gravity.db
-rw-rw-r-- 1 999 idsvc 92K Jul 11 14:48 gravity_old.db
-rw-r--r-- 1 root root 65 Jul 11 14:48 local.list
-rw-r--r-- 1 root root 241 Jul 11 14:48 logrotate
-rw-rw-r-- 1 999 root 177 Jul 11 14:48 pihole-FTL.conf
-rw-rw-r-- 1 999 idsvc 164K Jul 11 14:55 pihole-FTL.db
-rw-r--r-- 1 root root 583 Jul 11 14:48 setupVars.conf
-rw-r--r-- 1 root root 27 Jul 11 14:48 setupVars.conf.update.bak
-rw-r--r-- 1 root root 382 Jul 11 14:49 versions
resulting permissions pihole-2
./etc-dnsmasq.d:
total 24
-rw-r--r-- 1 0 0 1507 Jul 11 14:54 01-pihole.conf
-rw-r--r-- 1 0 0 523 Jul 11 14:54 02-pihole-dhcp.conf
-rw-r--r-- 1 1000 1000 1103 Jul 11 14:52 04-pihole-static-dhcp.conf
-rw-r--r-- 1 1000 1000 2152 Jul 11 14:52 05-pihole-custom-cname.conf
-rw-r--r-- 1 0 0 2190 Jul 11 14:53 06-rfc6761.conf
-rw-r--r-- 1 1000 1000 269 Jul 11 14:52 07-id-custom.conf
./etc-pihole:
total 308
-rw-r--r-- 1 1000 1000 896 Jul 11 14:52 custom.list
-rw-r--r-- 1 999 1000 0 Jul 11 14:54 dhcp.leases
-rw-r--r-- 1 0 0 651 Jul 11 14:53 dns-servers.conf
-rw-rw-r-- 1 999 1000 98304 Jul 11 14:55 gravity.db
-rw-rw-r-- 1 999 1000 94208 Jul 11 14:54 gravity_old.db
-rw-r--r-- 1 0 0 65 Jul 11 14:55 local.list
-rw-r--r-- 1 0 0 241 Jul 11 14:53 logrotate
-rw-rw-r-- 1 999 0 177 Jul 11 14:54 pihole-FTL.conf
-rw-rw-r-- 1 999 1000 81920 Jul 11 14:57 pihole-FTL.db
-rw-r--r-- 1 0 0 583 Jul 11 14:55 setupVars.conf
-rw-r--r-- 1 0 0 27 Jul 11 14:54 setupVars.conf.update.bak
-rw-r--r-- 1 0 0 357 Jul 11 14:56 versions
Results
- No issues in
docker compose logs
- Dashboard shows queries only from when container was restarted
- Long Term Data | Graphics | Today shows results from restart NEW
- Tools | Generate debug log | Execute database integrity check completed NEW
The only issue I can see is that the long term data does not show anything BEFORE today. The databases may be large, but the system cannot show them.
Here are the debug tokens for each host:
It looks like a hard reset resolved the issues as the container set up the essential items, and just the additional configuration elements that are part of my repository were used but not touched.
For reference, my repository folder structure for my pi-hole containers looks like this:
/srv/pihole:
.env.example # settings for each server
compose.yaml # docker compose file
/srv/pihole/etc-dnsmasq.d:
04-pihole-static-dhcp.conf # list of devices that need a static dhcp lease
05-pihole-custom-cname.conf # list of cnames for local subdomains
07-id-custom.conf # dhcp-options for dnsmasq
/srv/pihole/etc-pihole:
custom.list # local a records
I copy .env.example
to .env
and edit the environment file to add the password, then start the container.
The only thing missing is the ability to import an adlist as configuration but I know that went away.
Thank you @Bucking_Horn - this was a great help. The only issue now appears to be permissions on the SQLite3 database contents. I could fire up an Adminer container and see if I can poke around to see what the issue is, but I'll ask the community first if there's a way to fix this.