Skip to content

Commit

Permalink
All services now run under unique users.
Browse files Browse the repository at this point in the history
rTorrent is now set to run in the new daemon mode. (screen no longer required)
SSL certificate is now acquired from Let's Encrypt.
Added a section on DNS registration from Namecheap and dynamic dns.
Added a section on installing Plex Media Server.
  • Loading branch information
xombiemp committed Sep 13, 2016
1 parent dcfe475 commit 0857367
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 22 deletions.
8 changes: 5 additions & 3 deletions apache-portal.conf
@@ -1,5 +1,5 @@
<VirtualHost *:80>
ServerAlias yourdomain.com *.yourdomain.com
ServerName yourdomain.com
DocumentRoot /var/www
RewriteEngine On

Expand All @@ -18,12 +18,14 @@
</VirtualHost>

<VirtualHost *:443>
ServerAlias yourdomain.com *.yourdomain.com
ServerName yourdomain.com
DocumentRoot /var/www
RewriteEngine On
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/apache2/ssl.pem
SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ProxyPreserveHost On
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Redirect permanent /gui /btsync/gui
Expand Down
7 changes: 4 additions & 3 deletions btsync.service
Expand Up @@ -3,11 +3,12 @@ Description=BTSync
After=network.target

[Service]
User=YOURUSER
Group=YOURUSER
User=btsync
Group=media
UMask=0002

Restart=on-failure
ExecStart=/usr/local/bin/btsync --config /home/YOURUSER/.config/btsync/config.json --nodaemon
ExecStart=/usr/local/bin/btsync --config /var/lib/btsync/config.json --nodaemon

[Install]
WantedBy=multi-user.target
7 changes: 4 additions & 3 deletions couchpotato.service
Expand Up @@ -3,13 +3,14 @@ Description=CouchPotato
After=network.target

[Service]
User=YOURUSER
Group=YOURUSER
User=couchpotato
Group=media
UMask=0002

Type=forking
GuessMainPID=no
Restart=on-failure
ExecStart=/opt/CouchPotatoServer/CouchPotato.py --daemon --data_dir=/home/YOURUSER/.config/couchpotato --config=/home/YOURUSER/.config/couchpotato/settings.conf
ExecStart=/opt/CouchPotatoServer/CouchPotato.py --daemon --data_dir=/var/lib/couchpotato --config=/var/lib/couchpotato/settings.conf

[Install]
WantedBy=multi-user.target
11 changes: 11 additions & 0 deletions ddclient.conf
@@ -0,0 +1,11 @@
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=namecheap
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
ssl=yes
login=yourdomain.com
password='yourlongpassword'
@
9 changes: 9 additions & 0 deletions letsencrypt.service
@@ -0,0 +1,9 @@
[Unit]
Description=Let's Encrypt certificate renewal
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/letsencrypt renew
ExecStartPost=/bin/systemctl reload apache2.service
10 changes: 10 additions & 0 deletions letsencrypt.timer
@@ -0,0 +1,10 @@
[Unit]
Description=Timer for Let's Encrypt certificate renewal

[Timer]
OnCalendar=02:00
RandomizedDelaySec=1hour
Persistant=true

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions plexupdate.conf
@@ -0,0 +1,4 @@
EMAIL='youremail@domain.com'
PASS='yourpassword'
DOWNLOADDIR='/tmp'
PLEXSERVER='localhost'
5 changes: 4 additions & 1 deletion rtorrent.rc
Expand Up @@ -23,9 +23,12 @@ directory = /CHANGE/THIS/PATH/download
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/YOURUSER/.config/rtorrent/session
session = /var/lib/rtorrent/session
session.use_lock.set = yes

# Run the rtorrent process as a daemon in the background
system.daemon.set = true

# Close torrents when diskspace is low.
#schedule = low_diskspace,5,60,close_low_diskspace=100M

Expand Down
12 changes: 6 additions & 6 deletions rtorrent.service
Expand Up @@ -3,14 +3,14 @@ Description=rTorrent
After=network.target

[Service]
User=YOURUSER
Group=YOURUSER
User=rtorrent
Group=media
UMask=0002

Type=forking
KillMode=none
Type=simple
KillMode=process
Restart=on-failure
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent -n -o import=/home/YOURUSER/.config/rtorrent/rtorrent.rc
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
ExecStart=/usr/bin/rtorrent -n -o import=/var/lib/rtorrent/rtorrent.rc

[Install]
WantedBy=multi-user.target
7 changes: 4 additions & 3 deletions sonarr.service
Expand Up @@ -3,13 +3,14 @@ Description=Sonarr
After=syslog.target network.target

[Service]
User=YOURUSER
Group=YOURUSER
User=sonarr
Group=media
UMask=0002

Type=simple
KillMode=process
Restart=always
ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions update-plexmediaserver
@@ -0,0 +1,2 @@
#!/bin/bash
/opt/plexupdate/plexupdate.sh -u -a -d /opt/plexupdate/plexupdate.conf
3 changes: 0 additions & 3 deletions update-rutorrent
Expand Up @@ -110,9 +110,6 @@ fi
if [ "$updated" == "yes" ] ; then
echo -e "Updates were installed. Restarting rtorrent..."
service rtorrent stop
chown -R www-data:www-data "$rutorrent_path"
find $rutorrent_path/share/ -type d -exec chmod 777 {} \;
find $rutorrent_path/share/ -type f -exec chmod 666 {} \;
service apache2 restart
service rtorrent start
else
Expand Down

0 comments on commit 0857367

Please sign in to comment.