We are want to automate the server creation process as this saves a lot of time. In this article, we are going to talk about some patterns and anti-pattern that cause make your automation better or worse. So let’s start with this.
Antipattern: Handcrafted Server
Handcrafted servers will generally work well for companies who are managing 10-50 servers but it becomes a hell when you have to scale. You cannot go on creating 300 servers by hand.
There is a probability of a server becoming snowflake or there is drift in the configuration in servers. This problem becomes prominent as you increase in scale.
Practice: Wrap Server Creation Options in a Script
Wrapping server creation in script will make it less prone to error. As creating 100-1000 servers exactly like same is very boring and thats what we want our software to do. To do boring work with no deviation. These scripts should provide options to expose the server configuration through arguments. But providing too much argument to normal user can also cause problem. You have to think around what option you want to provide and what you should restrict to yourself.
Antipattern: Hot Cloned Server
Hot cloned servers means creation of server from a already running servers. You may think that this is the best way to get the consistency but wait. These servers change each second. So if you launched 10 servers in span of 10 min. None of them will be exactly same as the other. We want the servers we launch to be exactly the same.
Recommended Books for Devops and Infrastructure as code:
Pattern: Server Template
Solution for this is to have the template for your servers and always launch the servers from these templates. With this you get to face a problem of managing template we will talk about that in later articles.
Antipattern: Snowflake Factory
Even if you have set up to launch the servers through scripts. The servers will go out of sync if each of them was launched by users and giving a different option for each server. This will result in snowflake factory meaning it will have a set of servers that are actually different from each other.
Pattern: Server Template
The solution for this is again launching from template and doing it automatically.
The last thing that should be done after launching any server is smoke test it. The smoke test will certify the server if it will be able to take production load or not. Should it be used in production setup or not.
The motivation of this article was the book Infrastructure as Code by Keif Moriss. You can find the link of the book below.