stevejenkins / pihole-cloudsync

Syncs blocklists, blacklists, and whitelists across multiple Pi-holes using a private GitHub repo
MIT License
517 stars 104 forks source link

Docker Compatibility & Automatic Git Dir Variable #28

Open Banner-Keith opened 3 years ago

Banner-Keith commented 3 years ago

This is a continuation of #18 by @IarwainBen-adar

I noticed that there had been no response there for 25 days, and there were some merge conflicts.

I pulled this down and created a branch to work from. This is the sum of my changes added to the changes that @IarwaiBen-adar had made.

I have tested it with Pi-Hole v5 running in docker. I have a docker container running in UnRAID as the master, and a container on a Raspberrry Pi as a downstream pi-hole. Push and Pull is working great.

I also made it so that you don't have to set the personal_git_dir repo as it will be set automatically based on the location of the pihole-cloudsync script. It works regardless of where you are when you execute the script.

With this change you also don't need to change the pihole_dir or dnsmasq_dir paths if you are running in a container. It will look for those paths inside of the container and find the mapped volume outside of the container.

I am very open to feedback if you see anything that you don't like or anything that makes it more difficult for those not running a container. I don't have that setup to test, but I don't see anything in my changes that would have a negative impact on non-docker users.

The way that @IarwainBen-adar had this set up was to auto-detect if there is a pihole docker container. If we wanted we could have that be a flag that is passed, but I think this solution is fine since it is very unlikely that someone would have an active pihole container and a local install since they can't both be on port 53.

stevejenkins commented 10 months ago

Well phooey. Looks like it has a conflict with the head branch.