Summary: | net-p2p/sonarr: Some suggestions | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | joshruehlig | ||||||||
Component: | Individual Port(s) | Assignee: | Mark Felder <feld> | ||||||||
Status: | Closed FIXED | ||||||||||
Severity: | Affects Some People | Keywords: | needs-qa, patch | ||||||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(feld) |
||||||||
Version: | Latest | ||||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
Attachments: |
|
Description
joshruehlig
2015-12-19 22:10:51 UTC
I forgot, we should check to make sure the data-driectory exists during the prestart routine, this allows the program to work even if the user changes the data-directory. I'll provide an updated diff. Created attachment 164399 [details]
Diff for net-p2p/sonarr
(In reply to joshruehlig from comment #0) Thanks for the patch! Don't take these as criticisms, let me just do a quick brain dump: 1) I was intentionally setting the user in command_args because you have to run daemon(1) as root to change to another user, and you need to be root to write the pidfile in /var/run. Adding a sonarr_user totally blows up the usage of daemon(1), which is a bummer. 2) I intentionally did not put the data in /var/db. There has been a desire for ports to never create files in the "base" filesystem hierarchy (/usr/local/var/{db|run} should probably become a standard). Also, this can chew up a lot of data and if /var/db is on a small root FS it will make someone very angry :-) Making datadir configurable is smart, though. 3) I did intentionally ignore sonarr's pidfile but you're right we could use it if we aren't writing into /var/run. 4) I have to use PREFIX in the port Makefile, so I carried this over to the rc script but it's interchangeable, yes. I don't know if the best practices are documented for this... 5) Wow, didn't know this. I don't think I've experienced any issues, but this is good to know. We should probably set it to the same location as the data dir. I'll probably work through this in a few stages. Thanks for taking a look and the reply. 1&3) By using the program's pidfile, setting the user through the rc system will work so changes 1&3 go together well. This would allow user portability like I mentioned earlier which is useful for this program which works tightly with sabnzbd/transmission. 2) That's fine with me having a different default datadirectoryc then my suggestion. But having it editable would be great. I maintain many of the FreeNAS plugins, and keeping stuff out of PREFIX is important because the PBI update process is pretty fragile. At least in FreeBSD9.X 4) I personally don't care if this is implemented. Works the same for my use case either way. 5) Yes, this should be implemented for sure because of the way mono expects an existing directory to write to. It'll be great once I can base the FreeNAS plugin on this port. One less thing for me to maintain in my personal repo. Created attachment 164797 [details]
Diff for net-p2p/sonarr
Ok, I updated the patch based on your comments, while keeping the changes I feel give the greatest benefit/portability.
This patch does the following...
1) Makes sonarr's user an rc.conf option.
2) Makes the data-directory an rc.conf option.
3) Uses the pidfile the sonarr program creates/managers.
4) Sets XDG_CONFIG_HOME which avoids crashes when mono needs to download and store certificates/chains to connect to SSL servers.
* Note- The daemon process now runs as a non-root user by default which is reliant on point #3
looks sane to me, thanks for your work! I'll patch my local instance and then commit after a quick test. A commit references this bug: Author: feld Date: Thu Dec 31 15:22:57 UTC 2015 New revision: 404949 URL: https://svnweb.freebsd.org/changeset/ports/404949 Log: net-p2p/sonarr: Various improvements - Allow running sonarr as a different user - Use sonarr's pidfile - Allow configuring location of the data directory - Export XDG_CONFIG_HOME to a writable directory to prevent runtime problems PR: 205441 Changes: head/net-p2p/sonarr/Makefile head/net-p2p/sonarr/files/sonarr.in great thanks. I'll adapt the freenas plugin to use the official port |