Several years ago, I began to self-host some services and it's quite fun to do. Today, as I'm now working as a devops/sysadmin I will explain what self-hosting is, its pros and cons and how to improve practices.
What is self-hosting?
It means to host services like emails, your website or a RSS feed aggregator on a computer at home. I better suggest to host your own service on a server hosted by a professionnal. We could call that self-management instead of self-hosting as it is not technically hosted at your home, but there is not really a word for it from what I know. Indeed, managing your own services hosted by a professionnal is already something difficult to do. If you want to host the services at home, you will then have even more constraints.
Cloud computing categories
There are three principal categories:
- SaaS (Software as a Service): You can directly use the software. For example, wordpress.com allows you to create and manage your blog without having to install anything.
- PaaS (Platform as a Service): You get a preinstalled plateform and the environment is already working. For example, Gandi's Simple hosting is a shared-hosting on which softwares like PHP and MySQL are already installed. You will have to upload the Wordpress files on the server in order to install the blog, then you will be able to create and manage your blog.
- IaaS (Infrastracture as a Service): You simply get an empty server. You will have to install the software yourself, for example PHP and MySQL, then upload Wordpress and install it, then you will be able to create and manage your blog.
Each category has his own pros and cons. Higher the level it is (in our case the SaaS), easier it is to install, but it's often more expensive and you have less control on the way it works. Lower the level it is (in our case the IaaS), more you will master the way it works, it is often cheaper, but it also more difficult to manage and it takes time.
We can speak about self-hosting when using a PaaS or lower, because you can choose wich software to install. If you choose the software we can admit that you master the way of operating and therefore you have to take the responsibility. It is however more complicated if we go into details.
Difference between self-hosting at home and at a hosting provider
If we look the three levels of cloud computing I described above, we can say that hosting services at home is even a lower level than IaaS, because you have to manage the hardware in addition.
The advantage of self-hosting at home is that you can control absolutely all the working of your services whereas in the case of a hosting provider you delegate the hardware and/or the software management (according to if you chose IaaS or PaaS) to avoid to have to do it yourself.
Summing up with the Wordpress example:
- If you choose a PaaS, you only have to manage Wordpress updates.
- If you choose a IaaS, you have to manage Wordpress updates, but also PHP, MySQL, Apache and the operating system. In overall, you have to manage all the software of your server.
- If you choose to self-host at home, you have the same work as for IaaS, but you have to add the Internet connection and the electricity of your server. There are even more constraints if we consider emails.
I begin with the drawbacks in order to finish my blog post with more positives things like the advantages and all the possible solutions. I will first list all the issues with self-hosting, then I will continue with those that add when you choose to self-host at home:
- Security: There are three sub-points which are the following:
- Data security: You have to take care about your data retention by doing regular backups otherwise you may lose all your data during an incident.
- Data protection: If you care about your privacy, even if you take precaution not to disseminate your data on social networks, if you didn't secure your server well, someone may access your data without you knowing it.
- Server security: You should always secure your server. It can happen that a pirate takes control of your server in order to use it for illegal stuff in which case you, as the owner, are responsible of everything which may happen on your server.
Self-hosting at home
If you want to host the services on your own server at home, you have at least three more constraints to take into consideration:
- Managing power blackout: You will have to use a power protection to avoid to get data corrumption when your server suddendly shuts down and to offer a continued service. You will also have to check that your Internet connection can work without electricity, depending of your hardware. (An article of Genma, in French, explains well this contraint)
- Hardware failure: You will have to manage and repair hardware yourself. For example, an old hard disk may stop to work and make your data unavailable. There are however solutions to avoid that like to use a RAID architecture for your hard disks.
- Internet speed: If you have a fast Internet access at home, you have no issue. But if you don't have this chance, you will be limited in the kind of services to host. Without a good Internet access you won't be able to load heavy media files from Internet.
Now that I have listed all the drawbacks, here are the advantages:
- Control on your personal data: It is the first reason to self-host. As you should normally be able to master the way the services work, you know that your data is not sold for advertising.
- Cost savings: If you install several services on the same server with the cost of IaaS or you own computer, it is often cheaper than to have several services on SaaS.
- Service control: Your service will work for as long as you take care of it. If you would depend of an external provider, he could choose to stop the services without letting you the choice. Even if in the case of Google Reader it was quite "smooth" as Google gave time to the users to migrate.
- Service personnalization: As you control your service, you can configure it at your own wish. You can for example connect services betwen them in order to automate tasks. However, in order to do that you need some advanced knowlegde and even SaaS users can benefit from automation with services like Zapier and IFTTT.
How to reduce the disadvantages
Here are some solutions to make the disadvantages less an issue.
- Manage services with automation tools like Chef and Ansible: It is the best tool for advanced users to manage their infrastrucure. These tools allow to write all you want to install on your server once in a file and to deploy as many times as you wish the configuration. These tools are used by professionnals like sysadmins and devops so they are reliable and also well maintained for those who are Open Source.
- Use Yunohost to install services: Yunohost is a software to easily install Open Source software on a server for users who are less advanced. It allows you to create your own cloud and you can benefit support from the software's community to reduce risks of breaking things.
- Use Cozy Cloud: Also for regular users, Cozy Cloud is quite similar to Yunohost, but most softwares are developed by Cozy Cloud themselves. Furthermore, Cozy Cloud has a vision of "self-data" in order to allow users to retrieve back their data and to reuse it for their own benefit.
Today's self-hosting issue
Self-hosting is often recommended in the Free Software and Open Source communities in order to take back control on your personal data. However, it is easy to say, but difficult to put into practice as it requires quite some technical skills.
Today, self-hosting is still mostly done by people who knows Computer Science, but it is also difficult to maintain the services on a day-to-day basis. We often omit the maintenance cost. It means that whatever each one skills, maintaining services requires time, and according to each one priorities, this time may not be available.
With this blog post, I wanted to show objectively to the advanced users that self-hosting is on a good way, but it's still not that great. Initiatives like Cozy Cloud and Yunohost are helping a lot, but it still limited to people who knows to use the command-line. So, we have to continue to democratizate these tools.
There are especially two subjects for which there is still no good solution: data backup and server security. Encouraging amateurs to self-host without training may increase the risk for them to see their data lost or their server compromised by a pirate. It can be argued that these issues doesn't concern only self-hosting, but you have to admit that services like Gmail and Dropbox are quite good to ensure their users don't have any problem and to remove a burden.
First of all, in order to make self-hosting more accessible, we can encourage initiatives like Indie Web, Yunohost, Cozy Cloud and "Dégooglisons Internet" (in French). Next, there are today great tools (like Docker and Ansible) to enlight services management. We should use them and improve our skills in order to:
- Offer as good service quality as big companies at an association level
- Facilitate and improve quality service of self-hosting for the most motivated
Doing this will allow people to have a bigger choice than only the GAFAM (Google Apple Facebook Amazon Microsoft) to use Internet services and to host their data. And for the advanced users it will be less time-consuming and less complicated to self-host.
One tip for those who want to self host their own services: gather yourself with friends or pay an association like the CHATONS that you trust, because it will be easier for you to manage (and time is money). If you are several to manage the services you can share the tasks and do the work on a rotating basis.
Finally, what I'm writing here is exactly what Framasoft is doing by publicly hosting services accessible to everyone, explaining how to self-host ourselves and encouraging associations to offer services themselves. Concerning myself, I will try to help by continuing to write articles about this subject that I hope will help you to better self host you own services.