Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Sorta Fresh Plex in iocage

Status
Not open for further replies.

kjake

Member
Joined
Mar 17, 2017
Messages
29
Thanks for the help I did get it working. So Plex does require VNET in order to function, all my other jails including one with Emby do not require this. I just needed to add the tunables in order for the bridge to function properly with VNET.
Awesome! Glad we solved it!
 

kazooless

Member
Joined
Aug 9, 2013
Messages
25
I think you were typing your message while I was :)
Just re-iterating that the version of Plex in the pkg repo is terribly old. I do intend to re-visit this script and find a way to always pull the latest, but the Ports version is usually fairly up-to-date (around 2 weeks old right now).
Kjake: isn't there a way to upgrade from ports instead of blow it all out and reinstall?
 

kjake

Member
Joined
Mar 17, 2017
Messages
29
I haven't tested it, but this command should do it:
iocage exec plex make -C /usr/ports/multimedia/plexmediaserver-plexpass clean reinstall BATCH=yes
 

kazooless

Member
Joined
Aug 9, 2013
Messages
25
I haven't tested it, but this command should do it:
iocage exec plex make -C /usr/ports/multimedia/plexmediaserver-plexpass clean reinstall BATCH=yes
Thanks. I would think this would be a little safer. I've just finished reading the Jails section in the newest User Guide to try and understand the difference between warden and iocage. There isn't much information there about differences or advantages. However, I'm wondering it a snapshot could be added at the beginning of a script like yours and then run the port upgrade.
 

kjake

Member
Joined
Mar 17, 2017
Messages
29
Thanks. I would think this would be a little safer. I've just finished reading the Jails section in the newest User Guide to try and understand the difference between warden and iocage. There isn't much information there about differences or advantages. However, I'm wondering it a snapshot could be added at the beginning of a script like yours and then run the port upgrade.
Unless I misunderstand snapshots, in my setup, a snapshot will only end up snapping the the jail itself and nothing mounted to it... so I personally see little value in that as, in my setup, I treat the jail as a disposable thing with important data mounted from outside of it.

Treating the jails as disposable has worked out well for me so far. I was playing with something that I didn't understand this weekend and my whole iocage dataset became read-only. Instead of battling with it, I just deleted the whole dataset and re-ran my various jail scripts and everything came back up as if nothing had happened.
 
Joined
Dec 19, 2017
Messages
76
Thanks for the help I did get it working. So Plex does require VNET in order to function, all my other jails including one with Emby do not require this. I just needed to add the tunables in order for the bridge to function properly with VNET.
I myself have been trying to get an iocage with Plex going, but I'm stuck at Plex being unable to do agent requests. These all return 401, as I also was able to verify by curling the urls. Consequence is that for example no metadata can be downloaded. When I search for this, the general advice from the Plex forums is to disable ipv6, but could it be that it doesn't work because I used a shared IP for networking?

The Warden plugin jail works just fine, by the way. But that's stuck on an EOL version of FreeBSD.
 

yupsterXJ

Newbie
Joined
May 21, 2018
Messages
3
Hi there, total newbie here and learning bit by bit.

@kjake Question from the initial code:
#map common portsnap storage outside of jail
I think I understand the concept and why, but how do I make it happen? Sounds useful when additional projects are based on ports.
If I use the default portsnap paths after portsnap fetch extract what would the mnt path look like?
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,574
I think I understand the concept and why, but how do I make it happen?
You run the next two lines of the script. The part you quoted was a comment; the next two lines actually do the job.
 

yupsterXJ

Newbie
Joined
May 21, 2018
Messages
3
Sorry it wasn't clear, I'm still figuring out how to form my questions correctly. Before I can map the portsnap storage outside of the jail I need to have the portsnap files and folders in the zpool somewhere, correct? I was able to do it in an ugly way by running portsnap and then moving folders but I'm wondering what the right or clean way is to set it up and maintain it. This is probably a basic setup but I can't seem to find how to do it.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,574
Before I can map the portsnap storage outside of the jail I need to have the portsnap files and folders in the zpool somewhere, correct?
Only portsnap/ports and portsnap/db. Portsnap itself will create the rest.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,434
I still struggle with why anyone would not just install the package for Plex and be done with it. This thread makes it much more complicated than it needs to be.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,574
I still struggle with why anyone would not just install the package for Plex and be done with it.
Because the package, at various times, can be much more out of date than the port. As to the rest of it, this script keeps all the data out of the jail so it can be destroyed and rebuilt with no loss of configuration or data.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,434
But that is easily remedied if someone wants to override the quarterly updates and still use pkg to keep things up to date. I just did this very same thing in my Plex jail to get the latest Plex version via pkg.

mkdir -p /usr/local/etc/pkg/repos

ee /usr/local/etc/pkg/repos/FreeBSD.conf

Add the contents below, save and exit and run pkg upgrade

Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,574
But that is easily remedied if someone wants to override the quarterly updates and still use pkg to keep things up to date.
...but even then the packages aren't kept as up-to-date as the ports, and some people seem very concerned that they have the most recent version of Plex at all times.

But even aside from that, there isn't a great lot going on here, and much of what is going on is good practice with any jail (even if we haven't realized it until recently). @kjake is taking a page from the Docker playbook and keeping all the persistent data outside of the jail. It's somewhat ironic that we haven't really hit on doing this earlier; if we'd been doing this with warden jails, it'd be much easier to rebuild them when there was a new FreeBSD template. It isn't such a big deal with iocage, as we can upgrade the template in an existing jail (which is why I say it's somewhat ironic that we've hit on this technique about the time we started using iocage jails).

Everything else the script is doing is stuff you'd need to do with a manual pkg installation anyway. The only differences in technique between this and the simplest possible pkg installation are:
  • It's being done in a script
  • Using ports rather than pkg to install Plex
  • Storing the Plex metadata/configuration outside the jail
Think what you will of the latter two. The first is a step in the right direction, though this script isn't as polished as his Unifi one, and I think I've improved on that concept further in my Nextcloud script. I like the concept of scripting the jail installation, as it gives that much less opportunity for user error--and the less the script has to be edited, the less chance there is of user error.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,434
Don't get me wrong, I think it's pretty slick what you guys have come up with as far as scripting the installation for the jails. I've just never found it terribly difficult to create the jails and install what I want and waiting a week or so for the package to get updated has always been a non issue for me. In fact I kind of enjoy it since this is one of my hobbies and it helps me to learn as much as possible as I go. Plus I don't know squat about scripting so that's probably coloring my opinion as well. But I do think I'm not the average Joe when it comes to that just based on the posts in the forum because it seems a lot of users just want to push a button and be done with it.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,574
Plex really is kind of an edge case for me--most of the work (namely, the adding and configuring of suitable storage) needs to be done no matter how you install it, and that's going to be different for every user, so it can't easily be scripted. Installation of the service itself is really pretty easy, whether you use the plugin, the package, or the port. Therefore, IMO, there's less value in this script than in the Unifi one (or the Crashplan one, if Crashplan hadn't turned around and broken the service yet again), or my Nextcloud one--in all of those cases, almost all of the complication is uniform. IOW, with Nextcloud (for example), there are a number of moving parts, but the way they need to be installed and configured is the same for everyone, which makes it ideal for scripting: There are lots of steps, so lots of things for users to get wrong. But the steps are all uniform, so they can all be automated. Saves lots of work, and lots of user error.

Plus I don't know squat about scripting so that's probably coloring my opinion as well.
Everything I know about shell scripting, I learned from Google--but if you look at any of these scripts, the vast majority of what they're doing is simply running one command after another, just as you would by doing it manually. I use a few variables--those are easy enough to handle. I use some if-then logic--not difficult to follow, but syntax matters. Again, Google.
 

yupsterXJ

Newbie
Joined
May 21, 2018
Messages
3
RAIDFLEX said:
I just needed to add the tunables in order for the bridge to function properly with VNET.
I have read kjake's github, do I need to add all those tunables to get the plex transcoding to work or just some?

@danb35 thanks for the words of wisdom and sharing the wizardry, I was having some issues with the learning curve and much more to learn.
 
Status
Not open for further replies.
Top