Self-hosting hike

This summer I decided to have a fresh look on this WordPress-blog that I created many years ago, but never managed to do any updates to beyond the first post. My interest was revived mainly because I wanted to see what it would take to self-host some of the things I put online, also beyond blogging. After all the cloud is just someone else’s computer, why should it not be one that I control myself?

There are many reasons for wanting to taking your data back to software you run yourself, and maybe on private hardware as well. (This control is the essence of self-hosting as I see it). The advantage is not just more privacy and less dependence on the big companies in the attention economy, something which is of great concern to many. It is also motivating to avoid having such a fragmented array of applications and cloud services in use every day, with the lack of overview that gives – what do you have and where is it? Even though privacy can be better on some paid services, data silos are real and contribute to the fragmentation. An example is Notion, a service I tried out but did not pursue for long, after I realised that the things I did there would in practice never leave the Notion product, even though I could download a data dump. To me this fragmentation was the main motivation to finally try to do some application hosting on my own.

I have shared some of the things I found here, in hope that it can be of use to someone else.

WordPress plug-ins

A first natural stop was WordPress, since I already had that up and running for this blog. WordPress is enormous on an internet-scale, with an estimated 43% of websites running it in 2024. There is a whole industry of companies hosting WordPress for you, but also many that provide commercially supported plugins. I would guess it is the largest commercial platform for self-hosted cloud software in the world. And even though WordPress is mainly about showing your pages to others (and selling things online), there is a great variety of plugins.

Just an example of things you can find:

  • Kanban – style planning tools. I ended up using WP Project Manager for myself, but there are many to choose from.
  • Knowledge-base tools and wikis
  • Photo galleries
  • Note taking tools

If a web-host is your preferred type of server, and you are interested in applications like the this, WordPress can be a good choice. It is easy to set up and maintain, and web-hosting can be very low cost.

But it is clear that WordPress is not a fully complete application suite for personal use, and while it is possible to use WordPress for developing new things I set my sights on other self-hosted contenders with more capabilities.

My next destination was Nextcloud, which turned out to be a steep learning curve but that was largely because of where I came from. It turns out there is path-dependence in self-hosting, but you do not have to take the same path as I did.

Nextcloud

Nextcloud is an open-source suite of cloud applications centred around a file sharing service that can be self hosted, but is also offered as a hosted service from several providers. The company behind it it is fully employee-owned and has developers around the world in addition to the headquarters in Berlin. There are applications for note-taking, calendaring, photo sharing, an office suite, a well developed video meeting service, and much more.

It is appealing because it can take so many cloud services and replace them with a single self-hosted portal. So it has absolutely “defragmenting” potential. Just as an example search of data in all apps within Nextcloud works like a charm.

Nextcloud is also mature and based on the quite “boring” LAMP stack, which is a plus when you intend to run it yourself to get things done, not primarily to learn something new and get a new hobby. There are plenty of learning resources online for running LAMP applications, and also quite some for Nextcloud itself, though the core documentation could always have been better.

In principle Nextcloud can be run from a basic web-hosting service, which is what I tried first. I could actually set up a working instance this way during a one-day bus trip (!) But it turns out it is not practical to run the software this way, except for maybe some simple cases.

These are some of the requirements to run it well:

Cron job access

Nextcloud defers quite a lot of work to background tasks, which can be set up to run periodically in a few ways. One alternative is so-called webcron jobs, which is offered by many webhosts. The documentation mentions that this is suitable for sites with 1-5 users, which is unfortunately misleading. For the file sharing, even a single home user with an average-size photo collection will generate more background maintenance tasks than can be processed in reasonable time webcron. The reason for this is that webcron can only handle one job per invocation, and webcron jobs can not be scheduled very frequently. In my case I calculated it would take weeks to get through the background tasks with the webcron scheduler which could only send requests a handful of times per minute.

With cron jobs in place, Nextcloud will process several jobs per invocation, and the list of background jobs at any time ended up being modest once I set up this. This was only possible after after I had moved the application to my own server at home, though you might be able to find advanced webhosts that offers unix cron jobs. Usually it means going for a VPS or your own server though.

php.ini access

To handle large files, it is necessary to change timeouts for php scripts running on the server. Free modification of php.ini is not always offered from web hosts. In addition more settings may have to be changed to improve the performance of the application. In practice this another reason that a VPS or server is needed.

Plenty of primary storage

Setting up object storage independent from the server filesystem can be an advantage, as it will allow you to grow storage space as needs change. I set up Nextcloud with S3-compatible storage from Cloudflare, but Azure and OpenStack is also supported.

Nextcloud discriminates between primary and external storage. External storage is treated as a regular shared file system and can therefore be an alternative when the storage has to be usable independently of Nextcloud, say if Nextcloud has downtime or is decommissioned. Primary storage on the other hand keeps much filesystem details in Nextclouds SQL database, and only raw file data is visible in the storage.

External storage may sound appealing because it may allow simple backups for instance. In practice it is only fine for minor existing pieces of data that has to be made available to Nextcloud, and not the bulk of your data. The reason for this is quite simply that the performance of external storage in Nextcloud can be horrible, to the point that the system is not very usable. For instance loading a folder would take many seconds in my setup with external S3 storage. This is another area where the documentation is over-optimistic by portraying external storage as a practical choice, but primary storage possibly being a bit faster. (This may be because the primary storage module has gone through optimisations after the documentation was written, making the performance difference between primary and external higher)

For mac users: configure your client

A major part of Nextcloud is dropbox-style synchronised storage of files.

In case you have a Mac, the client software does not work out of the box for large files above 100MB.

This is due to lack of chunking in transfer, which can be enabled by a configuration file change: https://github.com/nextcloud/desktop/issues/4271

Get your e-mail host elsewhere

To work 100%, Nextcloud should be set up to send email through SMTP, for instance to allow password recovery through e-mail.

Setting up a server to send mail in a proper, modern, secured way is quite time consuming. I would recommending using another service provider here, though it is a less self-hosting-pure choice of course.

If you do set up an email-server, a static IP address is definitely preferable, otherwise you will have a hard time getting reverse DNS lookups checks to not match your forward DNS hostname – some email receiving sites still require this. There are much better ways to authenticate senders today, but such a mismatch will still be pulling down your score as an email-sender since it shows you are on a dynamic DNS and therefore maybe a compromised home computer.

Nextcloud appliances, democratizing self-hosting?

There are many options for getting Nextcloud already configured on a small machine for home use that you can buy. I have not tested any of these, but pretty sure it can be a time-saving choice, and even open up self-hosting for those who may not have the right sysadmin skills.

I installed Nextcloud manually on a Raspberry Pi 5, but should I do it again I would definitely consider the nextcloudpi project from the list above. It comes as an installer and pre-configured image maintained by volunteers, and has much functionality like a management dashboard, which means you do not have to do command line work. Despite the PI in its name it will run on many types of hardware. Today self-hosting is more akin to running your own smart-home server, but maybe we one day can get to the point where it is just as normal as having WiFi or a laptop at home.

Leave a comment

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