Score:-1

how to automate servers installation with virtualization/LAMP (small IaC)?

eg flag

How to automate server installation? What infrastructure/systems fit our needs?

We have over 10 phisical servers with over 100 VMs, mostly LAMP. Not too many but also not anything that can keep working by itself. All servers have a KVM virtualization. We host various custom made applications for our customers that we modify frequently. So this is not a single application that needs to scale. Project teams work directly with customers and with VMs and this is a requirement.

The problem we routinely get into is that reinstallation of a VM/machine gets tricky since nobody controls recent changes to them, it poses a risk of instability, people defere it as long as possible and the problems get bigger over time.

I would like to establish a reinstallation procedure at least every 3 months and on demand. Reinstallation should start with a code repository and a backup. This should not be a VM duplication.

We estimate that this will cost us about 6 manmonths every 3 months in the current setup if done by hand. How can we reduce this time and also increase repetability of the process?

The question is what software can help us with automating this task. It should be as lightweight as possible. We do not need automated node allocation. We just need to have reinstallations to be as automated as possible. We assume human oversight of each reinstallation.

Our nodes are mostly LAMP with two systems having over 1TB structured DB data, several >200GB and around 50 small, custom VMs. We can schedule a planned downtime of each system easily, so this is not a question about high availability during reinstallation.

We just need to automate reinstallation as much as possible.

eg flag
Can a person giving downvote comment on the reason? It is not polite...
Score:3
us flag

You need a configuration management framework like Ansible, Saltstack, Puppet or Chef.

That is the tool to use for managing and applying configurations. However, selecting the actual tool is a minor part of the project.

You need to design and deploy the process, where all changes to infrastructure are managed via this tool.

This requires:

  • training people to use the tool
  • changing system architecture so that changes cannot be made without the tool
  • dealing with the resistance to changing fundamental operation mode of people

You should also consider unifying the software stack infrastructure.

If each VM has a bit different software configuration, you will either have

  • a lot of duplicate code in your configuration management code for different installations
  • complex logic to choose how to apply which configuration

Either of these factors add a lot of maintenance overhead, and the end result might become as painful as your current situation.

eg flag
Thank you for the answer. Which framework would you recommend to look at first in this scenario? Do they support installation of the host virtualization?
us flag
I have only experience with Ansible. At least Ansible is extensible and it has an active community that provides many kinds of plugins for many purposes. However, you should do your own analysis / comparison of the products, because it is not possible to ask a detailed enough question to take into account every detail of your environment.
eg flag
I did a quick look at ansible wiki and it seems to be focused on managing the servers and not reinstallation. In your experience, how well would it fit the task of setting up a VM from scratch? My goal is to replace continuous changes to VMs with clean reinstallations from source control.
us flag
I use Ansible myself to install VPS servers from scratch with the software stack and configuration I want it to have. There are also plugins for provisioning VPS servers in AWS etc. I am quite sure it can cover your use case well. However, it all depends on the exact use case and details. You need to try it out yourself.
eg flag
Tero, thank you for your help. I'll give a try to Ansible.
Score:0
mx flag

Does your cloud have an API key?

Most clouds have one-click LAMP images, e.g.

Vultr: https://www.vultr.com/apps/lamp/

Digital Ocean: https://marketplace.digitalocean.com/apps/lamp

Linode: https://www.linode.com/docs/guides/lamp-stack-marketplace-app/

If not, my absolute go-to is VestaCP https://vestacp.com/install/

And https://hestiacp.com/

Both add apache backend, nginx front-end, MySQL/mariadb/postgres, and php/php-fpm. All optionals too.

For updates, I would create a separate server, drop a common SSH public key in /root/.ssh/authorized_keys that the separated server has, which can automatically log into each server, something like:

INSTANCES=(
10.0.0.5
10.0.0.6
10.0.0.7
...
)


for INSTANCE in "${INSTANCES[@]}"; do
    ssh root@${INSTANCE} /bin/bash -c "apt update -y && apt upgrade -y"
done

This is pretty much Terraform, Kubernetes etc. DIY.

Also on GitHub, there's loads of cloud-specific guides, for example:

Another Digital Ocean one: https://github.com/ethanbeyer/DigitalOcean-Droplet-Setup

An AWS one: https://github.com/elionaz/aws-LAMP/blob/master/install_lamp.sh

eg flag
I would like to be able to do a bare metal installations. Each VM has its own configuration, they vary depending on DB size etc. Some systems require more then one full machine. I would like to be able to install clean Debian or other distro selected by the team and externalize all vm specific information into our code repository.
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.