Update Docker images when base image changes

Roundcube Webmail is also available as Docker images in various flavors. All of them use the official PHP builds as base image. Because Roundcube releases are way less frequent than PHP updates and the latter ones are often security relevant and therefore critical for production systems serving Roundcube from a Docker image, we needed to find a way to automatically re-build our images when the underlying PHP image changes. Although Docker Hub has a feature to trigger automatic builds when base images changes, this apparently doesn’t work with official base images like PHP is one. Thus we came up with our own solution to automate the monitoring and re-build of Docker images.


So what do you need for this?

  • A script to check the latest build date of the base image
  • A persistent storage of the last check or build date
  • A webhook to trigger Docker builds
  • A cron job or service to periodically run that script

Because we don’t have a dedicated server to install and run arbitrary cron jobs and you don’t what to do run this on your workstation, a cloud service can do this. The most popular candidates are AWS Lambda or Google Cloud Functions. Both providers also come with services for persistent storage. And both providers have plans that offer basic usage of their services for free. Our function only needs to run once a day and therefor we’d stay below the limits and quota of the free plans. Great!

The solution

We first tried AWS Lambda but the setup with a Redis store, virtual networks and all the necessary routing turned out to be way too complicated if you’re not already an AWS master. Setting up a Google Cloud Function with a Firebase database was much easier and straight forward for the rather simple use case of ours.

The setup is very simple. First, register at the Google Firebase Console and create a new project. Second, make yourself familiar with Google Cloud Functions and create a new database for persistent storage. Our weapon of choice was JavaScript to write the function. Third, register a webhook to trigger builds at Docker Hub. A simple POST request can be sent from the cloud function to fire a new build. Finally, register your function at the Cloud Scheduler to run periodically and without direct interaction. This is as simple as registering a Pub/Sub event that is triggered by a Cloud Scheduler job. The SDK even provides a function for this:

  .pubsub.schedule('0 9 * * *')
  .onRun(async (context) => {
    // your code here

Note that for using the Google Cloud Scheduler you need to sign up for the “Blaze” plan which is still free for a limited number of executions.

All done. Our scheduled function now runs every day and fetches the build date of the PHP base images directly from the Docker Hub API and stores the dates in the Firebase database. If a build is newer that the stored date, the Docker Hub webhook is called to trigger a new build. The cloud function code is published as a Github Gist. Feel free to use and modify it for your own project.

Roundcube for Mobile Devices

We are well aware of the fact that Roundcube performs nicely on desktop browsers, it can be operated on tablets but when opening Roundcube from a smartphone, you’re out of luck.

Although creating a fully responsive theme which works on all screen sizes is on our roadmap and some volunteers are currently drafting it, we still looking at several months until the fully integrated solution will be available.

Luckily there are alternatives, thanks to the nature of free software! The most sophisticated amongst them is the Melanie2 Larry Mobile theme by Thomas Payen. It builds on top of the jQuery Mobile framework and completely replaces the default Roundcube skin with a fully optimized view when connecting with a mobile device. To do the automatic switch, the help of an additional Roundcube plugin is required. So here’s a quick guide how to install all the pieces in order to make your Roundcube mobile friendly:

1. Download the theme from GitHub

git clone https://github.com/messagerie-melanie2/Roundcube-Skin-Melanie2-Larry-Mobile.git skins/melanie2_larry_mobile

If you don’t have a git client available, simply download the Zip archive and unpack it into skins/melanie2_larry_mobile.

2. Install “mobile” and “jquery_mobile” plugins

php composer.phar require melanie2/mobile:dev-master

Since jquery_mobile is a dependency of the mobile plugin, this command will install both plugins right away.

ATTENTION: only the mobile plugin should be activated in Roundcube. Thus, when prompted “Do you want to activate the plugin jquery_mobile? [N|y]“, type “n” and later when the same prompt appears again for the mobile plugin, accept with “y“.

That’s already it.

With both the melanie2_larry_mobile skin and the mobile plugin installed, mobile devices will automatically see the mobile theme when accessing Roundcube. Kudos to Thomas, who added the missing piece to the Roundcube universe!

The “Next” experience for Roundcube users

We all know the annoyance of (web) applications not doing what we expect them to do and staring at the tumbling “Loading…” icons has become a part of our daily routine.  The more digital tools we use, the more sensitive we become for good user experience. UX is the big buzzword and Roundcube Next is not only about faster development but also very much dedicated to significantly improve the way we interact with our webmail application of choice.

Continue reading

Why Roundcube Next will save your day as a developer

While Roundcube One originates from a private fun project with email – and only email – in mind, we have learned our lessons and are committed to do Roundcube Next right from the ground up. In the year 2015, communication combines a variety of tools we need to connect to each others. And that’s exactly what we aim to cover with the architectural design of Roundcube Next. It shall become a solid and open foundation for building communication apps on top of it. Email will certainly remain a key component as it still is the most important means of communication today. But there’s more and therefore we want to make Roundcube Next the WordPress of communication if you will.

Continue reading

Our Wish List for Encryption Browser Extensions

PGP encryption is one of the most frequently requested features for Roundcube and for good reasons more and more people start caring about end-to-end encryption in their everyday communication. But unfortunately webmail applications currently can’t fully participate in this game and doing PGP encryption right in web-based applications isn’t a simple task. Although there are ways and even some basic implementations, all of them have their pros and cons. And yet the ultimate solution is still missing.
Continue reading