Score:0

Best practices for VPS versioning

gb flag

I regularly need to develop some services based on Linux, free software, and closed-source applications. I use the QEMU virtual machine as a development environment where I directly edit the files on the running instance and make the tests at the same time. When the thing is ready, I copy all the files on the production server, which is made from a fresh OS installation, with a complete configuration of the new environment. Obviously, when the system is in production, I need to manually synchronize the 2 environments to make them similar. When I fix a bug in production, I need to back-port the fix in the development environment.

The development contains several parts:

  • Linux scripts & software configuration (/etc, /var/www, /home, .config files, firewall rules, etc)
  • Dependencies (list of software to download from software repository (i.e. apt-get install xxx)
  • The application
  • The database

I would like to know how to make proper versioning of this complex environment.

I tried the following approaches.


Approach 1: develop the project based a backup/restore script

The backup script creates a complete TAR file of all the required elements: script to download all the dependencies, all the files from the application, required configuration files from /etc, the last version of backup and restore scripts, dump of the database, etc.

The restore script erase all the current application and replace it by the version present in the TAR file. This approach is working properly but is a little cumbersome. It need a lot of attention to make sure the restore script is working properly from a fresh installation.


Approach 2: run QEMU virtual machine in the VPS

This approach might be a little bit ridiculous, I didn’t test it yet. The idea would be to also use a Virtual Machine in my production environment. Here, I would just copy the virtual machine to the VPS and run QEMU inside the VPS. When I want to backup, I just save the Virtual Machine disk somewhere. It may not be very efficient, but it’s probably acceptable for the project I work on.


Approach 3: use GIT

I also didn't test this approach, but I thought about it. The idea would be to do use a software versioning software such as GIT on the full filesystem after the installation of the OS. This way, I would commit all the changes (binary and text files). I could publish the changes to production using the SCM program.


Approach 4: use a dedicated software

This approach is based on specific software. I had a look in this direction and heard about software named Kurbernetes, Puppet or other names. This seems very complicated to setup and I didn’t spent much time to investigate there.

What are the best practices regarding the versioning of Linux-based environments?

cn flag
Bob
Version your configuration by making use of a configuration management system (such as Ansible, chef, etc) and keeping your playbooks/recipes under version control.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.