From 65c762cf76f4dff7e95435251e3a580c8c1a78a4 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Thu, 4 Apr 2024 13:36:03 -0400 Subject: [PATCH] feat(pihole): add pihole service --- services/pihole/build.sh | 3 +++ services/pihole/start.sh | 37 +++++++++++++++++++++++++++++++++++++ services/pihole/stop.sh | 3 +++ 3 files changed, 43 insertions(+) create mode 100644 services/pihole/build.sh create mode 100755 services/pihole/start.sh create mode 100644 services/pihole/stop.sh diff --git a/services/pihole/build.sh b/services/pihole/build.sh new file mode 100644 index 0000000..76a28e6 --- /dev/null +++ b/services/pihole/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Nothing to build!" diff --git a/services/pihole/start.sh b/services/pihole/start.sh new file mode 100755 index 0000000..c0997a5 --- /dev/null +++ b/services/pihole/start.sh @@ -0,0 +1,37 @@ +#!/usr/bin/bash + +podman volume exists pihole-etc +if [[ "$?" == "1" ]]; then + podman volume create \ + --label type=service \ + "pihole-etc" + echo "Created volume pihole-etc." +else + echo "Volume pihole-etc already exists." +fi + +podman volume exists pihole-dnsmasq +if [[ "$?" == "1" ]]; then + podman volume create \ + --label type=service \ + "pihole-dnsmasq" + echo "Created volume pihole-dnsmasq." +else + echo "Volume pihole-dnsmasq already exists." +fi + +podman run \ + -td \ + --replace \ + --name "pihole" \ + -e WEBPASSWORD="$PIHOLE_INITIAL_PASSWORD" \ + -e SERVERIP="${PIHOLE_SERVER_IP:-"127.0.0.1"}" \ + -p 53:53/tcp \ + -p 53:53/udp \ + -p 67:67/udp \ + -p 80:80 \ + -p 443:443 \ + -v pihole-etc:/etc/pihole \ + -v pihole-dnsmasq:/etc/dnsqmasq.d \ + --cap-add=NET_ADMIN \ + pihole/pihole:2024.03.2 diff --git a/services/pihole/stop.sh b/services/pihole/stop.sh new file mode 100644 index 0000000..77cdecb --- /dev/null +++ b/services/pihole/stop.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +podman rm -f pihole