Skip to content

Instantly share code, notes, and snippets.

@baetheus
Last active November 14, 2015 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baetheus/2656293c73895147f7b6 to your computer and use it in GitHub Desktop.
Save baetheus/2656293c73895147f7b6 to your computer and use it in GitHub Desktop.
Running Sickbeard in a SmartOS Zone

Sickbeard on SmartOS

Introduction

Documentation on installing and setting up SickBeard on a SmartOS base64 14.3.0 zone. These instructions assume a fresh zone creation of image 62f148f8-6e84-11e4-82c5-efca60348b9f.

Prerequisites

Make sure to copy the following line by line and confirm that each runs successfully. All of the following are run from the root shell.

pkgin -fy up
pkgin -y fug
pkgin -y in py27-pip py27-sqlite3 py27-cElementTree git
pip install cheetah
groupadd -g 500 sick
useradd -m -c "Sickbeard User" -u 500 -g sick sick
passwd -N sick
sed -i 's/^TZ=.*$/TZ=America\/Los_Angeles/' /etc/default/init

Installation

su - sick
cd
export TZ=America/Los_Angeles
echo "export TZ=America/Los_Angeles" >> .profile
git clone git://github.com/midgetspy/Sick-Beard.git sickbeard
cd sickbeard
python SickBeard.py

At this point sickbeard should be running in the foreground. Following are instructions for getting the SMF service up and running. Test the server by seeing if the web interface is accessible using the information below. Then press CTRL+c to exit the process and CTRL+d to exit the su sub-shell.

Install SMF Service

Perform the following from the root account to turn sickbeard into a managed service.

curl -sk https://gist.githubusercontent.com/baetheus/2656293c73895147f7b6/raw/sickbeard.xml > $HOME/sickbeard.xml
svccfg import $HOME/sickbeard.xml
svcadm enable sickbeard

Accessibility

The service should now be available at http://<hostname/ip>:8081

Configuration is located at /home/sick/sickbeard/config.ini.

Commentary

Since I run each of my services on their own zone with a static ip and dns configuration, I like to change the port binding to 80 on my internal home network. Thus, the net_privaddr privilege has been added to the service to allow binding to privileged ports. Additionally, if you're like me and are running your media server on smartos or another illumos derivative, you might want to look into using lofs to map your media filesystem to multiple zones. This is the reason for manually picking uid and gid for the sick user and group. Feel free to contact me if you have questions on this process. Or hit up #smartos on the Freenode irc network.

Changelog

20150407

  • Updated links to point to baetheus github user account instead of slashtact.

20150208

  • Cleaned up some references and added timezone configuration.

20150111

  • Initial Gist
  • Added SMF file
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='site/sickbeard' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<exec_method name='start' type='method' exec='/opt/local/bin/python /home/sick/sickbeard/SickBeard.py -q --nolaunch -d --config %{config_file}' timeout_seconds='60'>
<method_context>
<method_credential user='sick' group='sick' privileges='basic,net_privaddr'/>
<method_environment>
<envvar name='PATH' value='/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin'/>
<envvar name='HOME' value='/home/sick'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<property_group name='application' type='application'>
<propval name='config_file' type='astring' value='/home/sick/sickbeard/config.ini'/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>SickBeard</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment