How to Clone your Environment?

We have git clone repository. After this command, you will have a ready to use git repository. What do we need to do to clone an entire environment? In our case, an environment consists of databases (SQL Server, MongoDB, PostgreSQL, MySQL), web sites, web services, and windows services. We currently have development, test, and production environments. Most of the settings live in a configuration project. When we build our applications, we have to specify a configuration (Dev, Test, Prod) setting.

With this setup, it is difficult to create new environments. We would have to add new config settings and add connection strings, S3 buckets, app settings, rest api urls, etc. One possible solution is to host all settings in a database table and link the servers to this environment. But now, we have to change our code to use the new object with all our settings.

I envisioned something like: var customerDatabase = Settings[“customerDatabase”]. There is no link to a specific environment. Everything is managed at the database level. And all settings are encrypted by default.

Cloning an environment is extremely difficult using on-premise servers. It is possible but it would take weeks and many meetings. On the other hand, using a cloud provider opens up our possibilities. Using AWS, we could create images from production instances and use those images to create a brand new environment. There are also cloud formation templates that could helps us create new environments.

What about deploying our applications?

We could use AWS code deploy to handle it. Once we have a VPC, servers, databases in place, it is a matter of deploying our applications to the right server. If this is a new environment needed to test a new feature for example, we could setup a script to turn-off instances after business hours. It would be available on demand only saving on cost. Your CFO will be happy to know your are saving money.

Let me know how you clone environments. Thanks.