Cloudron – Advantages and drawbacks

What is Cloudron?

Cloudron is an application management service using docker with a nice web based interface. Basically, you install it on your own server (which is fairly easy if you use one of the major hosting providers) and then you can choose applications out of the App Store such as WordPress or Synapse to install on your server. There are currently 142 different applications you can install so you’re a little spoilt for choice. Each application is a Docker application that starts, stops, runs and restarts if it crashes. There is a demo here with cloudron for the username and the password.

It’s a really good idea.

Why did I want to use Cloudron?

For the past couple of weeks I have been looking at Cloudron as a way to manage my servers, or rather an easier way to manage the applications on those servers. Previously I had mainly been using Runcloud but I had a brief foray into YuNoHost. Runcloud is great but I have always been a little iffy about installing non PHP based applications on it. It serves PHP (WordPress, etc…) and static based websites really really well. Amazingly well actually. YuNoHost is a little different in that it is a privacy and open source based server that allows you to install multiple applications on it that are pre-setup. There is a demo here. In the end it was just a little limited for what I wanted.

The advantages of Cloudron

The main advantage of Cloudron is its interface and ease of use. Once setup with your DNS provider you can choose an application to install, a domain name or subdomain to install it under, and it will do all the rest for you. You can also use SSO (Single Sign On) with many applications giving you a slightly better form of user management. Create a user, assign them a group and then they can sign into any of the applications in the group.

It is also private. It is installed on your server and under your control and you can set up a bucket in object storage it will take care of your backups and encrypt them as well.

So many applications 🙂

Email

Email setup is also extremely easy with Cloudron doing all the work in the background. You can also setup webmail applications such as Rainloop or Roundcube for online access. Additionally it checks that all the settings are correct and gives you some nice feedback for piece of mind.

Problems with Cloudron

Unfortunately, there has been some problems Cloudron. Although I am working my way through them and most of them appear either not their problem or solvable. I’ll add in the solutions I use after each problem.

Backups

There was an initial problem with backups where Cloudron was timing out uploading them to the Linode object storage.

Solution

Swapping the backup method from tar.gz to rsync has solved this andall it working well now.

DNS setup

The first is in the DNS setup. Depending on your VPS provider you can have problems with the DNS setup and have to do it manually. Even on supported providers such as Linode, because they only refresh their DNS servers every half hour it can take some time before an application becomes able to be accessed. This is a Linode issue though so not Cloudrons fault. But you should be aware of it.

RAM

OK, so now you have Cloudron setup and there are heap of applications. The problem is you only have so much RAM and each one uses, well, quite a lot. For instance, if you want to serve a static webpage then the minimum memory that the Surfer container requires is 256MB! And sure, half of that will be RAM and half will be swap but you soon start running out of memory. If you want to install Mastodon then you will need 1.5GB of memory available, Discourse requires 2GB.

And that appears to just be the base memory. If you run a WordPress site with any amount of traffic then (like a couple of hundred visitors or so a day) then you start getting app restart messages because the application has run out of memory. At first I solved this by using the Redis plugin to cache my database queries and raising the memory to 512MB but eventually I got so many emails I raised it to 1024MB just to get it out of my hair. It seems to be running fine on that but 1GB of memory just to run a small website? That is crazy!

Solution

It appears at the moment that my problems with apps crashing was due to two possible things. The Cloudron was reading my swap as being almost 1GB but on the VPS it was only 512mb. This may have been causing the problem. After increasing the amount of swap on the VPS to 2GB I haven’t recieved a application restart notification fro about 12hrs so that seems to have fixed that.

WordPress

While we are on the subject of WordPress. If you want to swap your sites over to Cloudron using a plugin like Updraft Plus then you should raise the memory of your application before using the plugin. And, if you have weird things happening on the site when you make changes, you should be aware that the developers install of WordPress that they use (you have to use the Developers version to import sites) has some modifications in the wp-config.php file that can cause some weird glitches. Things like,

define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_UNFILTERED_HTML', true );

Or that they hardcode your site URL in the wp-config. ‘DISALLOW_UNFILTERED_HTML’ in particular broke my website every time I tried to make a certain change. Bizarre behaviour if you don’t know why it is happening.

I sort of get why they would do that but then, having done some modifications, there are others that would be quite handy on a WordPress install that they haven’t done such as implement a caching policy.

Solution

In order to get a bit more out of your WordPress application I would recommend using a Redis plugin and in .htaccess you can add a simple caching ruleset. I grabbed this one from Robin Roelofsen.

# BROWSER CACHING USING EXPIRES HEADERS
<IfModule mod_expires.c>
    ExpiresActive On
  
    # Images
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
  
    # Video
    ExpiresByType video/mp4 "access plus 1 year"
    ExpiresByType video/mpeg "access plus 1 year"

    # CSS, JavaScript
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"

    # Others
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>

# BROWSER CACHING USING CACHE-CONTROL HEADERS
<ifModule mod_headers.c> 
    # One year for image and video files
    <filesMatch ".(flv|gif|ico|jpg|jpeg|mp4|mpeg|png|svg|swf|webp)$">
        Header set Cache-Control "max-age=31536000, public"
    </filesMatch>

    # One month for JavaScript and PDF files
    <filesMatch ".(js|pdf)$">
        Header set Cache-Control "max-age=2592000, public"
    </filesMatch>

    # One week for CSS files
    <filesMatch ".(css)$">
        Header set Cache-Control "max-age=604800, public"
    </filesMatch>
</ifModule>

In conclusion

In the end I think I am going to have to go with a mix of solutions. Having easy access to all the extra applications is great and I am sure I am already forgetting the downside of carefully testing everything is in place and working and as I solve each problem it is looking better and better.

Give it a go. It is free for two apps with only 20 users and it really is a very pretty interface. 🙂 And having apparently solved the problems with applications running out of memory it is looking fairly solid.

Leave a comment