How to expose Sonarr / Radarr calendar without exposing the services themselves?

Usually, most users prefer to have their services be accessible only via local network. However, if you wish to see the calendar for your followed titles from Sonarr / Radarr, it can become an issue as local domains typically are considered insecure, especially if you want to add it to an external source. This prevents from subscribing to the calendars via a direct link because most calendar software complains about the connection being insecure.

However, Sonarr / Radarr is rather forgiving in this regard, because both of those services expose their calendar pretty easily. Thus, the SOLUTION:

  • Use curl / wget to download the .ics file from Sonarr / Radarr;
  • Place the files, for instance, in /var/www/html or anywhere you prefer;
  • Expose only those two files to the internet without having to expose your services.

Now, this can be executed in numerous ways. The options that I would like to mention are:

  • You can have the same server expose the files, thus you would have no need to use wget as you can simply do a cp to copy the files to the desired location.
  • Or you have a different server for exposing the files, thus having the server that contains Sonarr / Radarr isolated as much as possible. If you wish to keep them isolated, I do recommend using a cronjob to fetch the .ics files using wget as that is the easiest way to make sure they are updated regularly and fast.

Downloading / copying the calendar files using cronjob

You can set up a cronjob to make this as simple as possible using wget. For that, we can use crontab:

crontab -e

In crontab, at the bottom we can add the following:

*/15 * * * * wget --no-check-certificate -O /var/www/html/Sonarr.ics "SonarriCalLink"
*/15 * * * * wget --no-check-certificate -O /var/www/html/Radarr.ics "RadarriCalLink"

This job executes every 15 minutes. That means your calendar is updated every 15 minutes to make sure it is up-to-date.

A couple notes:

  • You will need to get your Sonarr / Radarr iCal links, which can be taken from Sonarr / Radarr GUI in the Calendar tab.
  • /var/www/html location is an example, so you will have to ensure whatever location you end up using is accessible via browser. This usually is done with a reverse-proxy like nginx.
  • If you will be using the same machine to host the files, instead of using wget, you would end up using something like this: cp "/path/to/file" "/path/to/public/dir/file". This would copy your .ics file to the public location.

That is IT. You have a working calendar that is exposed using reverse-proxy for you to use on all of your devices without issues.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *