Riffing on a previous post about doing continuous deployment to Elastic Beanstalk, I just did a setup to get Play Framework to deploy to Elastic Beanstalk.
Basically, the crux of it is to use a plugin that builds WAR files for Play. To accomplish this, I used https://github.com/play2war/play2-war-plugin. The plugin has you update the version number and it builds the WAR based on that name, but that gets weird for doing deployment from the same location. I modified the instructions and used this in build.sbt:
version := "latest"
After that, it was just running the following:
sbt war pip install awscli aws s3 cp project-latest.war s3://BUCKET/PATH/git-`git rev-parse --short HEAD`.zip --region "REGION" aws elasticbeanstalk create-application-version --application-name "APPLICATION NAME" --version-label `git rev-parse --short HEAD` --source-bundle S3Bucket="BUCKET",S3Key="PATH/git-`git rev-parse --short HEAD`.zip" --region "REGION" aws elasticbeanstalk update-environment --environment-name "ENVIRONMENT NAME" --version-label `git rev-parse --short HEAD` --region "REGION"
And that’s really it.