Following on from the previous post about thin jails, we can now procede to install the following applications in to seperate jails:

  • Sonarr
  • Radarr
  • SABnzbd
  • nginx as a reverse proxy for the above applications
  • Plex

First, clone the skeleton snapshot to the thinjails directory for each jail:

1
2
3
4
5
zfs clone zroot/jails/templates/skeleton-11.0-RELEASE@skeleton zroot/jails/thinjails/sonarr
zfs clone zroot/jails/templates/skeleton-11.0-RELEASE@skeleton zroot/jails/thinjails/radarr
zfs clone zroot/jails/templates/skeleton-11.0-RELEASE@skeleton zroot/jails/thinjails/sabnzbd
zfs clone zroot/jails/templates/skeleton-11.0-RELEASE@skeleton zroot/jails/thinjails/nginx
zfs clone zroot/jails/templates/skeleton-11.0-RELEASE@skeleton zroot/jails/thinjails/plex

Next, create the mount folders for the jails

1
2
3
4
5
mkdir -p /usr/local/jails/sonarr
mkdir -p /usr/local/jails/radarr
mkdir -p /usr/local/jails/sabnzbd
mkdir -p /usr/local/jails/nginx
mkdir -p /usr/local/jails/plex

Add the configurations for the jails in /etc/jail.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Insert at the bottom of jail.conf from previous blog post
sonarr {
$ip = 45;
}
radarr {
$ip = 46;
}
sabnzbd {
$ip = 47;
}
nginx {
$ip = 48;
}
plex {
$ip = 49;
}

Create a fstab file for each jail at /usr/local/jails/<jailname>.fstab, replacing <jailname> with the jail name of each.

1
2
/usr/local/jails/templates/base-11.0-RELEASE /usr/local/jails/<jailname>/ nullfs ro 0 0
/usr/local/jails/thinjails/<jailname> /usr/local/jails/<jailname>/skeleton nullfs rw 0 0

Create and start jails

1
2
3
4
5
jail -c sonarr
jail -c radarr
jail -c sabnzbd
jail -c nginx
jail -c plex

Add jails to auto-start on boot in /etc/rc.conf

1
jail_list="plex sonarr radarr nginx sabnzbd"

Sonarr

Enter jail, replacing <id> with the ID of the Sonarr jail shown in jls output

1
2
jls
jexec <id> /bin/sh

Install Sonarr, answering yes to installing pkg and the package itself

1
pkg install sonarr

Enable and start Sonarr

1
2
sysrc sonarr_enable=YES
service sonarr start

Radarr

Enter jail, replacing <id> with the ID of the Radarr jail shown in jls output

1
2
jls
jexec <id> /bin/sh

Install Radarr, answering yes to installing pkg and the package itself

1
pkg install radarr

Enable and start Radarr

1
2
sysrc radarr_enable=YES
service radarr start

SABnzbd

Enter jail, replacing <id> with the ID of the SABnzbd jail shown in jls output

1
2
jls
jexec <id> /bin/sh

Install SABbnzbd, answering “yes” to installing pkg and the package itself

1
pkg install sabnzbdplus

Enable and start SABbnzbd

1
2
sysrc sabnzbdplus_enable=YES
service sabnzbdplus start

Plex

Enter jail, replacing <id> with the ID of the Plex jail shown in jls output

1
2
jls
jexec <id> /bin/sh

Install Plex, answering “yes” to installing pkg and the package itself

1
pkg install plexmediaserver

Enable and start Plex

1
2
sysrc plexmediaserver_enable=YES
service plexmediaserver start

Nginx

Enter jail, replacing <id> with the ID of the nginx jail shown in jls output

1
2
jls
jexec <id> /bin/sh

Install nginx, answering “yes” to installing pkg and the package itself

1
pkg install nginx

Enable nginx

1
sysrc nginx_enable=YES

Edit /usr/local/etc/nginx/nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name home.ludriks.com 10.1.1.45;
location /sonarr {
proxy_pass http://<sonarr_ip here>:8989;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
location /radarr {
proxy_pass http://<radarr_ip here>:7878;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
location /sabnzbd {
proxy_pass http://<sabnzbd_ip here>:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
access_log /var/log/nginx/sonarr.your-domain.xyz;
}
}

Start nginx

1
service nginx start

I will follow up this blog post with another detailing integration with the jails.