Deploying instances (infrastructure as code)

(Josh Zamor) #1

We didn’t have time on today’s showcase to highlight this work and I think you should know about it.

It has a few rough edges, however in an effort to reduce the amount of time it takes to acquire new cloud resources to host instances of OpenLMIS (or other “server” infrastructure), we have a combination of Terraform (for AWS) and Ansible (focused on installing and configuring Docker) that’s beginning to take shape. This combination makes it much simpler to:

  1. Create a configuration for an instance of OpenLMIS (EC2 instance, ELB, RDS, etc)
  2. Install docker so that it may be accessed externally as our Jenkins deploy-to jobs currently expect.

By creating a new environment (e.g. UAT3), which is based off of the OpenLMIS module, one terraform apply command can create a host in AWS ready (almost) for a deploy-to job, and one terraform destroy can tear it all down. It used to take someone familiar with the process a few hours to get the heavy lifting out of the way, and now it should take about 15 minutes (or less).

It can’t do everything yet, for example:

  • Manage DNS.
  • Configure Jenkins for you with the right TLS configuration (though it is in S3 for you). (I think there’s a better alternative we should explore anyways when the timing is right).
  • Use other cloud providers (e.g. the tooling supports Azure, we just don’t yet).

This approach is generally known as Infrastructure as Code, and I’m excited that we’ve finally started our first steps with it. I’d encourage you to take a few minutes to read the README and experiment with Terraform and Ansible as time allows.

I hope to link this more thoroughly in our deployment documentation as we have time (we had to squeeze this into our schedule as it is) to update the usage instructions. Until it’s more detailed, it’s more for our internal use and it’s experimental. If you have questions they’re more than welcome.

(And thanks to Jason whom did the heavy lifting).

Best,
Josh

(Wes Brown) #2

Hey Josh,

This is really neat! I like how this concretely defines the various steps required to stand up a new environment while also making it very simple to do so without having to go through a 50-point checklist. Would it be possible to create a simple video/screencast that shows how this works in practice?

-Wes

(Josh Zamor) #3

Yes, I’ll try to patch one together quickly this week.