Heyo,
I was looking for a shared calendar, my prerequisites were:
- self hosted
- open source and free
- “cross-platform” (I want it on my laptop, PC and my mobile)
After some research, I ended up on Radicale it’s a small CalDAV and CardDAV python server, and it fulfills all my requirements. Also you can:
- secure the connection (I don’t mind I use HAProxy on top with Let’s Encrypt certificate, but still it’s cool)
- support authentication (I use .htpasswd)
- rights access, you can set some pretty interesting rights to your calendars, like read only for some users, and write for some others to others’ calendar …
- storage hook, you can add a hook for example git, so each time you modify a calendar it’s committed and pushed to git !
- other cool stuff, I didn’t completely review it all
So if it’s still appealing to you, follow me !
Install Radicale
Open up your terminal and do the following (still only showing Debian version):
Configure it
For security reasons and convenience, I run my Radicale server behind HAProxy, so my configuration file maybe won’t be useful to you, you just have to change the hosts though.
It’s possible you don’t want the same choice I’ve made within the configuration below either (storage, git hook, authentication, file rights) so I suggest you take a look at the wonderful documentation.
If you want to use git as a hook, and also to have an authentication mechanism which I highly recommand, do the following:
Do not forget to create the storage folder:
If you choose an “.htpasswd authentication”, you can create each access like that:
Now edit /etc/radicale/config:
Some quick explanations:
- server section is quite self explanatory
- auth section, you can define several fields such as the type of auth, where is your file and the encryption
- web needs some explanation, if you set type to none, then you won’t have the interface though the web (it’s cool when you are in production), there I comment it so I have access to the interface so I can create calendars
- logging is easy to understand
- rights, in my case I choose to load the rights from a file but there are other options
You have to init the git repository if you chose to use it:
Now create a .gitignore like that and you’re done:
Let’s move on to the configuration of rights in /etc/radicale/rights:
Again it’s quite easy to understand, a few notes:
- the name within the bracket can be what you want
- you cannot put several user in one section, let’s say you want to give rw to several user, you’ll have to repeat each section
- careful between user = .* (matches everyone including anonymous users) and user = .+ (only matches authenticated users)
A special note, in my case I have more right with my user, it can rw an other user’s calendar and also only read an other. Here’s a preview if you want to adapt it for your own purpose:
Check the configuration documentation for further details.
I suggest you have a look at the rights configuration since it can be very dangerous.
Supervisor
I use Supervisor to run Radicale in case it crashes. I know you can write an init script or you can use screen or tmux but that’s ugly.
Now let’s configure it to run Radicale in /etc/supervisor/conf.d/radicale.conf:
Time to start it:
To be clean, let’s add a logrotate in /etc/logrotate.d/supervisor:
HAProxy
As I said previously I’m running HAProxy on top, here goes one possible configuration in /etc/haproxy/haproxy.cfg:
Runtime !
Now if you connect to your Radicale web panel with one of your user created previously in the .htpasswd file, you should be able to create a new calendar or adressbook. So you can do it, that shouldn’t be hard, and it will give you a full link to your own collection, that’s the link you’ll have to insert in your clients !
Clients
On my computer I use Thunderbird with the lightning modules, careful because if you have several account in Radicale, Thunderbird only sticks to one, so I put the user and password in the URL (i.e http://username:password@example.com/) to avoid the login prompt …
On my mobile, I use Open Sync to deal with the sync of CalDAV and SolCalendar (it looks like it got removed from the Play Store recently …)
The end
If you followed well, you should remember that we have the Radicale web panel UP, I suggest to turn it off once you have created the calendar and addressbook for each of your users since you can manage events and contacts from your clients. To do so, open up /etc/radicale/config and uncomment the lines:
And don’t forget to restart Radicale through Supervisor:
Done, it should all work well 🙂
Addendum : how to get your calendar back in case you fucked up
So it happened to me few minutes ago to completely destroy my calendar using a script trough WebDAV. Hopefully I use git hook to track all modifications to my calendar so here it goes to get your calendar back !
First, don’t panic.
Secondly, go to your Radicale root lib directory, it should be /var/lib/radicale/collections and list your modifications in git:
So in this example, we can see two commits, the last one was made by a script, and the other one by me directly. We need to go back to the previous commit made by me, and not by the script, so just write down the commit number, here it’s 7fe7c14099834ef843175c06e6bd2bfa1212a68c.
Let’s go back to our previous commit:
And voilà, you got your calendar back, fiuuu !
Addendum 2: keep your Radicale up to date
It’s quite easy to do so, just run an upgrade once in a while, or read that page
You now have to restart it, if you use Supervisor as I explained above, just kill nicely the pid and it will run automagically:
Check the version is alright: