Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI with Amazon Elastic Beanstalk

I have a web application http://codefu-5euzxjdg6b.elasticbeanstalk.com/codeKungfu.jsp that is currently being hosted on Amazon Elastic Beanstalk with a Java backend.

The flow process that I have in mind is this:

  • Commit to GitHub repo
  • Travis CI is triggered. Run unit tests.
  • All test cases pass. Deploy on Amazon elastic beanstalk.

Currently, I am stuck at Step 3, where I am attempting to link up Travis CI with Amazon elastic beanstalk.

I have searched for information online with regards to this but was unable to find anything that seems to be useful. The best information source that I obtained was: https://superuser.com/questions/510593/elastic-beanstalk-rails-application-with-git-source-and-deploy-hooks

I understand that Travis CI is able to deploy to Google App Engine directly, and thus I believe that there should be a solution for Amazon Elastic Beanstalk as well.

Could anyone kindly point me to resources that could potentially help me solve this issue?

Thanks!

like image 230
Alvin Kwang Avatar asked Apr 10 '13 05:04

Alvin Kwang


People also ask

What is Elastic Beanstalk used for?

AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, . NET, PHP, Node. js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.

Does Elastic Beanstalk use EC2?

Elastic Beanstalk supports several Amazon EC2 instance purchasing options: On-Demand Instances, Reserved Instances, and Spot Instances. An On-Demand Instance is a pay-as-you-go resource—there's no long-term commitment required when you use it.


2 Answers

As of 9th Dec 2014, Elastic Beanstalk deployment is not covered in Travis CI deployment documentation: http://docs.travis-ci.com/user/deployment/

However, Travis CI has open sourced their deployment tool: dpl and Elastic Beanstalk deployment is an ongoing development: https://github.com/travis-ci/dpl

It's best to refer to the source itself to figure out how to do the deployment.

At present, here's a working sample of my deployment settings in .travis.yml:

deploy:
  provider: elasticbeanstalk
  access_key_id: <AWS Access Key>
  secret_access_key:
    secure: <secure secret access key>
  region: <region, eg. ap-southeast-1>
  app: <app name>
  env: <environment name>
  bucket_name: <S3 bucket name that is used by elastic beanstalk>
  on:
    repo: <repo name>
    branch: develop
like image 125
Jon Avatar answered Oct 22 '22 15:10

Jon


Did you end up making progress on this? I think that it should be possible with Travis's encrypted variables to store a key or your AWS credentials. Then you could use those credentials with the AWS API to do the deploy itself from within your .travis.yml after_script section.

like image 34
David Avatar answered Oct 22 '22 14:10

David