Jail: plex

one time
zfs create ship/plex
cd /mnt/ship/plex
git clone https://github.com/iBaa/PlexConnect.git

create jail
export JAIL=plex
export JAILHOSTNAME=plex
export JAILDOMAIN=ahlawat.com
export JAILIP=56
export JAILUSER=X
export JAILUSERID=1000
export JAILUSERVNC=false

/root/FreeBSD/jails/create.sh $JAIL $JAILHOSTNAME $JAILDOMAIN $JAILIP $JAILUSER $JAILUSERID $JAILUSERVNC

# the apple TVs are on the guest VLAN - reconfigure jail networking
iocage set interfaces=vnet0:bridge1,vnet1:bridge9 ip4_addr="vnet0|192.168.0.$JAILIP/24,vnet1|192.168.200.$JAILIP/24" ip6_addr="vnet0|2603:3024:3f6:e1::$JAILIP/64,vnet1|2603:3024:3f6:e9::$JAILIP/64" exec_prestop="ifconfig epair0b -vnet ioc-$JAIL;ifconfig epair1b -vnet ioc-$JAIL" $JAIL 

iocage set allow_mount=1 enforce_statfs=1 allow_mount_tmpfs=1 $JAIL
iocage fstab -a $JAIL tmpfs /tmp tmpfs rw,size=4g,mode=1777 0 0

iocage exec $JAIL "mkdir /data"
iocage fstab -a $JAIL /mnt/ship/$JAIL /data nullfs rw 0 0
iocage exec $JAIL "mkdir -p /mnt/video"
iocage fstab -a $JAIL /mnt/data/movies /mnt/video nullfs ro 0 0
iocage exec $JAIL "mkdir -p /mnt/video-hd"
iocage fstab -a $JAIL /mnt/base/movies-hd /mnt/video-hd nullfs ro 0 0
iocage exec $JAIL "mkdir -p /mnt/video-4k"
iocage fstab -a $JAIL /mnt/base/movies-4k /mnt/video-4k nullfs ro 0 0
iocage exec $JAIL "mkdir -p /mnt/imax-4k"
iocage fstab -a $JAIL /mnt/base/imax-4k /mnt/imax-4k nullfs ro 0 0
iocage exec $JAIL "mkdir -p /mnt/music"
iocage fstab -a $JAIL /mnt/data/music /mnt/music nullfs ro 0 0
iocage exec $JAIL "mkdir -p /mnt/books"
iocage fstab -a $JAIL /mnt/data/audiobooks /mnt/books nullfs ro 0 0
iocage fstab -l $JAIL

iocage exec $JAIL "pkg install -y plexmediaserver ca_root_nss python27 py27-pillow"

iocage exec $JAIL "chown -R plex:plex /data"
iocage exec $JAIL "sysrc plexmediaserver_enable=YES"
iocage exec $JAIL "sysrc plexmediaserver_support_path=/data"
iocage exec $JAIL "service plexmediaserver start"

iocage exec $JAIL "cp /mnt/config/Settings.cfg /data/PlexConnect"
iocage exec $JAIL "cp /mnt/config/plexconnect /usr/local/etc/rc.d/"
iocage exec $JAIL "chmod 555 /usr/local/etc/rc.d/plexconnect"
iocage exec $JAIL "sysrc plexconnect_enable=YES"
iocage exec $JAIL "ln -s /usr/local/bin/python2.7 /usr/local/bin/python"
iocage exec $JAIL "service plexconnect start"



Notes:
cd /data/PlexConnect/assets/certificates
openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 3600 -subj "/C=US/CN=trailers.apple.com"
openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem 

Showcased here is a capital and operational cost effective approach, using minimal server and networking hardware with multiple virtualized applications for Home and Business. This solution template can be easily scaled out and adapted for larger Enterprise deployments.
drop by the diyIT Matrix public room at #diyit:matrix.ahlawat.com
if you have any IT questions/feedback or to request pro bono consulting for a nonprofit

message me privately at @sharad:matrix.ahlawat.com
or email me at - sharad@ahlawat.com - pgpkey: 68DD6B89
Networking and Security Technologist.
EngineerĀ andĀ an avid Programmer.

https://sharad.ahlawat.com
strive to learn and pass on the knowledge to the next generation
one day humanity will understand the meaning of life and hopefully it will be more than ASCII 42 = "*" regex for whatever you want it to be,
and destiny is more than just a roll of a pair of dice with 42 dots (Lets nail down Quantum Entanglement)

May you Live Long (Intelligently) and Prosper and work on technology that matters.
© 2024 Sharad Ahlawat

No personal identifying data is collected or any form of analytics/metrics reported to a third-party by this website.