Viewing topic: Open Source

Running Baikal DAV server on a RunCloud VPS

28 Mar 2022 / / /

A proper tech post…

If, like me, you need to keep a calendar and contacts synced between computer (M1 Mac) and phone (Android), have a limited budget, but are not willing to sell your soul or your data to a tech giant in order to do so, your options are limited. Apple iCloud? No. Microsoft Outlook? Nope. Google? Absofuckinglutely not. Zoho? No, I don’t trust them either.

Away from the giants, the best known third party option is Fruux, and I used it for quite some time, but increasingly it throws errors when Apple Calendar tries to sync, and its web interface displays HTTP 500 errors more often than real pages.

Some web hosting companies also offer CalDAV and CardDAV hosting if you use their services, but none of these companies are ones that I would actually trust to keep my data safe and help me if there was a problem (Ionos? Do me a favour…).

Self-hosting options

Now you’re talking.

There are a few possible contenders:

  • OwnCloud – PHP-based groupware, focus is on corporate solutions but self-hosting available
  • NextCloud – Fork of OwnCloud by the original creator, widely used
  • Radicale – Python-based pure CalDAV and CardDAV server (much narrower focus than NextCloud)
  • Baikal (styled as Baïkal for some reason) – PHP-based pure CalDAV and CardDAV server

There may be more but these were the ones I found.

Because I’m a PHP expert with no real experience of Python, that put Radicale out of the running for me. And after reading many comparisons of OwnCloud and NextCloud, it was clear that NextCloud attracts many more self-hosters than OwnCloud.

So, NextCloud or Baikal? One is a complete groupware environment, the other a small, lightweight, focussed solution.

Well, I tried both. Duh.

In fact, and here is a small diversion in the interests of completeness, I tried them both about 2 years ago, and failed to get either one working reliably, which is why I ended up using Fruux for ages.

In NextCloud’s case, I got it installed successfully (I believe I was using Cloudways hosting at the time), but I wanted to make proper use of the groupware features such as file storage, and I couldn’t make it accept any file uploads larger than about 10Mb. No way, no how. Looking back now, I guess it would have been related to this issue, but at the time I couldn’t get NextCloud support to take me seriously. So my assessment of NextCloud was “fuck this for a game of soldiers”.

Then I tried Baikal, but couldn’t get either Apple Calendar or Thunderbird’s Lightning to connect and sync. Since I think this was in 2020, I would have been using Baikal 0.5.x, though I can’t recall precisely.

I figured the “0.” in front of the version meant that Baikal simply wasn’t ready for primetime, and didn’t pursue it further. I found Fruux, which was free for up to 2 devices, so for a while that was OK.

Now, fast forward to 2022, and both Thunderbird and Apple Calendar keep failing to connect to Fruux. Also, as noted above, logging in to Fruux to check if events are getting through often results in HTTP 500 error pages.

So the inevitable thought that crossed my mind (well, inevitable if you’re me) was, “hmm, I wonder if Baikal is better now?”

Setting up Baikal

These days I manage a set of bare-metal VPS servers with RunCloud, which means I have far greater control over everything than when I used Cloudways. I decided that Baikal had to be worth one more try.

So, here are the steps I followed:

  1. Set up a subdomain to use for Baikal (you know, like dav.mydomain.com).
  2. Created a new system user in RunCloud.
  3. Created a new empty hybrid webapp (Nginx + Apache) in RunCloud, controlled by the above system user, and added a Let’s Encrypt certificate.
  4. Created a new database + user in RunCloud.
  5. Downloaded and unzipped Baikal 0.9.2.
  6. Read the installation instructions.
  7. Uploaded the Baikal install files to the webspace, and set the application root to point to the html folder in the RunCloud console.
  8. Ran the installer in my browser, choosing the MySQL database option.
  9. Set up a user account in Baikal and tried to connect from my Mac. No joy.

Damn, I thought.

Then I read the installation instructions again, particularly the Nginx Configuration section.

What I had thought was unnecessary code (because RunCloud sets up the virtual host automatically) actually contained a couple of lines that were related specifically to a DAV setup:

rewrite ^/.well-known/caldav /dav.php redirect;
rewrite ^/.well-known/carddav /dav.php redirect;

Oops!

So I added these two lines to a fresh custom Nginx config file in my RunCloud console. I selected the “location.main-before” priority and called the file “wellknown.conf”.

BINGO.

The Accounts app in Apple System Preferences instantly connected to Baikal – both CalDAV and CardDAV. Note that I used just the basic subdomain name as the server name when connecting (like dav.mydomain.com, no https, no slashes, no path, nothing else).

So I imported my calendar and contacts files and could see the event and contact counts gradually increasing in the Baikal admin console.

Next, I used DAVx5 on my Android phone to connect, which it did without problems.

A simple, satisfactory solution

So, I now have a private online calendar and contacts address book, hosted using open source software on a server that I pay for anyway, and accessible by as many devices as I choose. I can back it up whenever I like, either via exporting in macOS or a complete FTP backup and database dump, and I can restrict access to specific IP addresses in RunCloud if I choose.

Job done.

Share:

Free as in beer

19 Feb 2022 / /

I have a complicated relationship with FOSS (Free and Open Source Software) .

I like not paying for things where possible – who doesn’t? It makes my money go further (sometimes quite a bit further). I am also vehement in my dislike of the concept of software by subscription – if I buy something, it should be mine to use forever.

So for many years I have sought out and used free alternatives to the commercial software I would otherwise have had to buy. I use LibreOffice instead of Microsoft Office. Before LibreOffice I used OpenOffice. (Before OpenOffice I used a pirate copy of Microsoft Office like everyone else, but this article isn’t about piracy.)

As someone involved in web development, I also use graphic and design software. Initially because of the massive financial outlay, and later because of their subscription model, I have avoided Adobe software like the plague, and for several years my primary tools have been The Gimp and Inkscape.

But as my need to create SVG illustrations has grown over the last year, I have encountered more and more problems with Inkscape. The user interface is nosebleed-inducingly complex and not at all intuitive, SVGs downloaded from the web often look completely different when loaded in Inkscape, dealing with paths is very fiddly, and it continues to crash with distressing frequency.

Recently I found Inkscape simply couldn’t properly render some SVGs I had to edit, and as I was up against a deadlne, I had to find something else, and it had to be easy to use (no time for a steep learning curve).

So I had a hunt online. After I had eliminated everything that didn’t work on a Mac, everything that needed an account to use (Why? It’s a fucking image editor!), everything that ran in a browser (that’s just silly), and everything on a subscription model (see above), there wasn’t much left. There was the free macSVG, which is just garbage, and there was Affinity Designer, which isn’t free but is quite cheap and there is no ongoing subscription.

I downloaded Affinity Designer and tried it out (10 day free trial), and within 24 hours it had persuaded me to stump up the $50 for a license. Now I use it daily and it’s an absolute joy to use. After that I had to try Affinity Photo and found that it was also light years better than its open-source counterpart (The Gimp), so I’ve bought that as well. I’m saving hours every week in previously lost productivity.

Now, the point of these musings isn’t to advertise Affinity Designer or Affinity Photo, but rather to make the point that, often, you get what you pay for. Or as my wife endearingly says, you pay what you get for.

To put it another way, an application like Inkscape may have a number of talented developers working on it, but if they are not being paid for their work, that means it is not their primary focus, and they cannot be relied on to make improvements or squash bugs in a timely manner. And when an application is mission-critical, that’s often not good enough.

In its favour, free software is generally (though not always) open source, which has the useful attribute of allowing the source code to be audited to ensure it contains nothing malicious, but I’ve come to realise that this in itself isn’t enough to make the free option the best option. I feel this fact is often missed by FOSS purists (you know, the ones who think Richard Stallman is sane).

So let’s hear it for pragmatism. It’s good to save money and have access to source code, but it’s also good to get things done.

Share: