1 Customize app config
Freddie Sackur edited this page 2023-02-27 19:44:11 +00:00

Use case

  • Set Pihole to listen on a custom IP address
  • Mount an existing volume on your host into a media app such as Jellyfin
    • By default, media apps will only be able to see files within runtipi/media, but you can add other volumes.

An alternative approach to mounting a volume into an app would be to symlink your host volume into runtipi/media. However, that would make it visible to all apps that mount the media folder, which may not be desirable.

Create custom docker config

In this example we're going to add environment variables to the Pihole app and mount the /cellar volume into the Jellyfin app.

To determine how to set environment variables to customize the Pihole container, we look at runtipi/apps/pihole/docker-compose.yml:

ports:
  - ${NETWORK_INTERFACE:-0.0.0.0}:53:53/tcp
  - ${NETWORK_INTERFACE:-0.0.0.0}:53:53/udp
  - ${NETWORK_INTERFACE:-0.0.0.0}:${APP_PORT}:80

From this, we know that we need to set the NETWORK_INTERFACE variable.

Don't edit the files in the apps folder directly; they will be overwritten on update.

  1. Create user-config folder within runtipi and a folder for each app:

    # cd runtipi
    # mkdir user-config
    # mkdir user-config/jellyfin
    # mkdir user-config/pihole
    
  2. Create a docker-compose.yml for jellyfin and add this content:

    # touch user-config/jellyfin/docker-compose.yml
    # nano user-config/jellyfin/docker-compose.yml
    
    version: "3.7"
    services:
      jellyfin:
        volumes:
          - /cellar:/cellar
    

    Replace /cellar with the volume you want to mount.

  3. Create an app.env for pihole and add this content:

    # touch user-config/pihole/app.env
    # nano user-config/pihole/app.env
    
    NETWORK_INTERFACE=10.20.0.53
    

    Replace 10.20.0.53 with the IP address you want pihole to listen on.

  4. You should end up with a structure like this:

    runtipi
    |
    ├───app-data
    ├───apps
    ├───  ...other folders...
    |
    └───user-config
        |
        ├───jellyfin
        |       docker-compose.yml
        |
        └───pihole
                app.env
    
  5. Restart the apps and test:

    # ./scripts/app.sh stop jellyfin
    # ./scripts/app.sh stop pihole
    # ./scripts/app.sh start jellyfin
    # ./scripts/app.sh start pihole
    
    • Test Jellyfin by opening the app and configuring a library. You should now see your mounted volume.
    • Test Pihole with a DNS query to the new IP address:
      # nslookup google.com 10.20.0.53
      
      Server:         10.20.0.53
      Address:        10.20.0.53#53
      
      Non-authoritative answer:
      Name:   google.com
      Address: 142.250.200.46
      Name:   google.com
      Address: 2a00:1450:4009:822::200e