TheChiefMeat

Caddy & File Browser For Home Cloud Storage


Installing & Configuring Caddy & File Browser

The following will explain how to download, install and configure Caddy with the File Browser plugin as a home cloud backup solution. For this tutorial I'm going to be using an Odroid C2, but pretty much any operating system is compatible with Caddy. For an overview of the File Browser plugin, visit the below link to check it out:

File Browser Plugin

The easiest way to install Caddy with the File Browser plugin is to install it via Curl, so let's go ahead and install Curl first:

sudo apt-get install curl

Once Curl has been installed, we can visit the Caddy Website. Choosing our operating system here doesn't matter as we're going to be installing using Curl, but if you're installing on an operating system that doesn't have Curl installed, go ahead and set which operating system you have.

Now go ahead and select the plugin we wish to download, in this case the http.filemanager plugin, and finally the license, in this can the personal, non-commercial license.

As I'm going to be using Curl for the download, I'm simply going to copy and paste the "One-setup installer script" written in Bash and copy and paste that line into my terminal:

curl https://getcaddy.com | bash -s personal http.filemanager

This will go ahead and install Caddy and the File Browser plugin for you, so just sit back and wait. If you're using another operating system, you'll have to press the download button and unzip the .zip file you'll recieve to a folder of your liking, and cd to that folder.

Running Caddy with the File Browser plugin is very simple:

caddy filemanager &

Running the above command might show the an error; if so, simple Control + C, paste the below command in and run it again:

ulimit -n 8192

Now we simply navigate to the local IP address of our device with the port shown, in my case port 2015. The first thing your see is a login page, so go ahead and log in with the default username and password (admin/admin):



Once you've logged in you'll be presented with a view of the root folder, shown in the above image (your contents might look different). The first thing you should do is change the default password of the admin account to something secure, you can find this option in the settings, user management page:



Now we need to mount our external hard drives that are going to be used as storage. For this demonstration I'm simply using two 32Gb USB sticks. First we need to install the ntfs-3g driver if that isn't installed already, as well as rsync:

sudo apt-get install ntfs-3g rsync

With the driver installed, we need to find the UUIDs for each of the two USB drives we're going to be using for storage. For this I've formatted both drives as NTFS on my Windows PC and labeled them; one as STORAGE, one as BACKUP, and put a mount.txt file on each of them.

Once you've formatted the drives, go ahead and plug both into your device and search for the UUIDs like so:

blkid

This will return a list of devices, you should see your STORAGE and BACKUP drives, as well as their UUIDs, go ahead and make a note of them both now.

We'll be editing the /etc/fstab file to ensure that both drives are mounted upon boot:

sudo nano /etc/fstab

Edit the two below lines where the STORAGEUUID and BACKUPUUID are shown with the two respective UUIDs, and paste them into the file and save:

UUID=STORAGEUUID /root/STORAGE auto nofail,uid=0,gid=0,umask=0027,dmask=0027,noatime 0 0
UUID=BACKUPUUID /root/BACKUP auto nofail,uid=0,gid=0,umask=0027,dmask=0027,noatime 0 0

Once this is done, we need to go ahead and create the two folders STORAGE and BACKUP:

sudo mkdir STORAGE
sudo mkdir BACKUP

Go ahead and reboot your device. Now if you cd into either the STORAGE or BACKUP folders, you should see a mount.txt file in each, showing they've been mounted successfully.

With the drives mounted, go ahead and cd into the STORAGE folder, and make a folder for your account with your name. Changing the scope setting on the user page that we just visited will allow you to set specific root folders for each user that has an account. In my case I made a folder called TheChiefMeat, and set my scope to:

./STORAGE/TheChiefMeat

Setting it this way allows each user to have their own folder without seeing anyone elses folder, or the content of other users folders. Do this for each user.

With your scope path set, returning to the root folder will now show an empty folder ready for use, so feel free to throw in a few files to test it out.

Finally we need to set up rsync to copy over all of our files from STORAGE to BACKUP, so we always have a copy of all our files. We can achieve this by using crontab to run the task weekly:

sudo crontab -e

This will open up crontab. Paste the following line of code at the bottom of the page:

0 23 * * fri rsync -av --delete /root/STORAGE/ /root/BACKUP

With this configuration, crontab will attempt to run the command every week on Friday at 23:00. If you'd like a different configuration, check out the crontab.guru website.

Go ahead and run the below command now, you should see rsync copying over the files you just put into the STORAGE folder to the BACKUP folder:

rsync -av --delete /root/STORAGE/ /root/BACKUP

And that pretty much wraps up how to set up Caddy alongside the File Browser plugin for a simple home cloud backup solution.

If you'd like a dark theme for the File Browser plugin, go ahead and check out this Github page and copy and paste the theme code into the global settings Custom Stylesheet theme box.