this post was submitted on 09 Aug 2023
6 points (100.0% liked)

homelab

6648 readers
6 users here now

founded 4 years ago
MODERATORS
 

I've got both Heimdall and Pi-Hole running in docker. They both work fine, but I'd like to get the Pi-Hole advanced statistics in Heimdall. The others, I just put on the bridge network, but I'm not sure I can have the Pi-Hole on bridge and the macvlan network. Is that possible, or is there a better way to accomplish this?

top 7 comments
sorted by: hot top controversial new old
[–] Rik@lemmy.world 1 points 1 year ago (2 children)

I haven't been able to figure this out either, my dashboard is just links to my other containers with no obvious way to get at the juicy stats.

[–] ABeeinSpace@lemmy.world 1 points 1 year ago

Can Heimdall use the Docker socket?

[–] atfergs@lemmy.world 1 points 1 year ago

You can get access to most of them by setting them all to use the bridge network (network_mode: bridge). Then if you inspect the bridge network, you can see the bridge network ip's of them all and use that for Heimdall. The Pi-Hole is an exception though since it requires a different network.

[–] Fenzik@lemmy.ml 1 points 1 year ago* (last edited 1 year ago) (1 children)

Why not? You can just connect the PiHole container to both networks and inter-container communication should work as usual. I haven’t tried this with PiHole specifically but I’ve done it with other services in the past

[–] atfergs@lemmy.world 1 points 1 year ago (1 children)

Maybe I just don't know how... Do you have a compose script you could share?

[–] Fenzik@lemmy.ml 2 points 1 year ago* (last edited 1 year ago) (1 children)

Not for PiHole but I was testing this recently with traefik. This has a bunch of traefik stuff in there (I’m on mobile so it’s too hard to edit it) but hopefully you see how the networks work

# Testing macvlan setup for traefik
# Will only work on linux because of macvlan network

version: '3'

services:
  traefik-whoami:
    image: traefik/whoami
    container_name: traefik_whoami
    networks:
      - bridge_network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.test`)"
      - "traefik.http.routers.whoami.entrypoints=http"
  
  traefik-reverse-proxy:
    image: traefik:v2.10
    container_name: traefik_reverse_proxy
    command:
      - "--api.insecure=true"  # Enable the API dashboard (insecure for testing)
      - "--providers.docker=true"  # Enable Docker provider
      - "--providers.docker.exposedbydefault=false"  # Disable exposing all containers by default
      - "--entrypoints.http.address=:80"  # HTTP entrypoint
      - "--entrypoints.http.forwardedheaders.insecure=true"  # Insecure forwarding (for testing)
      - "--providers.docker.network=bridge_network"  # Use bridge network for traefik discovery
    ports:
      - "1180:80"  # Expose HTTP entrypoint
      - "12345:8080"  # Expose Traefik dashboard
    networks:
      bridge_network: {}
      macvlan_network:
        ipv4_address: 192.168.1.69
    volumes:
      # TODO: Use docker.sock proxy instead of mounting directly
      # https://github.com/Tecnativa/docker-socket-proxy
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.reverse-proxy.rule=Host(`traefik.test`)"
      - "traefik.http.routers.reverse-proxy.entrypoints=http"

networks:
  bridge_network:
    driver: bridge

  macvlan_network:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1
          ip_range: 192.168.1.69/32  # Must be outside router's DHCP range
[–] atfergs@lemmy.world 1 points 1 year ago

This is great, thank you!