added pihole

This commit is contained in:
Snogard 2023-07-22 17:16:29 +02:00
parent 93a80f0035
commit 0a00c2961d
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,56 @@
#!/bin/bash
source /opt/kaido/src/libs/bash/lib.sh
# docs https://hub.docker.com/r/pihole/pihole
# setup
imageName=docker.io/pihole/pihole:2023.03.1
containerName=pihole
srcConfigPath=/home-server/configuration/$containerName
baseConfigPath=/mnt/storage/containers/$containerName/config
dstPiholeConfigPath=$baseConfigPath/pihole
dstDnsmasqConfigPath=$baseConfigPath/dnsmasq
# envs
webport=10105
virtual_host=pihole_host
timezone=Europe/Rome
if [ -f "/etc/kaido/containers/$containerName/envs.sh" ]; then
source /etc/kaido/containers/$containerName/envs.sh
fi
# pre install
create_folder "$dstPiholeConfigPath"
create_folder "$dstDnsmasqConfigPath"
stop_and_remove_container $containerName
# firewall
echo "Checking firewall rules"
echo "Allowing dns"
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
echo "Allowing dhcp"
sudo ufw allow 67/udp
# install
echo "Creating new container"
podman create \
--name $containerName \
--net=host \
-e WEB_PORT=$webport \
-e TZ="$timezone" \
-e VIRTUAL_HOST="$virtual_host" \
-v $dstPiholeConfigPath:/etc/pihole \
-v $dstDnsmasqConfigPath:/etc/dnsmasq \
$imageName
#systemd
create_systemd_services $podName
systemctl --user enable --now $containerName

View File

@ -64,5 +64,4 @@ podman create \
# systemd
create_systemd_services $podName
systemctl --user enable --now $podName