2

Currently, our infrastructure sits on AWS (EC2, ElasticBeanstalk, RDS) and consists of a few different services that work together to create our production environment, these consist of a:

  • MySQL server
  • PHP/Apache server
  • few NodeJS servers

Currently for development, it is a real pain to setup a local environment that mimics what we have setup for production. We are using MAMP to setup mysql + apache, but to setup the node servers and configure things locally is quite time consuming.

I'd like to ditch MAMP for a solution that is more similar to the ec2 boxes that each service will run on. I've been looking into setting up docker containers on vagrant, as I think that's the way forward.

My question is: What is the best way to setup a micro-service style architecture for local development using Vagrant + docker (or whatever tool is better) so that the local environment closely matches production?

3

Vagrant has several provisioning options, including Chef or simply Shell scripts. If you are using one of these techniques to provision your EC2 instances, you should be able to use the same technique to provision your Vagrant started instances.

If, on the other hand, you're setting up your EC2 instances by hand, then you're outta luck.

Note, this assumes you haven't tightly integrated with other AWS services like DynamoDB. If you rely on proprietary AWS services, you may not be able to suitably simulate your production environment.

As to whether you should use one Vagrant instance per microservice or one Vagrant instance for all services, that depends on whether or not your microservices can co-exist. If they can, I'd put them on as few Vagrant instances as possible just to make managing the number of Vagrant instances easier. If, however, they have conflicting requirements (say in Linux versions) I'd go with 1 Vagrant instance per microservice.

  • Great! Thanks. I am using shell scripts to initiate the ec2 instances, so that's fine. I guess what I really need to know is - should I be setting up multiple Vagrant boxes to act like the different microservice servers? – Sneaksta May 12 '15 at 1:10
  • Oh, so is the question is more about how to manage the sheer number of micro instances vs. the provisioning of each instance? – Doug Richardson May 12 '15 at 1:12
  • I guess I'm not 100% sure myself, not having done this before. I think my question is more about whether it's right to setup a Vagrant box per microservice and then communicate between boxes + how to setup multiple boxes? – Sneaksta May 12 '15 at 3:21
  • 1
    I think it depends on whether or not your micro services can co-exist. If they can, I'd put them on as few Vagrant instances as possible just to make managing the number of Vagrant instances easier. If, however, they have conflicting requirements (say in Linux versions) I'd go with 1 vagrant box per microservice. – Doug Richardson May 12 '15 at 3:26
  • Ok, that's perfect. They should be able to co-exist, so I'll give that a go. Thanks so much!! :) Perhaps if you'd like to chuck part of that response in your answer, I'll mark it as correct. – Sneaksta May 12 '15 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.