So here we go, it’s 2023 and this blog has once more moved to another host. Initially started as a blog on Typepad in 2005, it has so far moved to a hosted server platform on which I installed WordPress (2016), to a virtual machine I could administer on my own (2018), and then, two years ago, into Docker containers on a VM (2021). Now it was time to move on again!
The idea behind the previous move into docker containers and behind a reverse HTTP proxy was to be able to host a several services on the same virtual machine that require the standard HTTP and HTTPS ports. This was a fabulous idea that has saved quite some money and resources, and the VM filled up very quickly with other projects. Recently, I noticed that some operations took quite a long time and resulted in restarts of some containers due to a lack of memory. One quick solution could have been to upgrade to a higher-tier VM instance with more RAM. But that would have meant higher monthly costs, which have already risen significantly due to inflation and higher energy prices.
So I decided to move all services from this hosted virtual machine into a virtual machine on my bare metal server I rent in a Hetzner datacenter in Finland. Here, I still have ample RAM, CPU and storage capacity and only have to pay for an additional public IP address, which costs around 2 euros a month, plus around 20 euros for the initial assignment.
One of the advantages of containers is that they can be moved very easily from one host to another. Once a reverse proxy is installed on the new host VM, a service can be transferred within minutes. All that is required:
- Shutdown of the the containers of a project on one host.
- Changing the DNS record of the domain name used by the project to point to the IP address of the new server.
- Copying the data directory and the docker-compose.yml file to the new server. A simple TAR instruction is your friend.
- Starting the service again on the new server.
Overall, moving the blog to a new home only caused an outage of 2 minutes, so I’m quite happy with the setup!
Also, it made me think how I could further optimize my backup concept. Instead of dumping the SQL database and saving the result together with the WordPress http directory that also contains all images I’ve uploaded over the years, I’m thinking about simply creating a tar file of the installation directory and copying the result to a safe place. This would create an outage of around a minute or so during the backup, but from a restore point of view, it’s an interesting option.
Anyway, a nice kick-off for 2023!