Is it possible to host Open Media Vault, PiVPN, and PiHole on a Raspberry Pi 4?

December 14, 2023, 23:11

thekchan

I currently have a Raspberry Pi 4 with 8GB of RAM and I was wondering if it was possible to host all 3 of these on a single pi. If so, will it require Docker? What are the steps on doing this? Is there a specific order I need to go in?

jannik44

yes, all three are possible, you should look into docker, its an amazing software wich saves a lot of time

thekchan

Would I just download docker onto the pi and then install them in separate containers? I’ve never used docker before but interested in learning more about it.

jannik44

yes, you need to install docker first, then you can use the containers, the creatir of the Software have usually already abprebilt version wich you can install with a single command

oops.se

I would recommend that you also use "Docker compose". With Compose you can define the services (PiVPN, PiHole and OMV) in a file, easier to maintain. Example for a PiHole, but it's not complete.
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "8089:80/tcp"
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
    environment:
      - TZ=${TZ:-Etc/UTC}
      - WEBPASSWORD=
      - INTERFACE=eth0
      - FTLCONF_MAXDBDAYS=365
      - PIHOLE_DNS_=8.8.8.8;8.8.4.4
      # see https://github.com/pi-hole/docker-pi-hole#environment-variables
    volumes:
      - ./volumes/pihole/etc-pihole:/etc/pihole
      - ./volumes/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    dns:
      - 127.0.0.1
      - 1.1.1.1
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

thekchan

Oh that’s actually really nice. I downloaded docker last night. Is docker compose something separate or is it an add on?

oops.se

I don't know how the definitions for that. But As I see it, you define your docker containers, network and resources in a YAML file and then Docker Compose uses that YAML info to create network, containers and assign resources to the containers accordingly. And Docker compose also has commands for starting, stopping and delete containers.

oops.se

I find it easier to manage containers and its easier to read the YAML file IMHO.

thekchan

Hmm, I'm running ito an error when trying to install Docker Compose. I ran the following command: sudo pip3 install docker-compose --break-system-packages The outpout error I got was the following. Any tips on what I may be doing wrong?

thekchan

Also any tips on installing OMV within Docker? Is that possible? I'm seeing the option of installing OMV on the pi and then running Docker containers through that.

null

sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
You don't need Pip for this

thekchan

Thanks Mel! Any chance you know if I have to install OMV before Docker? Or can I install Docker and put OMV into a container? I haven't found a way to do it.

null

No sorry, I only have Traefik, Tandoor, Dokuwiki, Syncthing, Nodered and Mosquitto running. But have a look here https://wiki.omv-extras.org/doku.php?id=omv6:docker_in_omv

thekchan

Ah thanks, okay. So confirmed that it can only be docker in OMV then. I guess I didn't need to wipe my pi... oops haha

null

"I guess I didn't need to wipe my pi"? I don't understand

thekchan

I wiped my previous config of my pi cause I thought I had to install docker and then OMV, but I guess the way I had it configured was fine.

thekchan

Correct me if I’m wrong, but it sounds like these are the steps: 1. Set up OMV 2. Set up Docker in OMV 3. Set up Pihole within docker container 4. Set up PiVPN in another container

null

Ah okay now, I didn't even see that it was "dock in ovm". and apparently yes. I have no experience with it though.

thekchan

Any idea you know what this error means? Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export LANGUAGE=; docker compose --file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.yml' --env-file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.env' --env-file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/global.env' up -d 2>&1': parsing /srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.yml: yaml: line 14: mapping values are not allowed in this context OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export LANGUAGE=; docker compose --file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.yml' --env-file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.env' --env-file '/srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/global.env' up -d 2>&1': parsing /srv/dev-disk-by-uuid-d2f9aa53-aab1-4de1-b787-f7aaa7d45e7e/containers/pihole/pihole.yml: yaml: line 14: mapping values are not allowed in this context in /usr/share/openmediavault/engined/rpc/compose.inc:693 Stack trace: #0 /usr/share/php/openmediavault/rpc/serviceabstract.inc(622): OMVRpcServiceCompose->{closure}() #1 /usr/share/openmediavault/engined/rpc/compose.inc(668): OMV\Rpc\ServiceAbstract->execBgProc() #2 [internal function]: OMVRpcServiceCompose->doCommand() #3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(122): call_user_func_array() #4 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod() #5 /usr/sbin/omv-engined(535): OMV\Rpc\Rpc::call() #6 {main}

thekchan

I'm trying to run a file I created for docker compose on OMV which is being used to set up pihole.

null

No sry

oops.se

It looks like a file edited in a Windows editor that is using the wrong line ending. Post the doscker compose file for verification.

oops.se

Docker compose is very sensitive for syntax and in this section you have missed
      parent:end0   ==> parent: end0
      ipam:
        config:
        - subnet:101.129.129.0/24  ==> subnet: 101.129.129.0/24
          gateway: 101.129.129.1
          ip_range: 101.129.129.5/32
And you have empty rows with just white spaces, remove them. Remove all rows with double comments, ex # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities Volumes, I changed the volumes to my environment, ex
    volumes:
      - ./volumes/pihole/etc-pihole:/etc/pihole
      - ./volumes/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
Now I just have to figure out
networks.pih_networks.driver_opts.ipam contains an invalid type, it should be a string, or a number`

oops.se

And a nice tool to use to find errors in YAML is https://www.yamllint.com/ or https://codebeautify.org/yaml-validator

thekchan

Thanks <@796000224690307072> ! I'm still getting the same error with connection lost right away. I didn't know YAML was this finicky though so I appreaciate that.

thekchan

This may be a stupid question.. but should I be installing pihole before running this file?

oops.se

The only issue left is the network part.

oops.se

If you wish to test mine, just change INTERFACE to your device name and the volumes:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
    - "8089:80/tcp"
    - "53:53/tcp"
    - "53:53/udp"
    - "67:67/udp"
    environment:
    - TZ=${TZ:-Etc/UTC}
    - WEBPASSWORD=
    # see https://sensorsiot.github.io/IOTstack/Containers/Pi-hole/#adminPassword
    - INTERFACE=eth0
    - FTLCONF_MAXDBDAYS=365
    - PIHOLE_DNS_=8.8.8.8;8.8.4.4
    # see https://github.com/pi-hole/docker-pi-hole#environment-variables
    volumes:
    - ./volumes/pihole/etc-pihole:/etc/pihole
    - ./volumes/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    dns:
    - 127.0.0.1
    - 1.1.1.1
    cap_add:
    - NET_ADMIN
    restart: unless-stopped

thekchan

Does the yaml file install pihole or do I need to install that separately? I double checked my network portion and everything looks right.

thekchan

disregard... I forgot a colon somewhere and everything seems to be building..

oops.se

The Docker Compose file (in YAML format) is a method to collect the docker commands into a singe file. So YES it takes down the "image" files for PiHole.

thekchan

Any chance you would know if pivpn works on raspbian lite through docker compose?

oops.se

Not excactly but if you have a docker cli you can translate that into a docker compose.