RadSaJa

Instructions to get this working in TrueNAS Core 12.2
I call it RadSaJa, one jail containing Radarr, Sonarr and Jackett, as they all share the same dependencies.

Please note that all variables may be different on your platform, as mount points and naming and also network schema. Adjust these to suit your setup. Also,all commands should be entered row by row.

Lets create the jail.

Change ip4_addr to the IP you want the JAIL to be on and defaultrouter IP to your routers IP address.

iocage create -n "radsaja" -r 12.2-RELEASE ip4_addr="vnet0|10.0.0.25/24" defaultrouter="10.0.0.1" vnet="on" allow_raw_sockets="1" allow_sysvipc="1" boot="on" 

Application Dependencies

These are commands that all the software is dependent on, so they all share this.

Update to latest repo

iocage exec radsaja "mkdir -p /usr/local/etc/pkg/repos"
iocage exec radsaja "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"

Install packages

iocage exec radsaja pkg install -y mono6.8 mediainfo sqlite3 curl nano
iocage exec radsaja sysrc jail_sysvipc_allow=YES

All the jive before was that the applications needed mono 5.10 and later 5.20, was troublesome to get them to work, but now 6.8 is present which makes life easier!

users'n'groups and create rc.d folder

iocage exec radsaja "pw user add media -c media -u 8675309 -d /nonexistent -s /usr/bin/nologin"
iocage exec radsaja "pw groupmod media -m sonarr"
iocage exec radsaja mkdir /usr/local/etc/rc.d

Sonarr Installation

mount storage

iocage exec radsaja mkdir -p /cfgson
iocage exec radsaja mkdir -p  /mnt/torrents/complete/{tv,anime,movies}
iocage exec radsaja mkdir -p /mnt/torrents/incomplete/{tv,anime,movies}
iocage fstab -a radsaja /mnt/Jailer/apps/sonarr /cfgson nullfs rw 0 0
iocage fstab -a radsaja /mnt/dumpdisk/torrents/complete /mnt/torrents/complete nullfs rw 0 0
iocage fstab -a radsaja /mnt/MassStorage/media/tv /mnt/tv nullfs rw 0 0
iocage fstab -a radsaja /mnt/MassStorage/media/anime /mnt/anime nullfs rw 0 0

download Sonarr v3

This creates a user named media in the jail which is the same as TrueNAS own media user. So we have less hassle with other jails.

iocage exec radsaja ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec radsaja "fetch 'https://services.sonarr.tv/v1/download/phantom-develop/latest?version=3&os=linux' -o /usr/local/share/sonarr.tar.gz"
iocage exec radsaja "tar -xzvf /usr/local/share/sonarr.tar.gz -C /usr/local/share"
iocage exec radsaja rm /usr/local/share/sonarr.tar.gz

iocage exec radsaja chown -R media:media /usr/local/share/Sonarr /cfgson
iocage exec radsaja  sysrc 'sonarr_user=media'
iocage exec radsaja  sysrc 'sonarr_group=media'

create rc.d

iocage exec radsaja "ee /usr/local/etc/rc.d/sonarr"

populate rc.d file

Paste the contents here into the opened rc.d file.

#!/bin/sh

# $FreeBSD$
#
# PROVIDE: sonarr
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# sonarr_enable: Set to YES to enable sonarr
# Default: NO
# sonarr_user: The user account used to run the sonarr daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run as root.
# Default: media
# sonarr_group: The group account used to run the sonarr daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run with group wheel.
# Default: media
# sonarr_data_dir: Directory where sonarr configuration
# data is stored.
# Default: /var/db/sonarr

. /etc/rc.subr
name=sonarr
rcvar=${name}_enable
load_rc_config $name

: ${sonarr_enable:="NO"}
: ${sonarr_user:="media"}
: ${sonarr_group:="media"}
: ${sonarr_data_dir:="/cfgson"}

pidfile="${sonarr_data_dir}/nzbdrone.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="-f ${procname} /usr/local/share/Sonarr/Sonarr.exe --data=${sonarr_data_dir} --nobrowser"

start_precmd=sonarr_precmd
sonarr_precmd() {
if [ ! -d ${sonarr_data_dir} ]; then
install -d -o ${sonarr_user} -g ${sonarr_group} ${sonarr_data_dir}
fi

export XDG_CONFIG_HOME=${sonarr_data_dir}
}

run_rc_command "$1"

ESC+ENTER

iocage exec radsaja chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec radsaja sysrc "sonarr_enable=YES"
iocage exec radsaja service sonarr start

You should now be able to see Sonarr active at http://jailip:8989 If so, then we can go on with Radarr!

Radar Installation

mount storage

iocage exec radsaja mkdir -p /cfgrad
iocage fstab -a radsaja /mnt/Jailer/apps/radarr /cfgrad nullfs rw 0 0
iocage fstab -a radsaja /mnt/MassStorage/media/movies /mnt/movies nullfs rw 0 0

download radarr

iocage exec radsaja "fetch 'https://radarr.servarr.com/v1/update/master/updatefile?os=linux' -o /usr/local/share/radarr.tar.gz"
iocage exec radsaja "tar -xzvf /usr/local/share/radarr.tar.gz -C /usr/local/share"
iocage exec radsaja rm /usr/local/share/radarr.tar.gz
iocage exec radsaja "pw groupmod media -m radarr"
iocage exec radsaja chown -R media:media /usr/local/share/Radarr /cfgrad
iocage exec radsaja sysrc 'radarr_user=media'
iocage exec radsaja sysrc 'radarr_group=media'

create rc.d

iocage exec radsaja "ee /usr/local/etc/rc.d/radarr"

populate rc.d file

Paste the contents here into the opened rc.d file.

#!/bin/sh

# $FreeBSD$
#
# PROVIDE: radarr
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# radarr_enable: Set to YES to enable radarr
# Default: NO
# radarr_user: The user account used to run the radarr daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run as root.
# Default: media
# radarr_group: The group account used to run the radarr daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run with group wheel.
# Default: media
# radarr_data_dir: Directory where radarr configuration
# data is stored.
# Default: /var/db/radarr

. /etc/rc.subr
name=radarr
rcvar=${name}_enable
load_rc_config $name

: ${radarr_enable:="NO"}
: ${radarr_user:="media"}
: ${radarr_group:="media"}
: ${radarr_data_dir:="/cfgrad"}

pidfile="${radarr_data_dir}/nzbdrone.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="-f ${procname} /usr/local/share/Radarr/Radarr.exe --data=${radarr_data_dir} --nobrowser"

start_precmd=radarr_precmd
radarr_precmd() {
if [ ! -d ${radarr_data_dir} ]; then
install -d -o ${radarr_user} -g ${radarr_group} ${radarr_data_dir}
fi

export XDG_CONFIG_HOME=${radarr_data_dir}
}

run_rc_command "$1"

ESC+ENTER

iocage exec radsaja chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radsaja sysrc "radarr_enable=YES"
iocage exec radsaja service radarr start

You should now be able to see Radarr active at http://jailip:7878 If so, then we can go on with Jackett!

Jackett Installation

mount storage

iocage exec radsaja mkdir -p /cfgjac
iocage fstab -a radsaja /mnt/Jailer/apps/jackett /cfgjac nullfs rw 0 0

download jackett

iocage exec radsaja "fetch 'https://github.com/Jackett/Jackett/releases/download/v0.17.743/Jackett.Binaries.Mono.tar.gz' -o /usr/local/share/jackett.tar.gz"
iocage exec radsaja "tar -xzvf /usr/local/share/jackett.tar.gz -C /usr/local/share"
iocage exec radsaja rm /usr/local/share/jackett.tar.gz
iocage exec radsaja "pw groupmod media -m jackett"
iocage exec radsaja chown -R media:media /usr/local/share/Jackett /cfgjac
iocage exec radsaja sysrc 'jackett_user=media'
iocage exec radsaja sysrc 'jackett_group=media'

create rc.d

iocage exec radsaja "ee /usr/local/etc/rc.d/jackett"

populate rc.d file

Paste the contents here into the opened rc.d file.

#!/bin/sh

# $FreeBSD$
#
# PROVIDE: jackett
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# jackett_enable: Set to YES to enable jackett
# Default: NO
# jackett_user: The user account used to run the jackett daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run as root.
# Default: media
# jackett_group: The group account used to run the jackett daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run with group wheel.
# Default: media
# jackett_data_dir: Directory where jackett configuration
# data is stored.
# Default: /var/db/jackett

. /etc/rc.subr
name=jackett
rcvar=${name}_enable
load_rc_config $name

: ${jackett_enable:="NO"}
: ${jackett_user:="media"}
: ${jackett_group:="media"}
: ${jackett_data_dir:="/cfgjac"}

pidfile="${jackett_data_dir}/nzbdrone.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/mono"
command_args="-f ${procname} /usr/local/share/Jackett/JackettConsole.exe -d ${jackett_data_dir}"

start_precmd=jackett_precmd
jackett_precmd() {
if [ ! -d ${jackett_data_dir} ]; then
install -d -o ${jackett_user} -g ${jackett_group} ${jackett_data_dir}
fi

export XDG_CONFIG_HOME=${jackett_data_dir}
}

run_rc_command "$1"

ESC+ENTER

iocage exec radsaja chmod u+x /usr/local/etc/rc.d/jackett
iocage exec radsaja sysrc "jackett_enable=YES"
iocage exec radsaja service jackett start

You should now be able to see Jackett active at http://jailip:9117 If so, then we can go on with setting up another Jail with Transmission with OpenVPN and IPFW ruleset, so that jail will always be neclosed to the VPN connecstion. BUUUuuTTttt, that is another tutorial.