Erik Sapir
Erik Sapir

Reputation: 24707

What is the best way to automate deployment using chef

We start to use chef in order to deploy latest war to servers. I am a bit confused what is the best way to start and perform the deployment. The process should be the following:

  1. remove instance from amazon LB
  2. deploy war to server
  3. restart Tomcat
  4. add instance to Amazon LB

We also use Jenkins to automate builds.

How chef-client should be executed on the servers? Should we use Jenkins for this?

Upvotes: 2

Views: 2329

Answers (1)

slayedbylucifer
slayedbylucifer

Reputation: 23492

Chef is used to configure an instance. So below two points should be handled by using AWS APIs (AWS SDK OR AWS CLI)

  1. remove instance from amazon LB
  2. add instance to Amazon LB

Now, you can leverage chef to do below things:

  1. deploy war to server
  2. restart Tomcat

Please take a look at application_java cookbook which will deploy pre-built artifacts. I am presuming that your Jenkins is uploading the artifacts to some place. So you can use application_java cookbook to deploy those artifacts to the server and then restart tomcat.

For adding/removing instances from ELB, I would use AWS CLI as it is the quickest way to do.

Here are some commands for your reference which will do the job: Click here and here.

Hope this helps.

Upvotes: 2

Related Questions