A docker-compose file to provide a set of service included a secure Pi-hole, monitoring, and download services
-
Clone the project to local
git clone https://github.com/zeuxisoo/my-dns-pi.git
-
Enter to the project directory
cd my-dns-pi
-
Edit the docker variable in
.env
filevim .env
If you want to find the current user id
id username
-
Change service related data permission
sudo chown -Rf 65534:65534 etc/dnscrypt-proxy/config sudo chown -Rf 65534:65534 etc/prometheus/data sudo chown -Rf 65534:65534 etc/alert-manager/data sudo chown -Rf 472:472 etc/grafana/data
-
Setup config file for AlertManager
Create the config file
cp etc/alert-manager/conf/config.yml.example etc/alert-manager/conf/config.yml
Edit the config file content
vim etc/alert-manager/conf/config.yml
-
Setup config file for DoT domain in Caddy server
Create the config file
cp etc/caddy/sites/dot.domain.conf.example etc/caddy/sites/your.domain.conf
Edit the config file content
vim etc/caddy/sites/your.domain.conf
-
Setup TLS certification path in CoreDNS config file
Create the config file
cp etc/coredns/Corefile.example etc/coredns/Corefile
Edit the config file content
vim etc/coredns/Corefile
-
Create docker networks
sudo docker network create caddy-net --subnet=172.28.240.0/24 sudo docker network create pihole-net --subnet=172.28.241.0/24 sudo docker network create monitor-net --subnet=172.28.242.0/24
-
Start the docker
sudo docker-compose up -d
-
If you don't set the pi dns in router or local network settings. You can hardcode your domain in local
hosts
file the likeEdit the
hosts
filesudo vim /etc/hosts
Add the
pi.hole
domain to pi ip address192.168.XXX.XXX pi.hole
-
Open the browser access the
https://pi.hole/
-
Login and add the following address to
Local DNS Records
Domain Pi IP Address Description monitor.hole 192.168.XXX.XXX Monitorix prometheus.hole 192.168.XXX.XXX Prometheus alert.hole 192.168.XXX.XXX AlertManager grafana.hole 192.168.XXX.XXX Granfana aria2.hole 192.168.XXX.XXX Aria2 file.hole 192.168.XXX.XXX FileManager
Reload caddy server when add or edit or delete config
sudo make caddy-reload
Remove the docker dangling image
sudo docker images -f dangling=true
sudo docker image prune
Remove all docker images
sudo docker rmi $(sudo docker images -a -q)