weavejester / lein-beanstalk Goto Github PK
View Code? Open in Web Editor NEWLeiningen plugin for Amazon's Elastic Beanstalk service
Leiningen plugin for Amazon's Elastic Beanstalk service
I don't see any license or copyright information. Could you clarify the state of the code?
We don't use java.commons.logging in our app -we use SLF4J's bridging adapter which provides the same interface. Your plugin assumes JCL is present and crashes if it is not present.
You should leave logging configuration decisions up to the client.
Adding AWS_ACCESS_KEY_ID and AWS_SECRET_KEY reveals my personal access keys to everyone else in the organisation that have access to beanstalk.
Instead the instance should the access key and secret provided by the role that is assigned to the instance:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
This is automatically used by the Java libraries and therefore also by for instance amazonica.
Any plans to release a new version of this plugin?
I'm setting up a beanstalk app on the sa-east-1 region, which is unsupported on 0.2.7 and is already supported on master.
Thanks,
(Sorry to create an issue, but I didn't find a mailing list or forum link on the README)
Changing the default region as described in the documentation causes an exception. For instance, adding the following to project.clj:
:aws {:beanstalk {:region "us-west-2"}}
results in this:
com.amazonaws.services.s3.model.AmazonS3Exception: The bucket you are attempting to access must be
addressed using the specified endpoint. Please send all future requests to this endpoint.
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse (AmazonHttpClient.java:614)
com.amazonaws.http.AmazonHttpClient.executeHelper (AmazonHttpClient.java:312)
com.amazonaws.http.AmazonHttpClient.execute (AmazonHttpClient.java:165)
com.amazonaws.services.s3.AmazonS3Client.invoke (AmazonS3Client.java:2966)
com.amazonaws.services.s3.AmazonS3Client.putObject (AmazonS3Client.java:1137)
com.amazonaws.services.s3.AmazonS3Client.putObject (AmazonS3Client.java:993)
leiningen.beanstalk.aws$s3_upload_file.invoke (aws.clj:87)
leiningen.beanstalk$deploy.invoke (beanstalk.clj:40)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:626)
leiningen.beanstalk$beanstalk.doInvoke (beanstalk.clj:126)
clojure.lang.RestFn.invoke (RestFn.java:442)
clojure.lang.Var.invoke (Var.java:388)
clojure.lang.AFn.applyToHelper (AFn.java:160)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:626)
leiningen.core.main$partial_task$fn__6071.doInvoke (main.clj:253)
clojure.lang.RestFn.applyTo (RestFn.java:139)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:626)
leiningen.core.main$apply_task.invoke (main.clj:303)
lein_environ.plugin$write_env_to_file.invoke (plugin.clj:11)
clojure.lang.Var.invoke (Var.java:394)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:626)
robert.hooke$compose_hooks$fn__11692.doInvoke (hooke.clj:40)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:624)
robert.hooke$run_hooks.invoke (hooke.clj:46)
robert.hooke$prepare_for_hooks$fn__11697$fn__11698.doInvoke (hooke.clj:54)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.invoke (RestFn.java:436)
leiningen.core.main$resolve_and_apply.invoke (main.clj:309)
leiningen.core.main$_main$fn__6136.invoke (main.clj:377)
leiningen.core.main$_main.doInvoke (main.clj:366)
clojure.lang.RestFn.invoke (RestFn.java:436)
clojure.lang.Var.invoke (Var.java:388)
clojure.lang.AFn.applyToHelper (AFn.java:160)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:482)
clojure.lang.Var.invoke (Var.java:401)
clojure.lang.AFn.applyToHelper (AFn.java:171)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
Probably related to this pull request:
#35
Hi,
Beanstalk now optionally takes ZIPs containing a Dockerfile. The coupling of building WARs and deployment in the deploy
task in lein-beanstalk
is an issue for this approach.
I built a little lein plugin to wrap lein-beanstalk to facilitate uploading custom files and it works OK:
https://github.com/juxt/lein-dockerstalk/blob/master/src/leiningen/dockerstalk.clj
TBH I'm not sure how you would change lein-beanstalk
, looking at the current code. The deploy task already takes a couple of args (a project and an env name). Perhaps adjust this to be variadic key/value args and take a simple 'path' parameter, and if this is present then we don't build the uberwar and use the filename from this? This would be a breaking change though.
Be interested to hear your thoughts. I'd like to decommission the plugin I built in favour of using lein-beanstalk
if possible.
I use lein-beanstalk in my project by putting the following in my project.clj
:
:plugins [[lein-beanstalk "0.2.6"]]
I then edit ~/.lein/profile.clj
to contain my AWS credentials, as advised by the README:
{:user
{:aws {:access-key "xxx"
:secret-key "xxx"}}}
I then run lein beanstalk deploy development
but get this error:
No credentials found; please add to ~/.lein/init.clj: (def lein-beanstalk-credentials {:access-key "XXX" :secret-key "YYY"})
If I run lein version
, I see Leiningen 2.0.0-preview10 on Java 1.6.0_35 Java HotSpot(TM) 64-Bit Server VM
. This was installed via Homebrew on Mac OS X Lion.
What am I doing wrong? Or is the README not up-to-date? Thanks!
lein-beanstalk ignores the https_proxy environment variable. Setting -Dhttps.proxyHost / -Dhttps.proxyPort in the :jvm-opts key in the project or profiles.clj has no effect either. Without this, lein-beanstalk fails to reach AWS servers when behind a proxy.
Hi,
Was wondering if there is any possibility of you adding the eu-west-2 (London) region as a deployment option?
Looks like it would be a two line change in the aws.clj file, adding the endpoints for s3 in s3-endpoints (line 64) and the endpoint for beanstalk-endpoints (line 74), as below:
`(def s3-endpoints
{:us-east-1 (ep "s3.amazonaws.com" "US_Standard")
:us-west-1 (ep "s3-us-west-1.amazonaws.com" "US_West")
:us-west-2 (ep "s3-us-west-2.amazonaws.com" "US_West_2")
:eu-west-1 (ep "s3-eu-west-1.amazonaws.com" "EU_Ireland")
:eu-west-2 (ep "s3.eu-west-2.amazonaws.com" "EU_London")
:ap-southeast-1 (ep "s3-ap-southeast-1.amazonaws.com" "AP_Singapore")
:ap-southeast-2 (ep "s3-ap-southeast-2.amazonaws.com" "AP_Sydney")
:ap-northeast-1 (ep "s3-ap-northeast-1.amazonaws.com" "AP_Tokyo")
:sa-east-1 (ep "s3-sa-east-1.amazonaws.com" "SA_SaoPaulo")})
(def beanstalk-endpoints
{:us-east-1 "elasticbeanstalk.us-east-1.amazonaws.com"
:us-west-1 "elasticbeanstalk.us-west-1.amazonaws.com"
:us-west-2 "elasticbeanstalk.us-west-2.amazonaws.com"
:eu-west-1 "elasticbeanstalk.eu-west-1.amazonaws.com"
:eu-west-2 "elasticbeanstalk.eu-west-2.amazonaws.com"
:ap-southeast-1 "elasticbeanstalk.ap-southeast-1.amazonaws.com"
:ap-southeast-2 "elasticbeanstalk.ap-southeast-2.amazonaws.com"
:ap-northeast-1 "elasticbeanstalk.ap-northeast-1.amazonaws.com"
:sa-east-1 "elasticbeanstalk.sa-east-1.amazonaws.com"})`
If you are open to a pull request I can do it myself?
Thanks!
/Henrik
I'm playing around with your beanstalk plugin and are having some problems.
I created a small sample app (https://github.com/ck/hello-beanstalk) and tried to deploy it to Amazon Elastic Beanstalk. Unfortunately, I always get the following error:
$ lein beanstalk deploy :production
Generating war file
Created /Users/ck/code/active/hello-beanstalk/hb-1.0.0-SNAPSHOT-beanstalk.war
Uploading war file to S3
Feb 5, 2011 12:59:36 PM com.amazonaws.http.HttpClient execute
INFO: Sending Request: PUT https://lein-beanstalk.s3.amazonaws.com / Headers: (Authorization: AWS oiehuiwef:SMFEFBWEBEW=, Date: Sat, 05 Feb 2011 17:59:36 GMT, Content-Type: application/x-www-form-urlencoded; charset=utf-8, )
Feb 5, 2011 12:59:44 PM com.amazonaws.http.HttpClient handleErrorResponse
INFO: Received error response: Status Code: 409, AWS Request ID: 1312321312, AWS Error Code: BucketAlreadyExists, AWS Error Message: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again., S3 Extended Request ID: sds
Exception in thread "main" Status Code: 409, AWS Request ID: 1312321312, AWS Error Code: BucketAlreadyExists, AWS Error Message: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again., S3 Extended Request ID: sdadsa (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:513)
at clojure.lang.Var.invoke(Var.java:385)
at clojure.lang.AFn.applyToHelper(AFn.java:187)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: Status Code: 409, AWS Request ID: 26273D3A0130396E, AWS Error Code: BucketAlreadyExists, AWS Error Message: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again., S3 Extended Request ID: dsdsdsa+dwMzZWqqY
at com.amazonaws.http.HttpClient.handleErrorResponse(HttpClient.java:519)
at com.amazonaws.http.HttpClient.execute(HttpClient.java:215)
at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:545)
at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:492)
at leiningen.beanstalk$upload_war.invoke(beanstalk.clj:41)
at leiningen.beanstalk$deploy.invoke(beanstalk.clj:69)
at clojure.lang.AFn.applyToHelper(AFn.java:165)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.beanstalk$beanstalk.doInvoke(beanstalk.clj:81)
at clojure.lang.RestFn.invoke(RestFn.java:443)
at clojure.lang.Var.invoke(Var.java:373)
at clojure.lang.AFn.applyToHelper(AFn.java:169)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:191)
at leiningen.core$_main.doInvoke(core.clj:250)
at clojure.lang.RestFn.applyTo(RestFn.java:138)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:255)
at user$eval175.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
I checked before and after the deploy and there is no bucket with that name.
Any pointers are appreciated,
-ck
Either by having lein-beanstalk-credentials
return a map that has the application name as the index, or by having something like a beanstalk.clj
in your project (that could potentially be .gitignore
'd...
Instead of using a leinigen specific configation it would be very nice if the standard DefaultAWSCredentialsProviderChain was supported.
With beanstalk offering docker containers, why not split the maintenance of environments away from deploying the artefact (wars)?
i.e. have a direct deploy-environment task?
I'm building a HTML5 game in clojure and clojurescript, and I have to run lein-cljsbuild to generate the javascript before I build the WAR, else the game doesn't work. The problem is that lein-beanstalk currently does not have a way to let me pass in a WAR file for deployment.
I couldn't get lein-beanstalk
to work in a compojure
project of mine. It was failing with the same exception as this.
To rule out my project or its dependencies, I created a new noir
project to replicate the behavior. Note that lein uberjar
works as expected and the application boots and runs as expected. Here's the steps to reproduce:
$ lein new noir footest
[ ... snip ... ]
$ cd footest
$ # add lein-beanstalk to :plugins or :dev-dependencies in project.clj
$ lein deps
[ ... snip ... ]
$ lein beanstalk info
Application 'footest' not found on AWS Elastic Beanstalk
3.153s total, 8.33s user, 0.44s system, 278% cpu
$ lein beanstalk deploy production
Compiling footest.server
Compilation succeeded.
Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at clojure.lang.Var.invoke(Var.java:385)
at clojure.lang.AFn.applyToHelper(AFn.java:185)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.NullPointerException
at clojure.core$namespace.invoke(core.clj:1252)
at leiningen.ring.war$compile_servlet.invoke(war.clj:148)
at leiningen.ring.uberwar$uberwar.invoke(uberwar.clj:47)
at leiningen.beanstalk$deploy.invoke(beanstalk.clj:39)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.beanstalk$beanstalk.doInvoke(beanstalk.clj:126)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at clojure.lang.Var.invoke(Var.java:373)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:262)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
I tested it with Clojure 1.3.0 and Clojure 1.4.0 and my lein
version is 1.7.1.
Let me know if you need any more information or if I have missed a step.
I haven't looked into this too much, but I was following the README example for defining environments in the project.clj, and it would not work until I changed the env name from a symbol to a string.
This plugin is hard-coded to an environment that no longer exists. The deploy command will fail with the following message:
com.amazonaws.AmazonServiceException: No Solution Stack named '32bit Amazon Linux running Tomcat 7' found.
Hard-coded environment selection:
Currently supported "Java with Tomcat" environments: https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.java
Leiningen 2.8.1 on Java 1.8.0_161 Java HotSpot(TM) 64-Bit Server VM
:plugins [[lein-beanstalk "0.2.7"]]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.