Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passthrough of additional ConfigurationOptionSettings. #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ If the environment variable name is a keyword, it is upper-cased and
underscores ("_") are substituted for dashes ("-"). e.g.
`:database-url` becomes `"DATABASE_URL"`.

### Configuring instance type, autoscaling, VPC, SSH, AMI, SSL

You can customize many [other settings][5] on a per beanstalk environment
basis with an options key:

:aws
{:beanstalk
{:environments
[{:name "dev"
:options {"aws:autoscaling:asg" {"MinSize" "1" "MaxSize" "1"}
"aws:autoscaling:launchconfiguration" {"InstanceType" "m1.medium"
"EC2KeyName" "mykey"
"ImageId" "ami-cbab67a2"}}}]}}

### S3 Buckets

[Amazon Elastic Beanstalk][1] uses
Expand Down Expand Up @@ -240,3 +254,4 @@ application. e.g. for Compojure add
[1]: http://aws.amazon.com/elasticbeanstalk
[2]: http://aws.amazon.com
[3]: http://aws.amazon.com/s3
[5]: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html
10 changes: 9 additions & 1 deletion src/leiningen/beanstalk/aws.clj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@
key)
value)))

(defn extra-options
[options]
(apply concat
(for [[namespace keyvals] options]
(for [[key value] keyvals]
(ConfigurationOptionSetting. namespace key value)))))

(defn create-environment [project env]
(println (str "Creating '" (:name env) "' environment")
"(this may take several minutes)")
Expand All @@ -149,7 +156,8 @@
(.setApplicationName (app-name project))
(.setEnvironmentName (:name env))
(.setVersionLabel (app-version project))
(.setOptionSettings (env-var-options project env))
(.setOptionSettings (concat (env-var-options project env)
(extra-options (:options env))))
(.setCNAMEPrefix (:cname-prefix env))
(.setSolutionStackName (or (-> project :aws :beanstalk :stack-name)
"32bit Amazon Linux running Tomcat 7")))))
Expand Down