2

I have a git repo and local development environment for some Spring Micro-service application. I have a 10 EC2 instance for prod and 5 EC2 instances for test deployment.

For test and prod, we have two different branches of GIT and our plan is that ...

  1. First, we will develop code and do unit testing in our local.
  2. We will upload the code in git test brunch and deploy the changes in test EC2 instances
  3. After the successful test, we will upload the code changes in prod brunch and finally deploy the code prod EC2 instances.

copying the microservice war file in all EC2 instances one by one, for every change, is not a good idea at all I guess. Is there any automated way/service by which I can connect my GIT repo with AWS service, which will compile the code and run build and copy the war file to the specific local in a specific EC2 instance?

That has to be done per project bases, as it is a microservice so,

Procect1 war should go in EC2-1(say one ec2 instance) /home/user/war

Project2 war should go in EC2-2(say another ec2 instance) /home/user/war

something like that.

4
  • This smells like a serverfault.com question. It is also likely to have been asked and answered already, I suspect - this is a very common need. Also, you should look into Kubernetes and Helm. Commented Apr 28, 2018 at 11:58
  • can you please provide the link.... that will be great help ... Commented Apr 28, 2018 at 13:04
  • kubernetes.io and helm.sh Commented Apr 28, 2018 at 15:45
  • I guess those are not my use .... some understanding mismatch.. Commented Apr 29, 2018 at 12:42

2 Answers 2

2

You need to define a release pipeline CI & CD, now, the how you do it is too broad and depends on many factors.

enter image description here

You can go very raw using only git and implement a workflow using a post-receive hook, up to a "containerized" solution that may or may not apply depending in your case.

If you want to avoid dealing with Jenkins or buildbot you can use services like Travis CI and implement an AWS CodeDeploy. In this cases, you relay more on how you use git, and the git-flow you implement.

enter image description here

Normally every commit that goes in to develop branch is deployed into the test environment and once merged into master it goes directly into production, this heavily depends on webhooks but with some fine tuning works like a charm since at the end the full pipeline can be fully automated

If you are provisioning the instances using something like ansible or saltstack you could probably take advantage of your setup and just by adding some webhooks (like mentioned before) could be the faster rather than dealing with AWS opsworks for example.

Besides these you always have the AWS solutions but like mentioned before this is too broad and very opinionated, what works for someones may not work for you.

Sign up to request clarification or add additional context in comments.

Comments

0

You could use a build server such as Jenkins to automate this, there are ways that you can have it watch for a commit on a git branch and then trigger a build and deploy job that will compile the code and then deploy it to your instances.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.