How to cloudify things

| Aug 18, 2022

Sasa

Today I want to share with you a simple and clean solution that hopefully might give you an help with the headache of bringing to the cloud what was not initially planned to be there.

Recently I had the need to streamline my financials: reconcile bank statements from different accounts, quantify the few coins I have tossed in investments, monitoring and get reports on my incomes and expenses. If you only have one data source from one bank, a simple spreadsheet can do the trick but if you have several accounts in different banks, more than one platform for investments, and even a PayPal account, reconciling all that data might be a nightmare seeing as they come organized in different formats.

After some research, I found a solid and open-source piece of software called GnuCash. GnuCash gives you the flexibility to arrange and classify incomes, expenses, and investments, over several accounts, with a granularity of your choice. You can also import different statement formats, from fully customizable CSV to QIF. You just have to choose how far you want to venture in.

Now, there is a problem with all this free goodness: it does not come with an embedded cloud solution, nor with a native way to support it. Such a pity!

I use different platforms throughout the week and having software tied to a specific machine will encourage me not to be disciplined in its use, and make things go south very quickly.

But I really wanted to work with GnuCash, it had everything I needed out of the box! Before abandoning this solution, I decided to look around and work on a fix.

The first interesting thing I found were the save files: nothing complicated or exotic, just a plain file that wraps an XML.

So the most obvious solution was to save that file in my Dropbox and leave it at that.

Although it wasn’t good enough: the free tier of Dropbox only offers the usage of a limited set of active devices, 3 to be precise, per account. Also, linking and unlinking devices is not that immediate. Plus, considering how Dropbox works, the versioning might be tricky, especially with linking and unlinking devices.

Next option in line: Google Drive! Actually, if I could mount a Google Drive folder like an external drive, I would read and write everything seamlessly, with the only compromise to access the file one device at a time, in order to avoid conflicts with locks and weird history drifts. A compromise I could accept.

A quick search and here is the solution, Rclone. The claimed premises are big:

Users call rclone “The Swiss army knife of cloud storage”, and “Technology indistinguishable from magic”.

This command line program seems to do what I need, allowing me to mount my remote drive in a folder. Even if the installation and the configuration for Google Drive are pretty easy, let me walk you through them.

On a Debian Machine just type:

sudo apt install rclone

With apt you might not get the current version, if you want it at all costs you have to download it and install it manually:

curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64
sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone

And if you choose the manual approach, you also need to install the manpage:

sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb

Done!

To configure Google Drive, just run:

rclone config

Then input type n to create a new remote. Pick a name, for now, I will refer to it as remote

In most cases, you would have to be good with default options. Just pay attention to the question:

Type of storage to configure.

Here you just type:

drive

Towards the end of the process a browser instance will be opened, for Google authentication; authorize, confirm and BOOM, you’re ready to go!

To access it, now you can mount it as a drive:

rclone mount remote:path/to/files /path/to/local/mount	

Just be sure to mount it in an empty directory!

Problem: every time you reboot the system you will have to mount the drive manually. If you do not mind this behavior, you are set.

Otherwise, on the Rclone wiki, you can find a template with a guide to creating and installing a system service. I would recommend this approach rather than a one-liner at the startup because it is a more solid, customizable, and lean solution.

Final considerations

I am in love with GnuCash, and I like the fact that I was able to “cloudify” it. Rclone claims seemed to be realistic, and it was so easy to make it run. Here I have just scratched the surface, but this software offers much more: a comprehensive list of supported services, files encryption, and also an API to allow remote control! About encryption, always check with your service provider: for example, on some cloud storage services it is forbidden to upload encrypted files! But this is a story for another day…

Before jumping on Rclone, I have also considered Cryptomator, but the lack of streaming options for Android, the lack of higher customization options, and the possibility of screwing up with a single master key file (leading to the destruction of the whole encrypted storage) made me try Rclone. Yes, it’s GUI is web-based and highly experimental, but do you need a GUI?

For today that’s everything. I hope I have helped sort out any issue you might have and that you find the best solution.

See you soon and till then stay tuned! ⚒

PS: Here the beautiful interpretation of sending code to the sky by craiyon.com craiyon.com

comments powered by Disqus