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

[NETBEANS-2400] Fix for AWS Cloud missing Regions #1312

Merged
merged 1 commit into from Sep 10, 2019

Conversation

@peedeeboy
Copy link
Contributor

peedeeboy commented Jun 20, 2019

What this PR does

  • Updates AWS regions in NB to include all current AWS regions
  • Updates AWS Java SDK to 1.11.569 - needed as newer regions use v4 signing protocol
  • Enables creation of JavaEE 7 applications when AWS container is running Tomcat 8.x
  • Filters available AWS Containers to only those running Tomcat

Controversies!

  • AWS Java SDK 1.11.569 moves/removeds some classes/methods. This causes the NB sigtest to abort the build. I don't think the AWS SDK will ever be really stable in the way NB's internal APIs usually are (especially when we jump to AWS SDK v2), so I have added the sigtest.gen.fail.on.error=false project property to ignore the sigtest errors...
  • I have not updated the org.apache.commons.codec and org.apache.commons.logging modules with new .jar files. From my testing, the AWS SDK worked fine with the current libraries. If the AWS modules are expanded, these may need to be updated if any new methods/classes are consumed..

Files Changed

Amazon Elastic Beanstalk Module

  • AmazonDeploymentFactory.java - Passes regionCode into new AmazonDeploymentManager instances
  • AmazonInstance.java - Uses the new Client Builder classes (which require the Region Code, rather than Endpoint) rather than the now deprecated constructors. Creates a default instance profile with sensible (?) values, as the Java SDK doesn't create one by default!
  • AmazonInstanceTest.java - Now uses system temp directory rather than hardcoded path and is altered for modified AmazonInstance constructor
  • AmazonJ2EEServerInstanceProvider.java - Now also stores Region Code in properties
  • AmazonWizardComponent.java - Contains full list of current AWS instances and also includes their Region Code
  • AmazonDeploymentManager.java - Passes in Region Code to AmazonInstance when deploying an application
  • AmazonJ2eePlatformImpl2.java - Now checks if Container is running Tomcat 8.x and if so allows creation of Java EE 7 application
  • Project.xml - Module now depends on Amazon SDK module 1.16
  • AmazonInstanceManager.java - Now stores Region Code in instance properties
  • AmazonWizardPanel.java - Now stores Region Code in properties
  • AmazonWizardIterator.java - Passes Region Code into AmazonInstanceManager
  • ViewAdminConsoleAction.java - Uses Region Code to generate URL, rather than parsing Endpoint
  • AmazonJ2EEServerWizardComponent - Filters AWS Containers to only those running Tomcat

Amazon SDK Module

  • binaries-list - Removed references to old dependencies, and added Maven central references for new dependecies
  • project.xml - Dependencies updated
  • manifest.mf - API version updated to 1.16
  • project.properties - Added sigtest.gen.fail.on.error=false to prevent sigtest stopping the build due to deprecated/removed methods in the SDK. Updated dependency locations
  • Several license files removed & added

Testing

  • If running from NB, build Amazon SDK module, then Amazon Elastic Beanstalk module. Otherwise, build NB.

  • In NB, Services tab -> Cloud -> Right-click -> Add Cloud...

  • Cloud: Amazon Beastalk -> Next -> Pick a region (check all AWS regions now in dropdown) -> Enter Key ID and Secret Access Key -> Next -> Finish

  • File menu -> New Project -> Java with Maven -> Web Application -> Next >

  • Complete Name & Location Details -> Next >

  • Click Add next to Server

  • Choose Server = Amazon Beanstalk -> Next >

  • Complete Application Name, Environment Name & Environment URL fields

  • Pick the Container running Amazon Linux 3.1.6 & Tomcat 8.5

  • Click Finish

  • Make sure new Server is selected in dropdown and Java EE version = Java EE 7 Web -> Finish

  • Services tab -> AWS Beanstalk node -> Right-click -> Open AWS Console

  • Log in to AWS. Go and make a cup of tea whilst you wait for the new Environment to start (status = Green), takes ~ 5 minutes

  • AWS Beanstalk node -> Right-click -> Refresh. Under the Servers node, the AWS Tomcat node show now show running icon

  • Projects -> Right-click on project -> Run

  • Go and make another cup of tea whilst AWS reconfigures (~ 3 minutes)

  • Check output and make sure deployment successful.

  • Browser will open. Most likely a blank page. Refresh and application should be displayed...

Don't forget to Terminate the environment and delete the application in AWS control panel!!

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Jun 20, 2019

@matthiasblaesing - if you get chance, I would appreciate your critical appraisal, particularly around license files in AWS SDK module...

@peedeeboy peedeeboy force-pushed the peedeeboy:NETBEANS-2400 branch from 68a78f9 to b2e9a2b Jun 21, 2019
@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Jun 21, 2019

Updated -license.txt headers as per https://cwiki.apache.org/confluence/display/NETBEANS/Legal+FAQ. Hopefully, this will resolve the Travis build failure...

@peedeeboy peedeeboy force-pushed the peedeeboy:NETBEANS-2400 branch from b2e9a2b to e88e9ae Jun 21, 2019
@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Jun 21, 2019

Updated -license.txt files (again!) so that they exactly match the content of the nbbuild/licenses folder. Added binary dependencies that are the same as Gradle module to ignored-overlaps, as two module are probably never likely to be updated at the same time....

3rd time lucky?

@peedeeboy peedeeboy force-pushed the peedeeboy:NETBEANS-2400 branch from e88e9ae to 9dad715 Jun 21, 2019
@matthiasblaesing

This comment has been minimized.

Copy link
Contributor

matthiasblaesing commented Jun 25, 2019

I'll have a look at it, will most probably take till next week though.

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Jun 26, 2019

@matthiasblaesing No rush! Appreciate your time and patience.

Copy link
Contributor

matthiasblaesing left a comment

I would merge license and notice files for the aws-java-sdk files into one. If I interpret it correctly, you are already getting the notice file from the repository, as amazon publishes the jars without it. You can use a single license file if you add a "Files: " header, that references all binaries. (it looks as if jmespath comes from the same repository and could by included in the unification).

I only looked that licenses and not on the code itself, so this is only a partial review.

@peedeeboy peedeeboy force-pushed the peedeeboy:NETBEANS-2400 branch from 9dad715 to 0edacc8 Jul 20, 2019
Copy link
Contributor

matthiasblaesing left a comment

I had a second look at it and overall this looks good. I now also had a quick look at the code and left some comments inline. I don't have an aws account and I don't know details of the SDK, so take the comments with a grain of salt.

It would be great if you could have a look at the diff with a whitespace changes highlighting viewer (I think gitk does this), I think there was trailing white space newly introduced somewhere.

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Aug 4, 2019

Thanks for the feedback @matthiasblaesing. Unfortunately, I cannot make the requested changes as it seems like it is no longer possible to create Amazon Beanstalk server instances in NB11.1 or builds from master? (Only Tomcat, Glassfish and Payara servers can be created)

I'm not sure if this is as accidental bug that has been introduced, or if it is a deliberate decision to remove AWS support? If the later, this PR could be Closed.

@geertjanw

This comment has been minimized.

Copy link
Member

geertjanw commented Aug 4, 2019

Why would there be a deliberate decision to remove AWS support? :-) If there's a bug, just file an issue, and since you're doing great with your enhancements and fixes, please also consider fixing it.

@matthiasblaesing

This comment has been minimized.

Copy link
Contributor

matthiasblaesing commented Aug 4, 2019

As I already said: I don't own an AWS account, so you need to tell me a bit more, where you expect what. There was some work in the JavaEE area to support JavaEE8 and this might have disrupted things, but with a recent local build, I have the "Cloud" entry in the services tab. Please check if the JavaEE plugins are all activated.

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Aug 4, 2019

With a fresh install of NB11.1 and enabling all Java + JavaEE features, where the Amazon Beanstalk entry is missing is:

New Project -> Java with Maven -> Java Web -> Server & Settings -> JavaEE7 -> Add

Amazon Beanstalk should be in the list of Server types to add to the Project, but isn't anymore (Only Tomcat, Glassfish & Payara).

I remember seeing something on the NB Mailing list about duplicate entries in this dialog after Payara was merged in, so suspect it may be related to this (rather than JavaEE8), but without tracing the related commits/PRs and going through the code I can't be certain at this point.

I will have a look myself if I get time.

@matthiasblaesing

This comment has been minimized.

Copy link
Contributor

matthiasblaesing commented Aug 4, 2019

I think you mean PR #1347, indeed that PR looks as if it touched relevant code. @jGauravGupta could you please have a look at this PR. Long story short: AWS entries are expected to be present in the list of Java EE servers but are not anymore.

@jGauravGupta

This comment has been minimized.

Copy link
Contributor

jGauravGupta commented Aug 5, 2019

Sure @matthiasblaesing, soon I will have look on this issue.

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Aug 5, 2019

Thank you, @jGauravGupta !!

@jGauravGupta

This comment has been minimized.

Copy link
Contributor

jGauravGupta commented Aug 6, 2019

Hi @peedeeboy,

I also don't have AWS account. May you review and test the PR feature: #1412

@geertjanw

This comment has been minimized.

Copy link
Member

geertjanw commented Sep 4, 2019

Ready to be merged or not?

@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Sep 4, 2019

@geertjanw - not quite! Once #1412 is merged, I can rebase off master, make the the couple of changes @matthiasblaesing requested and test everything plays nicely together :)

@geertjanw

This comment has been minimized.

Copy link
Member

geertjanw commented Sep 4, 2019

Excellent.

@peedeeboy peedeeboy force-pushed the peedeeboy:NETBEANS-2400 branch from 0edacc8 to 3f1fedc Sep 8, 2019
@peedeeboy

This comment has been minimized.

Copy link
Contributor Author

peedeeboy commented Sep 8, 2019

Requested changes made. Hope all ok now :)

@matthiasblaesing

This comment has been minimized.

Copy link
Contributor

matthiasblaesing commented Sep 10, 2019

Looks good to me.

@matthiasblaesing matthiasblaesing merged commit 4785964 into apache:master Sep 10, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@junichi11 junichi11 added this to the 11.2 milestone Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.