Install Python based servers

From unRAID
Jump to: navigation, search

Overview

Many users on the unRAID forums are using a set of tools to manage downloading items. These scripts search NZB/Torrent sites and pass the download off to SABnzbd or Transmission, then process the content once it has been downloaded. Installing these services requires an understanding of the UNIX command line utilities and updates to the unRAID boot process. Be warned, following these steps changes how unRAID functions and can result in hung unmounts and slower boot times.


Note: This instruction set does not make use of the unraid 5.0 plugins. An new page is being written with that information.

Terms

SABnzbd
SABnzbd is a Usenet download tool, it takes nzb files as input and downloads, checks and unarchives the resulting Usenet posts.
Sick Beard
Sick Beard is a system for tracking "Wanted" TV Shows, it scans your media and compares what you have against TheTVDB.com. You can then choose to download missing shows and look for new shows automatically.
CouchPotato
CouchPotato is a newcomer which is based on Sick Beard. The goal of CouchPotato is to add a "Movie" you would like, and then let it keep searching for you once a day, downloading the movie when it is available.
Python
Python is the scripting language that all of these services are built upon.

Warning

These applications will keep the cache disk busy and it will not unmount when you press the "Stop" button for the unRAID array. You must shut down these applications to be able to stop the unRAID array. Use the web interface for each program to shut it down or use the unMENU shutdown button to shut down all the applications with one click.

Install

Install the dependency package, this will add python and all the required dependencies every time unRAID boots. Log into your unRAID box and run these commands:

mkdir /boot/packages
cd /boot/packages
wget http://www.bibliognome.com/unraid/SABnzbdDependencies-2.1-i486-unRAID.tgz

Now we need to download the servers and extract them. To do this we need a cache drive (you can do it without, but that's out of the scope of this How-To). You will also need to check for the latest download of SABnzbd and replace the wget below with the URL to it.

cd /mnt/cache
mkdir .custom
cd .custom
wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/sabnzbd-0.6.5/SABnzbd-0.6.5-src.tar.gz
wget --no-check-certificate http://github.com/midgetspy/Sick-Beard/tarball/master
wget --no-check-certificate https://github.com/RuudBurger/CouchPotato/tarball/master
tar zxf SABnzbd*.tar.gz
tar zxf midgetspy*.tar.gz
tar zxf RuudBurger*.tar.gz
rm SABnzbd*.tar.gz
rm midgetspy*.tar.gz
rm RuudBurger*.tar.gz
mv midgetspy* sickbeard
mv SABnzbd* sabnzbd
mv RuudBurger* couchpotato


Then edit /boot/config/go, add the following section to the end

# determine if cache drive online, retry upto 7 times
for i in 0 1 2 3 4 5 6 7
do
    if [ ! -d /mnt/cache ]
    then
      sleep 15
    fi
done

# If Cache drive is online, start SABnzbd, Sickbeard, and CouchPotato
if [ -d /mnt/cache ]; then
  cd /mnt/cache/.custom
  installpkg /boot/packages/SABnzbdDependencies-2.1-i486-unRAID.tgz
  python /mnt/cache/.custom/sabnzbd/SABnzbd.py -d
  python /mnt/cache/.custom/sickbeard/SickBeard.py --daemon
  python /mnt/cache/.custom/couchpotato/CouchPotato.py -d
fi

You can start each service the first time without rebooting by typing the following lines at the command prompt.

installpkg /boot/packages/SABnzbdDependencies-2.1-i486-unRAID.tgz
python /mnt/cache/.custom/sabnzbd/SABnzbd.py -d -s 0.0.0.0:8082
python /mnt/cache/.custom/sickbeard/SickBeard.py --daemon
python /mnt/cache/.custom/couchpotato/CouchPotato.py -d

The " -s 0.0.0.0:8082" switch on the end of the SABnzbd line is optional to avoid a conflict with unMENU which uses port 8080. If you use this switch to change the port then substitute port 8082 in the directions below for configuring SABnzbd. Please see SABnzbd and unMenu and the Common Port List table for more information.

Configuration

Each of the servers needs to be configured to run properly on unRAID,

SABnzbd Configuration

Once SABnzbd is installed it can be accessed via http://tower:8080. The first time you visit this page you will be presented with a wizard which will guide you through a few simple settings.

The initial page is nice and simple, just select your language

SABnzbd wizard first page.jpg

Step one is where you can select the skin to use, three are available

SABnzbd wizard second page.jpg

Step two is to set up control access to SABnzbd if you wish to do this (recommended) then enter a username and password.

SABnzbd wizard third page.jpg

On step three you will need to enter the details of your Usenet server (e.g. giganews, astraweb) along with your account details. This allows SABnzbd to access the server and retrieve files as you normally would using a program such as newsleecher.

SABnzbd wizard fourth page.jpg

Step four allows you to enter your details for Newzbin and NZBMatrix, if you use these services, both are optional.

SABnzbd wizard fifth page.jpg

Upon clicking Next on step four, SABnzbd will restart with the new settings in place. After a few moments, you will be presented with the final screen that will take you to the main SABnzbd pages.

SABnzbd wizard seventh page.jpg

The next time you access http://tower:8080, you will be taken straight to the main pages. The wizard can be accessed again by entering http://tower:8080/wizard.

Initially most of the settings in SABnzbd can be left alone but there are some that will need to be changed. Go to Config - Folders and change Post-Processing Scripts Folder to: /mnt/cache/.custom/sickbeard/autoProcessTV and then save the changes. **Check your installation directory**

Sabnzbd config folder.jpg

Next go to Config - Categories and select sabToSickbeard.py from the script dropdown list in the row for TV.

Sabnzbd config categories.jpg

SABnzbd and unMenu

SABnzbd shares the same default port with unMenu, if you are going to run both packages you should change the SABnzbd port under "Config -> General" to 8082. Be sure to note this change as you configure SickBeard and CouchPotato.

You can start SABnzbd the first time from the command line by using this command which will set SABnzbd to use port 8082. This will avoid a conflict with unMENU the first time the program is run.

python /mnt/cache/.custom/sabnzbd/SABnzbd.py -d -s 0.0.0.0:8082


You can use any port over 1024 for SABnzbd, ports below that are reserved for special services run at the system level and using those ports could cause permissions issues.

Please see the Common Port List table for more information

SickBeard Configuration

SickBeard can be accessed via http://tower:8081.

Browse to the folder that SickBeard was installed to and enter the scripts folder. Rename the file autoProcessTV.cfg.sample to autoProcessTV.cfg and then open it up in a text editor. The values need to be changed to reflect those on your server.

In SickBeard, browse to General - Configuration and change the settings to reflect your preferences. Ensure the Defaults section is changed to what you prefer as this controls the quality of files downloaded. It is recommended to select season folders.

Sickbeard general config.jpg

Next go to Config - Episode Downloads. Under Episode Results select SABnzbd in the NZB method dropdown box. Enter the IP and Port for the server, the API key (this can be found from the SABnzbd page under Config - General) and if you entered a username and password for SABnzbd then also enter them here. An IP of 0.0.0.0 SickBeard is running on the same server that SABnzbd is on. Save changes.

Sickbeard general episode download.jpg

Next go to Config - Search providers. Under Provider Priorities select which providers you wish to use and in what order. Finally under Configure Providers select each provider from the dropdown list and the relevant details, this will need to be done for each one used. Save changes.


Sickbeard general search providers.jpg

CouchPotato Configuration

Once CouchPotato is installed it can be accessed via http://tower:5000. You will need to click the wrench in the top bar.

CouchP - First Log.JPG

You will need to select the General sub-menu item, here you can change the IP Address, port, set the Username and Password (these settings will require that you restart CP) An IP of 0.0.0.0 can be used if CouchPotato is running on the same server that SABnzbd is on.

CP - General Settings.JPG

After each time you save the settings you will see the About page which is where you can shutdown or restart CouchPotato.

CP - About.JPG

Under the NZBs/Torrents you will configure your access to SABnzbd, set your retention, address, port, API key and so on from SABnzbd, the part you will want to take care to note is the category, this should be set to movies if you are using SABnzbds default categories. You can also add Torrents as a secondary check (this can also be used as your primary source if you do not use SABnzbd).

CP - NZBs Torrents.JPG

WARNING: This wiki entry is not finished, please update freely, or check out the forum thread

<To Be Added>

Advanced Topics

Enable cache drive sleep

With settings left as default, SABnzbd+, SickBeard, and CouchPotato will keep your cache drive spun up due to numerous factors. Even accessing the web gui of any of these programs can cause the drive to spin up. In order to maximize your cache drive sleeping time, it is recommended to make the following changes:

SABnzbd+

  • Under Settings | General, change the Article Cache Limit to the largest individual file size that you will be downloading. A value between "100M" to "250M" should be sufficient.
  • If using RSS, increase the RSS Checking Interval to a higher value (i.e. 480 for max)
  • Under Settings | Folder, change the log directory to somewhere in the unRAID volatile file system. I use /var/log, others have suggested /tmp/log
  • Increase the watched folder scan speed to the largest value possible, 3600 seconds.

SickBeard

  • Under Config | General, change the Logging Directory to the unRAID volatile file system, similar to that in the instructions under SABnzbd+ (e.g. /var/log).
  • Every time SickBeard performs its episode search, your cache drive may spin up. Due to this, it is recommended to change the search interval to a higher value. Under Config | Episode Downloads, change the Search Frequency to a value of your liking (e.g. 360 minutes for every 6 hours).

CouchPotato At this time, there are no changes that will aid CouchPotato in preventing the drive from spinning up. Some have moved the CouchPotato duties to a computer that is not constantly on, such as an HTPC, and point the downloading SABnzbd+ on the unRAID server.

unMENU startup button

This code can be placed in a file in the unmenu directory on the flash drive and used to start these services. Save it as a file called 10-unmenu_user_script_start_python. It will appear near the top on the User Scripts page in unMENU. Use a Unix friendly text editor to create this file. Midnight Commander (type mc at the command prompt) can be used to create or clean up the file.

#define USER_SCRIPT_LABEL Start Python
#define USER_SCRIPT_DESCR Start the Python Programs SAB, SickBeard and CouchPotato
python /mnt/cache/.custom/sabnzbd/SABnzbd.py -d
python /mnt/cache/.custom/sickbeard/SickBeard.py --daemon
python /mnt/cache/.custom/couchpotato/CouchPotato.py -d


unMENU shutdown button

This code can be placed in a file in the unmenu directory on the flash drive and used to stop these services. Save it as a file called 10-unmenu_user_script_stop_python. It will appear near the top on the User Scripts page in unMENU. Use a Unix friendly text editor to create this file. Midnight Commander (type mc at the command prompt) can be used to create or clean up the file.

#define USER_SCRIPT_LABEL Stop Python
#define USER_SCRIPT_DESCR Stop the Python Programs SAB, SickBeard and CouchPotato
#
# stop SAB
wget -q --delete-after http://IP:8082/shutdown?session=API-Key
#
# stop SickBeard
wget -q --delete-after http://IP:8081/home/shutdown/
#
# Stop CouchPotato
wget -q --delete-after http://IP:8083/config/exit/

Add your server IP address and also the API Key from SAB to the above lines.

unRAID Common port list

unRAID Port List
Default Port Recommended Port Service Description
23 23 Telnet Inbound Telnet connection port
80 80 emhttp Default unRAID webserver
89 89 unraid-web Optional lighttpd web server used for unRAID-Web
2197 2197 unraid-web-control Optional control panel for lighttpd web-server used in unRAID-Web
4541 4541 apcupsd Optional APC UPS network control port
5000 8083 CouchPotato Optional install to scan for Movie downloads
8080 8080 unMenu The great webserver of many things
8081 8081 SickBeard Optional install to scan for TV show downloads
8080 8082 SABnzbd Optional install to download Usenet content
9100 9100 p910nd Optional printer driver using HP direct protocol.
9101 9101 p910nd Optional printer driver using HP direct protocol.
9102 9102 p910nd Optional printer driver using HP direct protocol.
9103 9103 p910nd Optional printer driver using HP direct protocol.

Credits

The following people contributed to the content that formed this wiki entry from the Forum thread:

  • lionelhutz
  • Romir

Posts consolidated in the wiki by Tybio and updated by the large and wonderful unRAID community.

References

Lockstockmods

Sickbeard wiki