danifr / internet-pi

Raspberry Pi config for all things Internet.
MIT License
3 stars 0 forks source link

Undefined Network - "back-tier" #7

Open keyoss opened 2 years ago

keyoss commented 2 years ago

fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Configuration error - Service \"pihole-exporter\" uses an undefined network \"back-tier\""}

above the error message

Raspi4+ Debian

keyoss commented 2 years ago

@danifr :) hope this ping reaches out to you :D

danifr commented 2 years ago

Hi @keyoss,

hehe good thing you pinged me :)

can you share the content of your config.yml ? I think you are missing a variable.

keyoss commented 2 years ago

@danifr

Thought so :D

I have again completely reinstalled the Pi4 - with buster32. Update / Upgrade sudo apt-get install -y python3-pip (was installed already) pip3 install ansible - went fine git clone https://github.com/danifr/internet-pi.git cd internet-pi git checkout rpi_monitoring ansible-galaxy collection install -r requirements.yml cp example files to ini and config adjusted the config (see attachement) ansible-playbook main.yml

received an error about the permissions (as usual since the pi user is not set actually) - sudo reboot

ansible-playbook main.yml - again and then :

fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Configuration error - Service \"pihole-exporter\" uses an undefined network \"back-tier\""}

regards k0s config.txt

danifr commented 2 years ago

Ah, you need to set domain_name_enable to true (line 6 of your config.txt file) and then run ansible again.

When it completes you will be able to access your local services via:

Also, I have been pushing new fixes to the main branch, you maybe want to use that branch instead of rpi_monitoring :)

Let me know if that worked for you!

keyoss commented 2 years ago

Thanks @danifr

so i changed the value to true, did rerun and ran into another error. One thing i did NOT was chnging backc to the branch. Noob question: how to revert back to use the "branch" instead of the rpi_monitoring branch? :/ guess its checkout main? please find attached errors from rerun the playbook

regards k0s errors_rerun.txt

danifr commented 2 years ago

Hmm I think that error is because your config_dir: '/home/pi/internet-pi/' needs to be in a different location than the one you have the ansible code.

Let's start from scratch to make sure we are in running it from a clean state:

cd ~
rm -rf internet-pi
git clone https://github.com/danifr/internet-pi.git internet-pi
cd internet-pi

create inventory.ini file with this content: 127.0.0.1 ansible_connection=local ansible_user=pi

create config.yml with this content:

---
# Location where configuration files will be stored.
config_dir: '/home/pi/internet-pi-config/'

# Domain names configuration (related services need to be enabled).
domain_name_enable: true
domain_name: 'home.local'
domain_pihole: 'pihole'          # to access pihole via: http://pihole.home.local
domain_grafana: 'grafana'        # to access grafana via: http://grafana.home.local
domain_prometheus: 'prometheus'  # to access prometheus via: http://prometheus.home.local

# Pi-hole configuration.
pihole_enable: true
pihole_hostname: pihole
pihole_timezone: Europe/Berlin
pihole_password: "admin"

# Raspberry monitoring configuration
raspberry_monitoring_enable: true
telegraf_retention_policy: '90d'
telegraf_password: 'admin'

# Internet monitoring configuration.
monitoring_enable: true
monitoring_grafana_admin_password: "admin"
monitoring_speedtest_interval: 60m
monitoring_ping_interval: 5s
monitoring_ping_hosts:  # [URL];[HUMAN_READABLE_NAME]
  - http://www.google.com/;google.com
  - https://github.com/;github.com
  - https://www.apple.com/;apple.com
  - http://doc-chaos.net/;doc-chaos.net

# Shelly Plug configuration. (Also requires `monitoring_enable`)
shelly_plug_enable: false
shelly_plug_hostname: my-shelly-plug-host-or-ip
shelly_plug_http_username: username
shelly_plug_http_password: "password"

# AirGradient configuration. (Also requires `monitoring_enable`)
airgradient_enable: false
airgradient_sensors:
  # ID Should be limited to no more than 38 characters, in the set a-z.
  - id: livingroom
    ip: "192.168.0.123"
    port: 9925

# Starlink configuration. (Also requires `monitoring_enable`)
starlink_enable: false

Then run the ansible code: ansible-playbook main.yml

Let me know :)

keyoss commented 2 years ago

@danifr

it worked yes and no :D

Everyrthing runs trough without an error so far. Dashboards are reachable from within grafana.

directly navigating to pi-hole (192.168.0.226) will throw: 503 Service Temporarily Unavailable nginx/1.19.10

mdns is not working, neither for grafana, pihole, nor prometheus .... using direct ip for grafana and prometheus works, except pihole (like outlined before).

regards k0s

keyoss commented 2 years ago

the original build from geerling does work btw... !?

danifr commented 2 years ago

Hmm...

are all the containers running properly? At eh end of the ansible run, you should have at least these 10 containers running properly:

$ docker ps
CONTAINER ID   IMAGE                                  STATUS                    NAMES
150e55e9f80e   prom/prometheus:v2.25.2                Up 14 minutes             internet-monitoring_prometheus_1
e6d6348e8326   nginxproxy/nginx-proxy:0.9.0           Up 14 minutes             internet-monitoring_nginx-proxy_1
174c07be03b5   grafana/grafana                        Up 14 minutes             internet-monitoring_grafana_1
a70d0f719f2c   prom/blackbox-exporter                 Up 14 minutes             internet-monitoring_ping_1
95f727d2ddbc   prom/node-exporter                     Up 14 minutes             internet-monitoring_nodeexp_1
8767fa3f0903   miguelndecarvalho/speedtest-exporter   Up 14 minutes (healthy)   internet-monitoring_speedtest_1
b5fa974993a4   telegraf:1.9.3                         Up 3 days                 raspberry-monitoring_telegraf_1
95bebec62a3b   influxdb:1.8.9                         Up 3 weeks                raspberry-monitoring_influxdb_1
5f8152aec70c   pihole/pihole:latest                   Up 8 hours (healthy)      pihole
716899176df9   ekofr/pihole-exporter:v0.3.0           Up 2 hours                pihole-exporter 

If those 10 are all up and running, please check the output of:

docker exec -it pihole cat /etc/hosts

and also: docker exec -it internet-monitoring_nginx-proxy_1 cat /etc/nginx/conf.d/default.conf

keyoss commented 2 years ago

hosts:

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 192.168.0.2 raspberrypi.local 192.168.0.2 pihole.raspberrypi.local 192.168.0.2 grafana.raspberrypi.local 192.168.0.2 prometheus.raspberrypi.local 172.19.0.4 pihole

:) here you go :)

like mentioned before, the pihole nginx works with the build from geerlin. ".local" connections dont work at all (no grafana prometheus and so on). just ip based - jfi.

nginx.conf.txt container.txt

danifr commented 2 years ago

All looks good config wise.

Are you sure you are using pihole as your home DNS server? Can you do a DNS lookup from any of your computers and paste the output here?

For example: nslookup pihole.raspberrypi.local

And the same command from your pi.

keyoss commented 2 years ago

right now the dns is still the fritz.box (192.168.0.1) - i am doing just a dry test and whenever everything is accessible, like it is with the greelin build, i would switch to have pihole to have the dns server.

afaik it should work, like with the greelin build, wothout having the pihole forced to be dns? doesnt?

regards

keyoss commented 2 years ago

@danifr dns lookup for local does work for pihole. grafana. prometheus. BUT its redirecting me always to an index.html in /var/www/ - which i created a long time ago.

fritz.box is not reachable only by ipadress

Server: 192.168.0.2 Address: 192.168.0.2#53

Name: pihole.raspberrypi.local Address: 192.168.0.2

Oh one thing to add:

docker exec -it internet-monitoring_nginx-proxy_1 cat /etc/nginx/conf.d/default.conf Error response from daemon: Container 4411a4f3e273c80588c3211974ae7f7317f88bb90193361eb10088d43802ea5e is not running

is not started?!

keyoss commented 2 years ago

ok, old instance of apache2 was taking over - it looks good for now :) Thanks!

keyoss commented 2 years ago

502 Bad Gateway for grafana.raspberrypi.local now -.- prometheus and pihole works :D i could cry a river

by "ps" the grafana container does hang in a restart-loop

danifr commented 2 years ago

afaik it should work, like with the greelin build, wothout having the pihole forced to be dns? doesnt?

But the whole idea of pihole is configuring it as your primary DNS server so it blocks the ads for you.

Yeah internet-monitoring_nginx-proxy_1 needs to be running, that's the container doing all the reverse proxy magic.

If I were you I would stop and remove all running containers, and run the ansible playbook again.

$ docker stop $(docker ps -a -q)
$ docker rm -f $(docker ps -a -q)

If that does not work you can always go for geerling's code. My fork just adds a couple of features on top of his. Namely:

Check for the string "danifr's fork" in https://github.com/danifr/internet-pi#readme to get to know more about the differences.

danifr commented 2 years ago

Did you tried it? Can I close this issue?

keyoss commented 2 years ago

Well,

the issue about the "back-tier" was propably related to the have the config folder the same like the git checkout directory or using not the main branch. so yes in this case it can be closed.....

while i still fight with: clean install with raspi-installer (buster, buster lite, bullsey, bullseye lite, 32/64) - after everything is working (2 reboots needed.. 1 for the ansible and one because of the pi users group rights) another reboot will not start the nginx anymore..

i will still investigate and propably open another issue. i cant explain myself why its simply not starting nginx anymore after everything works......