aws / opsworks-cookbooks

Chef Cookbooks for the AWS OpsWorks Service
Other
1.06k stars 1.23k forks source link

Java 8 support with Java App Server layer #306

Closed mapoulin closed 6 years ago

mapoulin commented 9 years ago

Hi !

I am trying to make the Java App Server layer work with Java 8 and so I used the following Custom JSON configuration:

{
    "opsworks_java": {
        "jvm_version": 8
    }
}

Java 8 is installed as expected but alternatives is still pointing to Java 7.

I also noticed that JAVA_HOME is redefined in /etc/sysconfig on Amazon Linux making the later manual alternatives update ineffective for the Tomcat service. Should Tomcat use the same JVM as the one defined by the system?

Since Tomcat is still running on Java 7 my application is not working when deployed.

ghost commented 9 years ago

Adding my +1 for Java 8 support

It is possible to work around this issue by specifying the following custom JSON for your stack:

"jvm_pkg" : {
   "use_custom_pkg_location" : "true",
   "custom_pkg_location_url_rhel" :
       "https://your_s3_bucket/jdk-8u31-linux-x64.gz"
}

Just make the JDK download publically available from an S3 bucket that you own. Obviously replace the JDK with whatever version of Java 8 it is you wish to install.

razeetg commented 9 years ago

Hi, I was able to install Java 8 using custom chef scripts. I had to uninstall Java 7 for this to work properly. I made a jvm_uninstall_old recipe to explicitly remove Java 7 and it worked. I can provide more details if you'd like.

gstanek commented 8 years ago

+1. Interested to know when Java 8 will be supported without any extra configuration when using opsworks

zanzan42 commented 8 years ago

Did the same thing with modifying the remove packages section of the opsworks_java cookbook to explicitly remove all jdk versions except the one I specified in custom json. Also, you have to wrap the jasper listener in the server.xml.erb template with an if statement so it only writes when <=7, because it doesn't exist in 8.

Current issue is that alternatives still points some things to openjdk even if I install a custom oracle jdk from tar. The java_sdk link and java_sdk[version] links continue to point to openjdk (both under 7 and 8). I don't think the alternatives bash section does anything with those links but just let's it default to openjdk, when it should be switching that to point to the custom jdk location.

razeetg commented 8 years ago

@zanzan42 I should have shared the link to our repo with the Java8 changes (we now have a much more customised chef setup). It includes the jasper listener changes too, and disables SSLv3 and includes headless as a default option. Might save others some time. https://bitbucket.org/aisle-team/opsworks-java

hayd commented 8 years ago

Bump! Is @razeetg's method still the best way to do this?

leelakrishnan commented 7 years ago

bitbucket link is broken.. Can you post it here

razeetg commented 7 years ago

Hey, @leelakrishnan , I don't maintain that code anymore, and the company has made it private I think. Here's a fork of that which is public right now: https://bitbucket.org/markkurk/opsworks-java. You might need to disable TLSv1 too.