GitXplorerGitXplorer
s

sbt-elasticbeanstalk

public
24 stars
8 forks
5 issues

Commits

List of commits on branch master.
Unverified
f3dc43f395f95bc1562bea90b3d0da9810caa8f1

Adding notes for 0.0.7 release

jjoescii committed 10 years ago
Unverified
344fc317249f55e2bbbfc9551d5d7c4469fc5f12

Changed git username from barnesjd to joescii

jjoescii committed 11 years ago
Unverified
b418c7be6c1594f93c1d0596f4a800b0e12c59c9

Rearranged bintray settings to get them to cooperate

jjoescii committed 11 years ago
Unverified
5b74efbaa618aea1e135c87848bd7bd0dca205c6

Updated to publish to bintray

jjoescii committed 11 years ago
Unverified
c7f14380884966c7df6e3e22deb0d1eb2e8facdc

Bumping version to 0.0.7 for release

jjoescii committed 11 years ago
Unverified
598f05edc07d9b878160826cf960df3f75b1cfc6

Removed sqs resolvers

jjoescii committed 11 years ago

README

The README file for this repository.

sbt-elasticbeanstalk

Views in the last 24 hours

This sbt plugin allows easy deployment of web archive (.war) application files to Amazon Elastic Beanstalk.

Once configured, running sbt eb-deploy uploads your application's WAR file to S3 and deploys it to your Elastic Beanstalk environment.

A sample using Play 2.1-RC1 is included.

Configuration for Play

In project/plugins.sbt, add:

resolvers += "Play2war plugins release" at "http://repository-play-war.forge.cloudbees.com/release/"

addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.9-RC1")

addSbtPlugin("com.joescii" % "sbt-elasticbeanstalk-plugin" % "0.0.7")

(Note: You need the 0.9-SNAPSHOT build of play2-war-plugin, which supports Play 2.1 and is built from git master. For convenience, is hosted on the SQS Ivy repository included above.)

In project/Build.scala, add the following at the top of the file:

import com.joescii.sbtelasticbeanstalk.{ ElasticBeanstalk, Deployment }
import com.joescii.sbtelasticbeanstalk.ElasticBeanstalkKeys._
import com.github.play2war.plugin._

Add the following settings to your project:

val main = play.Project(appName, appVersion, appDependencies).settings(
  Play2WarKeys.servletVersion := "3.0",
  ebAppBundle <<= Play2WarKeys.war,
  ebS3BucketName := "some-bucket-name",
  ebDeployments := Seq(
    Deployment(
      appName = "some-app-name",
      envBaseName = "some-environment-name",
      templateName = "my-template",
      cname = "my-cname",
      environmentVariables = Map("MyFavoriteColor" -> "blue")
    )
  ),
  ebRegion := "us-west-1"
)
  .settings(Play2WarPlugin.play2WarSettings: _*)
  .settings(ElasticBeanstalk.elasticBeanstalkSettings: _*)

You must create the S3 bucket and Elastic Beanstalk app and environment specified in this file. You can specify your preferred AWS region.

Either create a file in $HOME/.aws-credentials with your AWS credentials in the following format:

accessKey = <your AWS access key>
secretKey = <your AWS secret key>

... or pass these two values as properties to sbt:

sbt -DaccessKey=your_AWS_access_key -DsecretKey=your_AWS_secret_key

Note that the .aws-credentials file takes precedence over the System properties.

Configuration for non-Play

In project/plugins.sbt, add:

addSbtPlugin("com.joescii" % "sbt-elasticbeanstalk-plugin" % "0.0.7")

In build.sbt, add the following at the top of the file:

import com.joescii.sbtelasticbeanstalk.{ ElasticBeanstalk, Deployment }
import com.joescii.sbtelasticbeanstalk.ElasticBeanstalkKeys._

Add the following settings to your project:

seq(ElasticBeanstalk.elasticBeanstalkSettings: _*)

ebAppBundle <<= Keys.`package` in Compile

ebS3BucketName := "some-bucket-name"

ebDeployments := Seq(
  Deployment(
    appName = "some-app-name",
    envBaseName = "some-environment-name",
    templateName = "my-template",
    cname = "my-cname",
    environmentVariables = Map("MyFavoriteColor" -> "blue")
  )
)

ebRegion := "us-west-1"

You must create the S3 bucket and Elastic Beanstalk app and environment specified in this file. You can specify your preferred AWS region. Note that this assumes the web application plugin you are utilizing produces a war file with the compile:package key. This is the case for Lift, for instance.

Create a file in $HOME/.aws-credentials with your AWS credentials in the following format:

accessKey = <your AWS access key>
secretKey = <your AWS secret key>

Usage

Once you've configured sbt-elasticbeanstalk as described above, run the sbt eb-deploy task. This will:

  1. Create a WAR file for your application;
  2. Upload the WAR to S3 in the bucket you specified; and
  3. Update your Elastic Beanstalk environment to use the new WAR.

Features

Configuration pull: Run eb-config-pull at the sbt console to download environment configuration into eb-deploy/<app>/<env>.env.conf and eb-deploy/<app><tmpl>.tmpl.conf files.

Quick update: Run eb-quick-update at the sbt console to perform a quick update (an in-place swap of the WAR and a Tomcat7 restart).

Configuration push: Run eb-config-push at the sbt console to push local environment configurations to Elastic Beanstalk.

Wait until deployed: Run eb-wait to wait until all project environments are deployed (i.e., Ready status and Green health).

Cleaning: Run eb-clean to terminate old, inactive environments; run eb-clean-app-versions to delete old and, unused app versions.

.ebextensions: Play2-war-plugin's webappResource sbt key is set to war by default, so any directories or files in the war/ directory will be added to the generated WAR file. The included Play2 sample app has an example war/.ebextensions directory that sets some Elastic Beanstalk configuration settings.

Environment variables: You can specify an environmentVariables map in each Deployment that gets passed to your EB environments as environment variables.

API actions: Tasks prefixed with eb-api- map directly to the corresponding EB API commands. Try eb-api-describe-applications, eb-api-describe-environments, and eb-api-restart-app-server <env>.

Changelog

  • 0.0.7: Windows support. Decoupled from Play to support Lift, etc. Added eb-update-version. Reads System properties when ~/.aws-credentials cannot be found.
  • 0.0.6: Better, template-aware eb-config-push and eb-config-pull; added eb-quick-update
  • 0.0.5: Add configuration pushing eb-config-push and validation eb-local-config-validate.
  • 0.0.4: Add configuration pulling eb-config-pull; add eb-wait to wait until deployed; add eb-api-describe-applications, eb-api-describe-environments, and eb-api-restart-app-server tasks.
  • 0.0.3: Can set environment variables for each deployment; added Java6 check
  • 0.0.2: Added support for deployment to multiple apps and environments
  • 0.0.1: Initial release

Contributors

Quinn Slack (sqs) Joe Barnes (joescii)

License

This code is open source software licensed under the Apache 2.0 License.