{"id":5935,"date":"2021-09-30T09:48:48","date_gmt":"2021-09-30T13:48:48","guid":{"rendered":"https:\/\/www.dr-chuck.com\/csev-blog\/?p=5935"},"modified":"2021-09-30T09:55:09","modified_gmt":"2021-09-30T13:55:09","slug":"sakai-development-moving-to-java-11","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2021\/09\/sakai-development-moving-to-java-11\/","title":{"rendered":"Sakai Development moving to Java 11"},"content":{"rendered":"<p>Since Sakai has moved to Java 11 for the Sakai 22 and later releases, we will need to update our developer environments.\u00a0 I also made the following changes.<\/p>\n<ul>\n<li>Use the <strong>org.mariadb<\/strong> database connector and Hibernate dialect (even if I am using MySQL 5.7).\u00a0 The connector is free and automatically deployed by Sakai so there is no extra fuss downloading the <strong>com.mysql<\/strong> connector and hand-installing it in Tomcat.<\/li>\n<li>Upgrade Maven to 3.8.1 or later<\/li>\n<li>On my fresh-install Linux environments I am switching to MariaDB as my dev database server.\u00a0 If I have an existing MySQL (i.e. MAMP on Mac or Aurora on AWS) I will just keep using it but switch to the MariaDB connector.<\/li>\n<\/ul>\n<p>I have setup and tested four different environments in the post-JDK11 environment:<\/p>\n<ul>\n<li>Matt Jones&#8217; <a href=\"https:\/\/github.com\/sakaicontrib\/docker-sakai-builder\" target=\"_blank\" rel=\"noopener\">docker-build<\/a> solution.\u00a0 This is very cool &#8211; especially for Windows.\u00a0 Matt mounts folders from your computer&#8217;s file system into his (build\/database\/sakai) docker containers so you can edit files outside of the docker containers and then build \/ run all inside docker containers with a zero footprint install on your computer other than docker itself.\u00a0 Also your database persists even when you have no docker containers running.\u00a0 The container and mounted files slows this down a bit &#8211; but if you have a super fast Windows or modern MacBook box with a lot of memory and SSD, it is plenty quick.<\/li>\n<li>My MacBook running natively installed Java, Tomcat, and MAMP using my <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener\">sakai-scripts<\/a> code.\u00a0 For Mac development it is faster than Matt&#8217;s docker solution especially for my circa-2013 MacBooks that I refuse to upgrade.<\/li>\n<li>A simple self contained Ubuntu image running under docker using my <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener\">sakai-scripts<\/a> code.\u00a0 I use this to make sure I can quickly test my scripts or Sakai&#8217;s build under ubuntu without spinning up an EC2 node or DigitalOcean Box.\u00a0 This is different from Matt&#8217;s docker approach because everything (including the MariaDB server and data) is in the docker &#8211; it is nice for quick tests because it is a zero-install other than docker on your main computer.<\/li>\n<li>An ubuntu server running on Digital Ocean \/ EC2 using my <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener\">sakai-scripts<\/a> code like <a href=\"https:\/\/dev1.sakaicloud.com\" target=\"_blank\" rel=\"noopener\">https:\/\/dev1.sakaicloud.com<\/a><\/li>\n<\/ul>\n<p>If you want to figure out things like shell settings or other configuration to adapt your own setup, you can take a look at some of the files in my sakai-scripts repo.\u00a0 If you used these scripts before, there was a complex step of getting all the environment variables set in your profile (mac or linux).\u00a0 Now each script sets its environment variable and does its thing &#8211; much better and easier to fix \/ upgrade when things change a little.<\/p>\n<p>You can examine these scripts and extract bits to use in your environment.<\/p>\n<ul>\n<li>Start with the <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener\">README.md<\/a>\u00a0it contains the overall outline of manual and automated steps.\u00a0 This shows how to setup (a) a MackBook, (b) ubuntu in a stand-alone docker, and (c) ubuntu on a stand-alone server.<\/li>\n<li>Take a look at <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/ubuntu.sh\" target=\"_blank\" rel=\"noopener\">ubuntu.sh<\/a> to see what prerequisites are needed on ubuntu.\u00a0 Because I use <a href=\"https:\/\/get.sdkman.io\" target=\"_blank\" rel=\"noopener\">sdman<\/a> the installs are much simpler &#8211; thanks Matt and Earl for teaching us about this.\u00a0 Using sdman also allows you to switch back to JDK-8 if you need to.\u00a0 It is the logical equivalent of Python virtual environments.<\/li>\n<li>Take a look at <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/qmv.sh\" target=\"_blank\" rel=\"noopener\">qmv.sh<\/a> to see things like needed environment variables to make maven work.\u00a0 Without these maven will run out of memory whilst building.<\/li>\n<li>Take a look at <a href=\"https:\/\/github.com\/csev\/sakai-scripts\/blob\/master\/start.sh\" target=\"_blank\" rel=\"noopener\">start.sh<\/a> to see the relatively complex set of environment variables needed to set up Java to run Sakai.\u00a0 These variables are adapted from the Matt \/ Earle recommendations.\u00a0 Matt designed these to be tweak able and there are some examples of things like setting up a debugger if you want that.<\/li>\n<\/ul>\n<p>I hope you find this helpful.\u00a0 I would also like to explore moving these scripts and Matt&#8217;s docker stuff into the core repository in a &#8220;dev&#8221; folder.\u00a0 It is kind of silly to have these in hard-to-find locations in contrib and my repo.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since Sakai has moved to Java 11 for the Sakai 22 and later releases, we will need to update our developer environments.\u00a0 I also made the following changes. Use the org.mariadb database connector and Hibernate dialect (even if I am using MySQL 5.7).\u00a0 The connector is free and automatically deployed by Sakai so there is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5935","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=5935"}],"version-history":[{"count":8,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5935\/revisions"}],"predecessor-version":[{"id":5943,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5935\/revisions\/5943"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=5935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=5935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=5935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}