From 0e3af57e5e978cc9945ad1c479ea809f4b65e88d Mon Sep 17 00:00:00 2001 From: Kameron Kenny <1267885+kkenny@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:02:25 -0400 Subject: [PATCH] add jenkinsfile and update docker compose with ip --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 9 ++++++++- pihole-exporter.env | 8 ++++---- 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..08b734e --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,40 @@ +pipeline { + agent { + label 'pi501.in.thelinuxpro.net' + } + + stages { + stage("verify tooling") { + steps { + sh ''' + docker version + docker info + docker compose version + ''' + } + } + + stage('Create contexts') { + steps { + sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"' + } + } + + stage('Start container') { + steps { + script { + def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml') + + //if (status_s != 0) { + sh 'docker --context pi502 compose up -d' + sh 'docker --context pi502 compose ps' + //} else { + // echo 'skip' + //} + } + } + } + + } +} + diff --git a/docker-compose.yml b/docker-compose.yml index ecd3a1e..17a38b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,7 @@ +networks: + infra_dev_net: + external: true + services: pihole-exporter: container_name: pihole-exporter @@ -16,4 +20,7 @@ services: interval: 300s retries: 5 timeout: 10s - restart: always \ No newline at end of file + restart: unless-stopped + networks: + infra_dev_net: + ipv4_address: 10.99.23.34 diff --git a/pihole-exporter.env b/pihole-exporter.env index 7fba11d..05833d9 100644 --- a/pihole-exporter.env +++ b/pihole-exporter.env @@ -1,4 +1,4 @@ -PIHOLE_HOSTNAME=pihole # Chage to PiHole's IP address or FQDN -PIHOLE_PASSWORD=MyStrongPassword # Change to your PiHole's password -INTERVAL=90s -PORT=9617 \ No newline at end of file +PIHOLE_HOSTNAME=dns01.in.thelinuxpro.net,dns02.in.thelinuxpro.net +PIHOLE_PASSWORD=forty6and2 +INTERVAL=15s +PORT=9617