ingenieux/beanstalker

How to deploy 2 different war files to different environments under one application

Closed this issue · 4 comments

Hi, i have one beanstalk app that have 2 environments, have two different s3Buckets for my war files. When i try to deploy my two wars to each beanstalk environment, only one war deployed to both env.

I deploy every war from its project war folder :

mvn beanstalk-maven-plugin:upload-source-bundle beanstalk-maven-plugin:create-application-version beanstalk-maven-plugin:update-environment -Dbeanstalk.environmentRef=FIRST-env.elasticbeanstalk.com -Dbeanstalk.applicationName=myapp -Dbeanstalk.s3Bucket=FIRST-war-app

mvn beanstalk-maven-plugin:upload-source-bundle beanstalk-maven-plugin:create-application-version beanstalk-maven-plugin:update-environment -Dbeanstalk.environmentRef=SECOND-env.elasticbeanstalk.com -Dbeanstalk.applicationName=myapp -Dbeanstalk.s3Bucket=SECOND-war-app

Whats the output of the wrong build? If you care, do with -X so we could look it up.

(We actually do profiles for this very same reason)

Oh wait, there`s something missing: You haven't defined a versionLabel at all. If you don't define, beanstalker will always use the latest version uploaded, regardless of its location.

Plus, the version number MUST be different.

I defined it in parent base pom properties:
<beanstalk.versionLabel>${project.version}</beanstalk.versionLabel>

  1. beanstalk-maven-plugin:upload-source-bundle this goal upload source bundle to the right place

  2. beanstalk-maven-plugin:create-application-version returns app version and source of first application, see it in log

[INFO] --- beanstalk-maven-plugin:1.5.0:create-application-version (default-cli) @ pdx-dmp-management-web ---
[DEBUG] Configuring mojo br.com.ingenieux:beanstalk-maven-plugin:1.5.0:create-application-version from plugin realm ClassRealm[plugin>br.com.ingenieux:beanstalk-maven-plugin:1.5.0, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'br.com.ingenieux:beanstalk-maven-plugin:1.5.0:create-application-version' with basic configurator -->
DEBUG applicationName = myapp
DEBUG autoCreateApplication = true
DEBUG credentialId = default
DEBUG ignoreExceptions = false
DEBUG regionName = us-west-2
DEBUG s3Bucket = SECOND-app
DEBUG s3Key = SECOND-app-web-0.1.19.war
DEBUG serverId = aws.amazon.com
DEBUG session = org.apache.maven.execution.MavenSession@61e3a1fd
DEBUG settings = org.apache.maven.execution.SettingsAdapter@eadb475
DEBUG skipExisting = true
DEBUG verbose = false
DEBUG versionDescription = Update from beanstalk-maven-plugin
DEBUG versionLabel = 0.1.19
[DEBUG] -- end configuration --

[DEBUG] Receiving response: HTTP/1.1 200 OK
[DEBUG] << HTTP/1.1 200 OK
[DEBUG] << x-amzn-RequestId: 43a1e57d-0b88-11e6-bb6f-e18e70ceaeaa
[DEBUG] << Content-Type: text/xml
[DEBUG] << Content-Length: 903
[DEBUG] << Date: Tue, 26 Apr 2016 08:24:15 GMT
[DEBUG] Connection can be kept alive for 60000 MILLISECONDS
[DEBUG] x-amzn-RequestId: 43a1e57d-0b88-11e6-bb6f-e18e70ceaeaa
[DEBUG] << "<"
[DEBUG] << "D"
[DEBUG] << "e"
[DEBUG] << "s"
[DEBUG] << "cribeApplicationVersionsResp"
[DEBUG] << "onse xmlns="http://elasticbeanstalk.amazonaws.com/docs/2010-12-01/">[\n]"
[DEBUG] << " [\n]"
[DEBUG] << " [\n]"
[DEBUG] << " [\n]"
[DEBUG] << " 2016-04-22T12:29:10.317Z[\n]"
[DEBUG] << " 0.1.19[\n]"
[DEBUG] << " [\n]"
[DEBUG] << " FIRST-app-bucket[\n]"
[DEBUG] << " FIRST-app-web/FIRST-app-web-0.1.19.war[\n]"
[DEBUG] << " [\n]"
[DEBUG] << " SECOND-app-web[\n]"
[DEBUG] << " myapp[\n]"
[DEBUG] << " UNPROCESSED[\n]"
[DEBUG] << " 2016-04-26T08:12:06.991Z[\n]"
[DEBUG] << " [\n]"
[DEBUG] << " [\n]"
[DEBUG] << " [\n]"
[DEBUG] << " [\n]"
[DEBUG] << " 43a1e57d-0b88-11e6-bb6f-e18e70ceaeaa[\n]"
[DEBUG] << " [\n]"
[DEBUG] << "[\n]
[DEBUG] Connection [id: 10][route: {s}->https://elasticbeanstalk.us-west-2.amazonaws.com] can be kept alive for 60000 MILLISECONDS
[DEBUG] Connection released: [id: 10][route: {s}->https://elasticbeanstalk.us-west-2.amazonaws.com][total kept alive: 1; route allocated: 1 of 50; total allocated: 1 of 50]
[DEBUG] Received successful response: 200, AWS Request ID: 43a1e57d-0b88-11e6-bb6f-e18e70ceaeaa
[INFO] VersionLabel 0.1.19 already exists. Skipping creation of new application-version
[INFO] SUCCESS
[INFO] null/void result

  1. beanstalk-maven-plugin:update-environment update second environment with first web application

Resolved by adding property <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
and put timestamp to versionLabel, thanks for your help