Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aksiksi
Last active August 4, 2019 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aksiksi/3094c0e767d4908374e5a0cfa3da0a13 to your computer and use it in GitHub Desktop.
Save aksiksi/3094c0e767d4908374e5a0cfa3da0a13 to your computer and use it in GitHub Desktop.
A docker-compose config that spins up a simple HTPC setup on a Raspberry Pi.

To enable the service: sudo systemctl enable rpi-htpc

To start the service: sudo systemctl start rpi-htpc

Make sure all ports specified in the docker-compose YAML config are available.

Once everything is up, you can configure/restore NZBGet, Sonarr, and Radarr to your liking.

# Steps:
# - Set "DATA" and "DOWNLOADS" env variables correctly for volume mounting
# - Or create a .env file in the same directory as the yml
# - If using systemd, make sure "cd" to the directory
#
# Notes:
# We use a single Docker volume for Sonarr/Radarr as recommended by the team.
# In our case, we set it to the _root_ of the external drive.
#
# Run:
# sudo pip install docker-compose
# docker-compose up -d
#
# Example:
# DATA=/hd/ DOWNLOADS=/hd/Downloads/ docker-compose up -d
version: "3"
services:
sonarr:
image: linuxserver/sonarr
container_name: sonarr
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- ~/.sonarr:/config
- ${DATA}:/data
ports:
- "8989:8989"
depends_on:
- nzbget
- transmission
restart: unless-stopped
radarr:
image: linuxserver/radarr
container_name: radarr
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- ~/.radarr:/config
- ${DATA}:/data
ports:
- "7878:7878"
depends_on:
- nzbget
- transmission
restart: unless-stopped
nzbget:
image: linuxserver/nzbget
container_name: nzbget
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- ~/.nzbget:/config
- ${DATA}:/data
ports:
- "6789:6789"
restart: unless-stopped
transmission:
image: linuxserver/transmission
container_name: transmission
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- ~/.transmission:/config
- ${DOWNLOADS}:/downloads
ports:
- "9091:9091"
- "51413:51413"
- "51413:51413/udp"
restart: unless-stopped
# root HDD path
DATA=/hd/
# downloads path
DOWNLOADS=/hd/Downloads
# Save as e.g. /etc/systemd/system/rpi-htpc.service
[Unit]
Description=RpiHTPC
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=pi
WorkingDirectory=/home/pi/config
# Shutdown container (if running) when unit is stopped
ExecStartPre=/usr/local/bin/docker-compose -f /home/pi/config/docker-compose.yml down -v
# Start container when unit is started
ExecStart=/usr/local/bin/docker-compose -f /home/pi/config/docker-compose.yml up
# Stop container when unit is stopped
ExecStop=/usr/local/bin/docker-compose -f /home/pi/config/docker-compose.yml down -v
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment