Though many of you must have seen tremendously useful wikis and tutorials on how to set up, this is also one of those. But it is mainly focused on hosting on Bytesized-Hosting provider. I will also be linking most of the stuff to other tutorials from where I got the information.
What is the end result?
- Rclone mount
- Plex server setup
- Radarr for Movies
- Sonarr for T.V Shows
- Nzbget for NZB handling
- Deluge (Torrent)
- Jackett (Indexer)
- Ombi (User Requests)
- Bazarr (Subtitles)
- Filebot (Optional)
What it doesn't include and why?
- Couchpotato (since Radarr is much better)
- Sickbeard / Sickrage (since Sonarr is more stable)
- Olaris Rename (works great, but Filebot is supreme)
- Cardigann (Jackett works better)
- Bytesized account
- SSH (Putty for Windows)
- Filezilla (FTP application for easy handling of files)
- Your own Client I.D and Secret for Rclone - You can see this tutorial.
1) Run "rclone config"
2) press n
3) Give name
4) Choose 13 for Google Drive
5) Put Client I.d
6) Put Client Secret
7) Put 1 (scope full access)
8) Root folder default
9) Service account default
10) Choose 'N' for Advanced config
11) Choose 'N' for Auto config (since we are in a headless machine) (a link will show, copy with highligting it and open in browser, login, click advanced, go to rclone, allow)
12) Y (If it is a google team/shared drive)
13) Write your team drive number if you selected "Y" above
13) Y (after checking all is fine)
We will follow this wonderful tutorial - Bytesized Tutorial. I did some few minor changes to Rclone parameters which I feel worked much better. So, let us continue. Rclone is used to mount the google drive and mergerfs fuses this drive to make flow of data from server to drive seamless. We will create the following folder through SSH on the server:
mkdir ~/mnt
mkdir ~/mnt/gdrive
mkdir ~/mnt/media_merge
mkdir ~/media_tmp
mkdir ~/scripts
mkdir ~/.config/mergerfs
You can follow the link mentioned above and create a startup and shutdown script if you want to use gcrypt (encrypt drive); otherwise, you can continue from here. I personally do not encrypt. Both the scripts are created so that while restarting the appbox (server), Rclone mount and mergerfs automatically starts on its own.
So, open a file using nano to create a startup script.
nano ~/.startup/gdrive
Paste the following code there (Copied from the tutorial link mentioned above)
- I have added a few additional parameters to Rclone, which works well for plex.
- Remember to replace mountName with your mount name, in Rclone execution code down below. Remove < > too.
- Remember to change USER_ID, GROUP_ID, USER_AGENT in the code below. First, two can be seen by typing
id
in terminal and copy the numeric numbers. (you can create another SSH session to find this if you are inside nano). USER_AGENT can be any random string. So let's make the startup script.
#!/bin/bash
USER_ID=XXXXX
GROUP_ID=XXXXX
USER_AGENT=XXXXXXXXXXXXXXXXX
export TMPDIR=$HOME/tmp
PID_FILE=$HOME/.config/rclone/rclone.pid
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
if ! kill -0 $PID > /dev/null 2>&1; then
echo "Removing stale $PID_FILE"
rm $PID_FILE
fi
fi
/sbin/start-stop-daemon -S --pidfile $PID_FILE --make-pidfile -u $USER -d $HOME -b -a /usr/local/bin/rclone -- mount <mountName>: ~/mnt/gdrive --allow-other --user-agent="$USER_AGENT" --timeout 1h --dir-cache-time 1000h --cache-info-age 1500h --poll-interval 15s --vfs-read-chunk-size 32M --buffer-size 32M --vfs-read-ahead 256M --vfs-cache-mode full --vfs-cache-max-size 200G --vfs-cache-max-age 336h --uid $USER_ID --gid $GROUP_ID
PID_FILE=$HOME/.config/mergerfs/mergerfs.pid
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
if ! kill -0 $PID > /dev/null 2>&1; then
echo "Removing stale $PID_FILE"
rm $PID_FILE
fi
fi
/sbin/start-stop-daemon -S --pidfile $PID_FILE --make-pidfile -u $USER -d $HOME -b -a /usr/bin/mergerfs -- -f -o defaults,sync_read,auto_cache,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff $HOME/media_tmp:$HOME/mnt/gdrive $HOME/mnt/media_merge
Save it.
Now create a shutdown script using similar process.
nano ~/.shutdown/gdrive
Paste the below code (Copied from the tutorial mentioned above)
#!/bin/bash
PID_FILE=$HOME/.config/rclone/rclone.pid
/sbin/start-stop-daemon --pidfile $PID_FILE -u $USER -d $HOME -K -a /usr/local/bin/rclone
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
if ! kill -0 $PID > /dev/null 2>&1; then
echo "Removing stale $PID_FILE"
rm $PID_FILE
fi
fi
PID_FILE=$HOME/.config/mergerfs/mergerfs.pid
/sbin/start-stop-daemon --pidfile $PID_FILE -u $USER -d $HOME -K -a /usr/bin/mergerfs
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
if ! kill -0 $PID > /dev/null 2>&1; then
echo "Removing stale $PID_FILE"
rm $PID_FILE
fi
fi
Now to make both the files executable, run the following command
chmod +x ~/.startup/gdrive
chmod +x ~/.shutdown/gdrive
Till now, we have made the script that will mount and unmount the drive while restarting the server.
Now create a script that will upload from Bytesized local drive to google drive.
As you can see, we have created a folder "media_tmp", which will store the downloaded files locally on Bytesized. We will move these files from this folder to our google drive and in the process, will delete the local.
#create a file inside scripts folder
nano ~/scripts/uploadmedia
# paste the below line there
screen -dmS uploadmedia /usr/local/bin/rclone move ~/media_tmp <mountName>: --delete-empty-src-dirs -P --stats 20s --log-file=rcloneMoviesLog.txt
# replace mountName that you put in rclone config and do not include < >
# Press Ctrl + X
# Press Y for yes.
# Press Enter to save and confirm file name.
chmod +x ~/scripts/uploadmedia # to make the script executable.
We created the script to upload files. Now, we will create a **cron job **that will upload automatically, the content from local to our drive according to the script that we just made,at a specific time:
# open crontab
crontab -e
# Put below line in the file
0 5 * * * ~/scripts/uploadmedia
# Save it by pressing Ctrl + X, Y and the Enter
# This will upload everyday at 5 a.m server time.
You can visit crontab.guru to understand the convention of setting up the time.
At the end, restart the appbox (server) and wait few minutes for it to mount (generally huge collection takes time to mount. Small drive will mount instantly).
To cross check if both rclone and mergerfs is working, you can check from the memory usage dashboard on Bytesized websute or you can run ps -ef
in the terminal to see both are running.
Order | Utility | Guide | Support |
---|---|---|---|
3. | Nzbget | Nzbget | Github Forum |
4. | Deluge | Deluge | Github Forum |
5. | Jackett | Jackett | Github Reddit |
6. | Radarr | Radarr | Discord Github Reddit |
7. | Sonarr | Sonarr | Discord Github Forum Reddit |
8. | Plex | Plex | Forum |
9. | Bazarr | Bazarr | Discord Github Reddit |
10. | Ombi | Ombi | Discord Github |
11. | Filebot | Filebot | Forum |
Index | Topic |
---|---|
1. | Radarr 4K Instance |
2. | SubZero bundle for Subtitles (Bazarr Alternative) |
3. | OMBI Alternative - Requestrr for discord |
4. | Gclone, to copy between drives using Service accounts |