From cc31f433185614f31bfdcad281c00ec3729b67aa Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 8 Jun 2023 12:29:08 -0700 Subject: [PATCH 01/37] add aws fargate demo --- aws-fargate/HELP.md | 75 +++++ aws-fargate/README.md | 108 ++++++ aws-fargate/mvnw | 316 ++++++++++++++++++ aws-fargate/mvnw.cmd | 188 +++++++++++ aws-fargate/pom.xml | 45 +++ .../NativeFargateDemoApplication.java | 13 + .../src/main/resources/application.properties | 1 + .../NativeFargateDemoApplicationTests.java | 13 + 8 files changed, 759 insertions(+) create mode 100644 aws-fargate/HELP.md create mode 100644 aws-fargate/README.md create mode 100644 aws-fargate/mvnw create mode 100644 aws-fargate/mvnw.cmd create mode 100644 aws-fargate/pom.xml create mode 100644 aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java create mode 100644 aws-fargate/src/main/resources/application.properties create mode 100644 aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java diff --git a/aws-fargate/HELP.md b/aws-fargate/HELP.md new file mode 100644 index 000000000..b9124faf5 --- /dev/null +++ b/aws-fargate/HELP.md @@ -0,0 +1,75 @@ +# Read Me First +The following was discovered as part of building this project: + +* The original package name 'com.example.native-fargate-demo' is invalid and this project uses 'com.example.nativefargatedemo' instead. + +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/html/#build-image) +* [GraalVM Native Image Support](https://docs.spring.io/spring-boot/docs/3.0.7/reference/html/native-image.html#native-image) +* [Spring Web](https://docs.spring.io/spring-boot/docs/3.0.7/reference/htmlsingle/#web) + +### Guides +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) + +### Additional Links +These additional references should also help you: + +* [Configure AOT settings in Build Plugin](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/htmlsingle/#aot) + +## GraalVM Native Support + +This project has been configured to let you generate either a lightweight container or a native executable. +It is also possible to run your tests in a native image. + +### Lightweight Container with Cloud Native Buildpacks +If you're already familiar with Spring Boot container images support, this is the easiest way to get started. +Docker should be installed and configured on your machine prior to creating the image. + +To create the image, run the following goal: + +``` +$ ./mvnw spring-boot:build-image -Pnative +``` + +Then, you can run the app like any other container: + +``` +$ docker run --rm -p 8080:8080 native-fargate-demo:0.0.1-SNAPSHOT +``` + +### Executable with Native Build Tools +Use this option if you want to explore more options such as running your tests in a native image. +The GraalVM `native-image` compiler should be installed and configured on your machine. + +NOTE: GraalVM 22.3+ is required. + +To create the executable, run the following goal: + +``` +$ ./mvnw native:compile -Pnative +``` + +Then, you can run the app as follows: +``` +$ target/native-fargate-demo +``` + +You can also run your existing tests suite in a native image. +This is an efficient way to validate the compatibility of your application. + +To run your existing tests in a native image, run the following goal: + +``` +$ ./mvnw test -PnativeTest +``` + diff --git a/aws-fargate/README.md b/aws-fargate/README.md new file mode 100644 index 000000000..4c6b2c8ff --- /dev/null +++ b/aws-fargate/README.md @@ -0,0 +1,108 @@ +GraalVM on AWS Fargate Demo +============================= +This demo will walk you through the process of containerizing a Native Image application and then launching the image on the AWS platform by using the Amazon Elastic Container Registry and AWS Fargate. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. + +Prerequisites +---------------------- +Ensure that you have the following installed and follow the linked instructions for any that you are missing: +- Docker: https://docs.docker.com/desktop/ +- Apache Maven: https://maven.apache.org/install.html +- Amazon Web Service CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html + - Once installed, configure your AWS credentials: https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-user.html#cli-authentication-user-configure-wizard +- Amazon Elastic Container Service: https://docs.aws.amazon.com/AmazonECR/latest/userguide/get-set-up-for-amazon-ecr.html + +1. Download and install the latest GraalVM JDK with Native Image using the [GraalVM JDK Downloader](https://github.com/graalvm/graalvm-jdk-downloader). + ```bash + bash <(curl -sL https://get.graalvm.org/jdk) + ``` +2. Download or clone GraalVM demos repository: + ```bash + git clone https://github.com/graalvm/graalvm-demos + ``` + +Deploy a Native Image Container on Amazon ECR +---------------------- +1. Navigate to the directory for this demo: +```bash +cd graalvm-demos/aws-fargate +``` +2. Build the container image: +``` +mvn -Pnative spring-boot:build-image +``` +Build-image + + +3. Create a new ECR repository to store the image: +``` +aws ecr create-repository --repository-name native-fargate-repo +``` +4. Use the outputted *repositoryUri* to tag the image: +``` +docker tag native-fargate-demo:0.0.1-SNAPSHOT REPOSITORYURI +``` +5. Authenticate the Uri for the repository with your credentials: +``` +docker login -u AWS -p $(aws ecr get-login-password) REPOSITORYURI +``` +6. Use the Uri once again to push the image to the Amazon ECR: +``` +docker push REPOSITORYURI +``` + +Deploy the Service on AWS Fargate +------------------------- +1. Login to the [Amazon Web Service dashboard](http://console.aws.amazon.com/) +2. In the “Services” drop-down menu on the top-left of the page, select “All services” and navigate to the “Elastic Container Service” page +3. Click on "Clusters" on the left-side pane +4. Create a new cluster using the button on the top-right of the page +![Clusters](https://github.com/egadbois/graalvm-demos/assets/134104678/5d0e044b-a778-47d1-a57f-81474c51b646) + +5. Choose a name for the cluster and leave the remaining settings as their default + - If you would like to be able to view insights about the container image perforamance, activate Container Insights under "Monitoring" + + ![New cluster](https://github.com/egadbois/graalvm-demos/assets/134104678/24cbafd1-6ebe-4452-b53d-02b8eb564708) + +6. Once you have created the new cluster, navigate to "Task definitions" by selecting it on the left-side pane +7. Create a new task definition by clicking the button on the top-right corner +![Task definitions](https://github.com/egadbois/graalvm-demos/assets/134104678/c673da9d-cd0e-4970-824b-d597928b5e1b) + +8. Choose names for the Task Definition Family and Container +9. Paste the REPOSITORYURI used in the prior section into the "Image URI" text box + - To find the URI again click the "Amazon ECR" link on the left-side pane and select "Repositories". Your repository will appear along with the corresponding URI +10. Leave the remaining options as their default and create the new Task Definition +11. Return to the list of Clusters and select the Cluster that you created +12. Under "Tasks" click the "Run new task" button +![New Task](https://github.com/egadbois/graalvm-demos/assets/134104678/f7250fe2-7f5b-4416-8413-2f2387d74ac4) + +13. Choose "Task" as the Application Type +14. Choose the newly created Task Definition under the "Family" drop-down menu and choose a name for the service +![Create task](https://github.com/egadbois/graalvm-demos/assets/134104678/06babf2b-7a12-4373-8533-b34d06a96960) + +15. Under "Networking" -> "Security Group" select "Create a new security group" +16. Choose a name and description for the new group +17. For "Type" select "All traffic" and for "Source" select "Anywhere" +![Security group](https://github.com/egadbois/graalvm-demos/assets/134104678/db30659b-01f8-4281-b8ad-78803250786e) + +18. Click "Create" to create and deploy the task +19. Select the task currently running and copy the public IP address displayed on the right side of the page +![Public IP](https://github.com/egadbois/graalvm-demos/assets/134104678/d382fab0-c6e7-42ed-bf1b-5980d1f6e953) + +20. In a new browser tab, type the IP address in the format: http://PUBLICIP:8080/hello +21. You should see a "Hello World" message displayed! + +![Hello world](https://github.com/egadbois/graalvm-demos/assets/134104678/23955a8b-166d-4a55-8617-5e312a38c191) + + +Clean-Up +----------------- +To prevent incurring additional charges after you are finished with the demo you first need to stop the service that you created. To do so, follow these instructions: +1. Visit the Task Definitions page and select the task currently running +2. Under Actions select "Deregister" +3. Change the drop-down view menu to show "Inactive task definitions" +4. Select the task definition and under Actions select "Delete" +![Delete task](https://github.com/egadbois/graalvm-demos/assets/134104678/5bc8120c-2303-4bb1-9d8d-cb59e883fca5) + +6. Return to the cluster that you created and delete the task currently running +7. Use the button on the top-right of the screen to delete the cluster itself +![Delete cluster](https://github.com/egadbois/graalvm-demos/assets/134104678/5ce61747-30f4-423a-aff7-82c0d43492df) diff --git a/aws-fargate/mvnw b/aws-fargate/mvnw new file mode 100644 index 000000000..8a8fb2282 --- /dev/null +++ b/aws-fargate/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/aws-fargate/mvnw.cmd b/aws-fargate/mvnw.cmd new file mode 100644 index 000000000..1d8ab018e --- /dev/null +++ b/aws-fargate/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/aws-fargate/pom.xml b/aws-fargate/pom.xml new file mode 100644 index 000000000..3a41ccfa2 --- /dev/null +++ b/aws-fargate/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.0.7 + + + com.example + native-fargate-demo + 0.0.1-SNAPSHOT + native-fargate-demo + GraalVM Native Image on AWS Fargate demo + + 17 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.graalvm.buildtools + native-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java b/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java new file mode 100644 index 000000000..7068284c6 --- /dev/null +++ b/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java @@ -0,0 +1,13 @@ +package com.example.nativefargatedemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class NativeFargateDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(NativeFargateDemoApplication.class, args); + } + +} diff --git a/aws-fargate/src/main/resources/application.properties b/aws-fargate/src/main/resources/application.properties new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/aws-fargate/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java b/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java new file mode 100644 index 000000000..4fa8f3736 --- /dev/null +++ b/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.nativefargatedemo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class NativeFargateDemoApplicationTests { + + @Test + void contextLoads() { + } + +} From 170241967c6f7a9d4009ac570d0f5a4b725ca16c Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 8 Jun 2023 12:34:14 -0700 Subject: [PATCH 02/37] Create aws-fargate.yml --- .github/workflows/aws-fargate.yml | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/aws-fargate.yml diff --git a/.github/workflows/aws-fargate.yml b/.github/workflows/aws-fargate.yml new file mode 100644 index 000000000..871a82f38 --- /dev/null +++ b/.github/workflows/aws-fargate.yml @@ -0,0 +1,39 @@ +name: aws-fargate +on: + push: + paths: + - 'aws-fargate/**' + - '.github/workflows/aws-fargate.yml' + pull_request: + paths: + - 'aws-fargate/**' + - '.github/workflows/aws-fargate.yml' + schedule: + - cron: "0 0 1 * *" # run every month + workflow_dispatch: +permissions: + contents: read +jobs: + run: + name: Run 'aws-fargate' + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + include: + - version: 'latest' + java-version: '17' + - version: 'dev' + java-version: '17' + steps: + - uses: actions/checkout@v3 + - uses: graalvm/setup-graalvm@v1 + with: + version: ${{ matrix.version }} + java-version: ${{ matrix.java-version }} + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Run 'aws-fargate' + run: | + cd aws-fargate + mvn -Pnative spring-boot:build-image From 0010cc3a23e8b1f16d1162444ab6a7ed607b80a0 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 8 Jun 2023 12:35:43 -0700 Subject: [PATCH 03/37] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4a62ddc3e..879468c24 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,10 @@ cd graalvm-demos native-image-jmx-demo
nnative-image-jmx-demo This demo covers the steps required to build, run, and interact with a native executable using JMX.
Technologies: Native Image, JMX, VisualVM
Reference: Build and Run Native Executables with Remote JMX + + + aws-fargate
aws-fargate + This demo covers the steps required to create a container image of a native executable application and deploy the image onto AWS Fargate.
Technologies: Native Image, Apache Maven, Docker, AWS Fargate
From 47e00b99dd4a86da71b6ecd5673cef199019d528 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Fri, 9 Jun 2023 11:22:08 -0700 Subject: [PATCH 04/37] Update aws-fargate.yml --- .github/workflows/aws-fargate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/aws-fargate.yml b/.github/workflows/aws-fargate.yml index 871a82f38..27988f8f4 100644 --- a/.github/workflows/aws-fargate.yml +++ b/.github/workflows/aws-fargate.yml @@ -35,5 +35,6 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run 'aws-fargate' run: | + pwd cd aws-fargate mvn -Pnative spring-boot:build-image From e1f3048529486dddfee4b6193a367d2b72b77d90 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Fri, 9 Jun 2023 11:34:33 -0700 Subject: [PATCH 05/37] Update NativeFargateDemoApplication.java --- .../NativeFargateDemoApplication.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java b/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java index 7068284c6..c02f77c9f 100644 --- a/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java +++ b/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java @@ -1,3 +1,44 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package com.example.nativefargatedemo; import org.springframework.boot.SpringApplication; From 30ec95155cae20d68e7352716c53dae17b8f0cdf Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Fri, 9 Jun 2023 11:34:49 -0700 Subject: [PATCH 06/37] Update NativeFargateDemoApplicationTests.java --- .../NativeFargateDemoApplicationTests.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java b/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java index 4fa8f3736..5e51d68b9 100644 --- a/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java +++ b/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java @@ -1,3 +1,44 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package com.example.nativefargatedemo; import org.junit.jupiter.api.Test; From 46e265b78520b57b34d706d57e7fabde025fc0ce Mon Sep 17 00:00:00 2001 From: egadbois Date: Fri, 16 Jun 2023 22:29:48 +0000 Subject: [PATCH 07/37] removed old demo --- aws-fargate/HELP.md | 75 ----- aws-fargate/README.md | 108 ------ aws-fargate/mvnw | 316 ------------------ aws-fargate/mvnw.cmd | 188 ----------- aws-fargate/pom.xml | 45 --- .../NativeFargateDemoApplication.java | 54 --- .../src/main/resources/application.properties | 1 - .../NativeFargateDemoApplicationTests.java | 54 --- 8 files changed, 841 deletions(-) delete mode 100644 aws-fargate/HELP.md delete mode 100644 aws-fargate/README.md delete mode 100644 aws-fargate/mvnw delete mode 100644 aws-fargate/mvnw.cmd delete mode 100644 aws-fargate/pom.xml delete mode 100644 aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java delete mode 100644 aws-fargate/src/main/resources/application.properties delete mode 100644 aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java diff --git a/aws-fargate/HELP.md b/aws-fargate/HELP.md deleted file mode 100644 index b9124faf5..000000000 --- a/aws-fargate/HELP.md +++ /dev/null @@ -1,75 +0,0 @@ -# Read Me First -The following was discovered as part of building this project: - -* The original package name 'com.example.native-fargate-demo' is invalid and this project uses 'com.example.nativefargatedemo' instead. - -# Getting Started - -### Reference Documentation -For further reference, please consider the following sections: - -* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) -* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/html/) -* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/html/#build-image) -* [GraalVM Native Image Support](https://docs.spring.io/spring-boot/docs/3.0.7/reference/html/native-image.html#native-image) -* [Spring Web](https://docs.spring.io/spring-boot/docs/3.0.7/reference/htmlsingle/#web) - -### Guides -The following guides illustrate how to use some features concretely: - -* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) -* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) -* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) - -### Additional Links -These additional references should also help you: - -* [Configure AOT settings in Build Plugin](https://docs.spring.io/spring-boot/docs/3.0.7/maven-plugin/reference/htmlsingle/#aot) - -## GraalVM Native Support - -This project has been configured to let you generate either a lightweight container or a native executable. -It is also possible to run your tests in a native image. - -### Lightweight Container with Cloud Native Buildpacks -If you're already familiar with Spring Boot container images support, this is the easiest way to get started. -Docker should be installed and configured on your machine prior to creating the image. - -To create the image, run the following goal: - -``` -$ ./mvnw spring-boot:build-image -Pnative -``` - -Then, you can run the app like any other container: - -``` -$ docker run --rm -p 8080:8080 native-fargate-demo:0.0.1-SNAPSHOT -``` - -### Executable with Native Build Tools -Use this option if you want to explore more options such as running your tests in a native image. -The GraalVM `native-image` compiler should be installed and configured on your machine. - -NOTE: GraalVM 22.3+ is required. - -To create the executable, run the following goal: - -``` -$ ./mvnw native:compile -Pnative -``` - -Then, you can run the app as follows: -``` -$ target/native-fargate-demo -``` - -You can also run your existing tests suite in a native image. -This is an efficient way to validate the compatibility of your application. - -To run your existing tests in a native image, run the following goal: - -``` -$ ./mvnw test -PnativeTest -``` - diff --git a/aws-fargate/README.md b/aws-fargate/README.md deleted file mode 100644 index 4c6b2c8ff..000000000 --- a/aws-fargate/README.md +++ /dev/null @@ -1,108 +0,0 @@ -GraalVM on AWS Fargate Demo -============================= -This demo will walk you through the process of containerizing a Native Image application and then launching the image on the AWS platform by using the Amazon Elastic Container Registry and AWS Fargate. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. - -Prerequisites ----------------------- -Ensure that you have the following installed and follow the linked instructions for any that you are missing: -- Docker: https://docs.docker.com/desktop/ -- Apache Maven: https://maven.apache.org/install.html -- Amazon Web Service CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html - - Once installed, configure your AWS credentials: https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-user.html#cli-authentication-user-configure-wizard -- Amazon Elastic Container Service: https://docs.aws.amazon.com/AmazonECR/latest/userguide/get-set-up-for-amazon-ecr.html - -1. Download and install the latest GraalVM JDK with Native Image using the [GraalVM JDK Downloader](https://github.com/graalvm/graalvm-jdk-downloader). - ```bash - bash <(curl -sL https://get.graalvm.org/jdk) - ``` -2. Download or clone GraalVM demos repository: - ```bash - git clone https://github.com/graalvm/graalvm-demos - ``` - -Deploy a Native Image Container on Amazon ECR ----------------------- -1. Navigate to the directory for this demo: -```bash -cd graalvm-demos/aws-fargate -``` -2. Build the container image: -``` -mvn -Pnative spring-boot:build-image -``` -Build-image - - -3. Create a new ECR repository to store the image: -``` -aws ecr create-repository --repository-name native-fargate-repo -``` -4. Use the outputted *repositoryUri* to tag the image: -``` -docker tag native-fargate-demo:0.0.1-SNAPSHOT REPOSITORYURI -``` -5. Authenticate the Uri for the repository with your credentials: -``` -docker login -u AWS -p $(aws ecr get-login-password) REPOSITORYURI -``` -6. Use the Uri once again to push the image to the Amazon ECR: -``` -docker push REPOSITORYURI -``` - -Deploy the Service on AWS Fargate -------------------------- -1. Login to the [Amazon Web Service dashboard](http://console.aws.amazon.com/) -2. In the “Services” drop-down menu on the top-left of the page, select “All services” and navigate to the “Elastic Container Service” page -3. Click on "Clusters" on the left-side pane -4. Create a new cluster using the button on the top-right of the page -![Clusters](https://github.com/egadbois/graalvm-demos/assets/134104678/5d0e044b-a778-47d1-a57f-81474c51b646) - -5. Choose a name for the cluster and leave the remaining settings as their default - - If you would like to be able to view insights about the container image perforamance, activate Container Insights under "Monitoring" - - ![New cluster](https://github.com/egadbois/graalvm-demos/assets/134104678/24cbafd1-6ebe-4452-b53d-02b8eb564708) - -6. Once you have created the new cluster, navigate to "Task definitions" by selecting it on the left-side pane -7. Create a new task definition by clicking the button on the top-right corner -![Task definitions](https://github.com/egadbois/graalvm-demos/assets/134104678/c673da9d-cd0e-4970-824b-d597928b5e1b) - -8. Choose names for the Task Definition Family and Container -9. Paste the REPOSITORYURI used in the prior section into the "Image URI" text box - - To find the URI again click the "Amazon ECR" link on the left-side pane and select "Repositories". Your repository will appear along with the corresponding URI -10. Leave the remaining options as their default and create the new Task Definition -11. Return to the list of Clusters and select the Cluster that you created -12. Under "Tasks" click the "Run new task" button -![New Task](https://github.com/egadbois/graalvm-demos/assets/134104678/f7250fe2-7f5b-4416-8413-2f2387d74ac4) - -13. Choose "Task" as the Application Type -14. Choose the newly created Task Definition under the "Family" drop-down menu and choose a name for the service -![Create task](https://github.com/egadbois/graalvm-demos/assets/134104678/06babf2b-7a12-4373-8533-b34d06a96960) - -15. Under "Networking" -> "Security Group" select "Create a new security group" -16. Choose a name and description for the new group -17. For "Type" select "All traffic" and for "Source" select "Anywhere" -![Security group](https://github.com/egadbois/graalvm-demos/assets/134104678/db30659b-01f8-4281-b8ad-78803250786e) - -18. Click "Create" to create and deploy the task -19. Select the task currently running and copy the public IP address displayed on the right side of the page -![Public IP](https://github.com/egadbois/graalvm-demos/assets/134104678/d382fab0-c6e7-42ed-bf1b-5980d1f6e953) - -20. In a new browser tab, type the IP address in the format: http://PUBLICIP:8080/hello -21. You should see a "Hello World" message displayed! - -![Hello world](https://github.com/egadbois/graalvm-demos/assets/134104678/23955a8b-166d-4a55-8617-5e312a38c191) - - -Clean-Up ------------------ -To prevent incurring additional charges after you are finished with the demo you first need to stop the service that you created. To do so, follow these instructions: -1. Visit the Task Definitions page and select the task currently running -2. Under Actions select "Deregister" -3. Change the drop-down view menu to show "Inactive task definitions" -4. Select the task definition and under Actions select "Delete" -![Delete task](https://github.com/egadbois/graalvm-demos/assets/134104678/5bc8120c-2303-4bb1-9d8d-cb59e883fca5) - -6. Return to the cluster that you created and delete the task currently running -7. Use the button on the top-right of the screen to delete the cluster itself -![Delete cluster](https://github.com/egadbois/graalvm-demos/assets/134104678/5ce61747-30f4-423a-aff7-82c0d43492df) diff --git a/aws-fargate/mvnw b/aws-fargate/mvnw deleted file mode 100644 index 8a8fb2282..000000000 --- a/aws-fargate/mvnw +++ /dev/null @@ -1,316 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /usr/local/etc/mavenrc ] ; then - . /usr/local/etc/mavenrc - fi - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`\\unset -f command; \\command -v java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/aws-fargate/mvnw.cmd b/aws-fargate/mvnw.cmd deleted file mode 100644 index 1d8ab018e..000000000 --- a/aws-fargate/mvnw.cmd +++ /dev/null @@ -1,188 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% diff --git a/aws-fargate/pom.xml b/aws-fargate/pom.xml deleted file mode 100644 index 3a41ccfa2..000000000 --- a/aws-fargate/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.0.7 - - - com.example - native-fargate-demo - 0.0.1-SNAPSHOT - native-fargate-demo - GraalVM Native Image on AWS Fargate demo - - 17 - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.graalvm.buildtools - native-maven-plugin - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java b/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java deleted file mode 100644 index c02f77c9f..000000000 --- a/aws-fargate/src/main/java/com/example/nativefargatedemo/NativeFargateDemoApplication.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * The Universal Permissive License (UPL), Version 1.0 - * - * Subject to the condition set forth below, permission is hereby granted to any - * person obtaining a copy of this software, associated documentation and/or - * data (collectively the "Software"), free of charge and under any and all - * copyright rights in the Software, and any and all patent rights owned or - * freely licensable by each licensor hereunder covering either (i) the - * unmodified Software as contributed to or provided by such licensor, or (ii) - * the Larger Works (as defined below), to deal in both - * - * (a) the Software, and - * - * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if - * one is included with the Software each a "Larger Work" to which the Software - * is contributed by such licensors), - * - * without restriction, including without limitation the rights to copy, create - * derivative works of, display, perform, and distribute the Software and make, - * use, sell, offer for sale, import, export, have made, and have sold the - * Software and the Larger Work(s), and to sublicense the foregoing rights on - * either these or other terms. - * - * This license is subject to the following condition: - * - * The above copyright notice and either this complete permission notice or at a - * minimum a reference to the UPL must be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.example.nativefargatedemo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class NativeFargateDemoApplication { - - public static void main(String[] args) { - SpringApplication.run(NativeFargateDemoApplication.class, args); - } - -} diff --git a/aws-fargate/src/main/resources/application.properties b/aws-fargate/src/main/resources/application.properties deleted file mode 100644 index 8b1378917..000000000 --- a/aws-fargate/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java b/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java deleted file mode 100644 index 5e51d68b9..000000000 --- a/aws-fargate/src/test/java/com/example/nativefargatedemo/NativeFargateDemoApplicationTests.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * The Universal Permissive License (UPL), Version 1.0 - * - * Subject to the condition set forth below, permission is hereby granted to any - * person obtaining a copy of this software, associated documentation and/or - * data (collectively the "Software"), free of charge and under any and all - * copyright rights in the Software, and any and all patent rights owned or - * freely licensable by each licensor hereunder covering either (i) the - * unmodified Software as contributed to or provided by such licensor, or (ii) - * the Larger Works (as defined below), to deal in both - * - * (a) the Software, and - * - * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if - * one is included with the Software each a "Larger Work" to which the Software - * is contributed by such licensors), - * - * without restriction, including without limitation the rights to copy, create - * derivative works of, display, perform, and distribute the Software and make, - * use, sell, offer for sale, import, export, have made, and have sold the - * Software and the Larger Work(s), and to sublicense the foregoing rights on - * either these or other terms. - * - * This license is subject to the following condition: - * - * The above copyright notice and either this complete permission notice or at a - * minimum a reference to the UPL must be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.example.nativefargatedemo; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class NativeFargateDemoApplicationTests { - - @Test - void contextLoads() { - } - -} From 798e1c7b592dc79effd8344fae729e29ed9224cf Mon Sep 17 00:00:00 2001 From: egadbois Date: Fri, 16 Jun 2023 22:30:54 +0000 Subject: [PATCH 08/37] replaced demo --- .../.mvn/wrapper/maven-wrapper.properties | 18 + aws-fargate/README.md | 69 ++++ aws-fargate/micronaut-cli.yml | 6 + aws-fargate/mvnw | 308 ++++++++++++++++++ aws-fargate/mvnw.cmd | 205 ++++++++++++ aws-fargate/pom.xml | 105 ++++++ .../java/example/micronaut/Application.java | 11 + .../example/micronaut/HelloController.java | 15 + .../src/main/resources/application.yml | 7 + aws-fargate/src/main/resources/logback.xml | 15 + .../micronaut/HelloControllerTest.java | 29 ++ .../example/micronaut/MicronautguideTest.java | 62 ++++ 12 files changed, 850 insertions(+) create mode 100644 aws-fargate/.mvn/wrapper/maven-wrapper.properties create mode 100644 aws-fargate/README.md create mode 100644 aws-fargate/micronaut-cli.yml create mode 100755 aws-fargate/mvnw create mode 100644 aws-fargate/mvnw.cmd create mode 100644 aws-fargate/pom.xml create mode 100644 aws-fargate/src/main/java/example/micronaut/Application.java create mode 100644 aws-fargate/src/main/java/example/micronaut/HelloController.java create mode 100644 aws-fargate/src/main/resources/application.yml create mode 100644 aws-fargate/src/main/resources/logback.xml create mode 100644 aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java create mode 100644 aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java diff --git a/aws-fargate/.mvn/wrapper/maven-wrapper.properties b/aws-fargate/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 000000000..3c6fda8c6 --- /dev/null +++ b/aws-fargate/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/aws-fargate/README.md b/aws-fargate/README.md new file mode 100644 index 000000000..f98e9b7c4 --- /dev/null +++ b/aws-fargate/README.md @@ -0,0 +1,69 @@ +GraalVM on Google Cloud Run Demo +================================ +This demo will walk you through the processes for deploying Native Image applications onto the Google Cloud Run platform. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. + +Prerequisites +---------------------- +Ensure that you have the following installed and follow the linked instructions for any that you are missing: +- Docker: https://docs.docker.com/desktop/ +- Google Cloud CLI: https://cloud.google.com/sdk/docs/install#linux +- GraalVM: https://www.graalvm.org/downloads/ + +Download or clone GraalVM demos repository: + ```bash + git clone https://github.com/graalvm/graalvm-demos + ``` + +Deploying a Native Image Application +---------------------- +1. Navigate to the directory for this demo: +```bash +cd graalvm-demos/google-cloud-run +``` +2. Login to your Google account using the Google Cloud CLI: +``` +gcloud auth login +``` +3. Run the following command to configure Docker credentuals for the CLI: +``` +gcloud auth configure-docker +``` +4. Create a new project using the following command, where "xxxxxx" denotes the 6-digit identifier you choose for your project: +``` +gcloud projects create graal-demo-xxxxxx +``` +5. Set your newly created project to be currently selected: +``` +gcloud config set project graal-demo-xxxxxx +``` +To see a list of all projects use: +``` +gcloud projects list +``` +6. Use a browser to login to the Google Cloud dashboard and navigate to the [Billing](https://console.cloud.google.com/billing/projects) tab +7. Ensure that you have a billing account set up and enable billing for the newly created project by clicking on the dots beside the project name and selecting "Change billing" +Screen Shot 2023-05-16 at 12 52 19 PM + +8. Back on your terminal interface, activate the required project APIs: +``` +gcloud services enable run.googleapis.com container.googleapis.com +``` +9. Push the application image to Google Cloud Container Registry (once again replacing "xxxxxx" as appropriate): +``` +./mvnw deploy -Dpackaging=docker-native -Djib.to.image=gcr.io/graal-demo-xxxxxx/graaldemo:latest +``` +Screen Shot 2023-05-16 at 12 47 20 PM + +10. Deploy the application to Google Cloud Run: +``` +gcloud run deploy --image=gcr.io/graal-demo-xxxxxx/graaldemo:latest --platform managed --allow-unauthenticated +``` +Screen Shot 2023-05-16 at 12 46 05 PM + +11. Once the application is successfully deployed, a Service URL will be outputted. Use that URL in the following command to test the application - a success will return the string "Hello World": +``` +curl SERVICE_URL/hello +``` +Screen Shot 2023-05-16 at 12 45 40 PM + +12. To view detailed information about the application performace such as build & response times, visit the [Google Cloud Logging](https://console.cloud.google.com/logs/) page diff --git a/aws-fargate/micronaut-cli.yml b/aws-fargate/micronaut-cli.yml new file mode 100644 index 000000000..1faf237e6 --- /dev/null +++ b/aws-fargate/micronaut-cli.yml @@ -0,0 +1,6 @@ +applicationType: default +defaultPackage: example.micronaut +testFramework: junit +sourceLanguage: java +buildTool: maven +features: [annotation-api, app-name, http-client, jackson-databind, java, java-application, junit, logback, maven, netty-server, readme, shade, yaml] diff --git a/aws-fargate/mvnw b/aws-fargate/mvnw new file mode 100755 index 000000000..8d937f4c1 --- /dev/null +++ b/aws-fargate/mvnw @@ -0,0 +1,308 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "$(uname)" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin ; then + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "\"$javaExecutable\"")" + fi + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$(cd "$wdir/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/aws-fargate/mvnw.cmd b/aws-fargate/mvnw.cmd new file mode 100644 index 000000000..f80fbad3e --- /dev/null +++ b/aws-fargate/mvnw.cmd @@ -0,0 +1,205 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.2.0 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/aws-fargate/pom.xml b/aws-fargate/pom.xml new file mode 100644 index 000000000..e89a9600d --- /dev/null +++ b/aws-fargate/pom.xml @@ -0,0 +1,105 @@ + + + 4.0.0 + example.micronaut + micronautguide + 0.1 + ${packaging} + + + io.micronaut + micronaut-parent + 3.9.1 + + + + jar + 11 + 11 + 3.9.1 + netty + example.micronaut.Application + + + + + central + https://repo.maven.apache.org/maven2 + + + + + + io.micronaut + micronaut-http-client + compile + + + io.micronaut + micronaut-http-server-netty + compile + + + io.micronaut + micronaut-jackson-databind + compile + + + jakarta.annotation + jakarta.annotation-api + compile + + + ch.qos.logback + logback-classic + runtime + + + io.micronaut.test + micronaut-test-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + io.micronaut.build + micronaut-maven-plugin + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + io.micronaut + micronaut-http-validation + ${micronaut.version} + + + + -Amicronaut.processing.group=example.micronaut + -Amicronaut.processing.module=micronautguide + + + + + + + diff --git a/aws-fargate/src/main/java/example/micronaut/Application.java b/aws-fargate/src/main/java/example/micronaut/Application.java new file mode 100644 index 000000000..cc74c50ee --- /dev/null +++ b/aws-fargate/src/main/java/example/micronaut/Application.java @@ -0,0 +1,11 @@ + +package example.micronaut; + +import io.micronaut.runtime.Micronaut; + +public class Application { + + public static void main(String[] args) { + Micronaut.run(Application.class, args); + } +} \ No newline at end of file diff --git a/aws-fargate/src/main/java/example/micronaut/HelloController.java b/aws-fargate/src/main/java/example/micronaut/HelloController.java new file mode 100644 index 000000000..e474ca3d8 --- /dev/null +++ b/aws-fargate/src/main/java/example/micronaut/HelloController.java @@ -0,0 +1,15 @@ +package example.micronaut; + +import io.micronaut.http.MediaType; +import io.micronaut.http.annotation.Controller; +import io.micronaut.http.annotation.Get; +import io.micronaut.http.annotation.Produces; + +@Controller("/hello") +public class HelloController { + @Get + @Produces(MediaType.TEXT_PLAIN) + public String index() { + return "Hello World"; + } +} \ No newline at end of file diff --git a/aws-fargate/src/main/resources/application.yml b/aws-fargate/src/main/resources/application.yml new file mode 100644 index 000000000..c22fbd2bc --- /dev/null +++ b/aws-fargate/src/main/resources/application.yml @@ -0,0 +1,7 @@ +micronaut: + application: + name: micronautguide +netty: + default: + allocator: + max-order: 3 diff --git a/aws-fargate/src/main/resources/logback.xml b/aws-fargate/src/main/resources/logback.xml new file mode 100644 index 000000000..6010eb523 --- /dev/null +++ b/aws-fargate/src/main/resources/logback.xml @@ -0,0 +1,15 @@ + + + + true + + + %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n + + + + + + + diff --git a/aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java b/aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java new file mode 100644 index 000000000..4ecd967bf --- /dev/null +++ b/aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java @@ -0,0 +1,29 @@ +package example.micronaut; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import io.micronaut.http.HttpRequest; +import io.micronaut.http.client.HttpClient; +import io.micronaut.http.client.annotation.Client; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; + +import jakarta.inject.Inject; + +@MicronautTest +public class HelloControllerTest { + + @Inject + @Client("/") + HttpClient client; + + @Test + public void testHello() { + HttpRequest request = HttpRequest.GET("/hello"); + String body = client.toBlocking().retrieve(request); + + assertNotNull(body); + assertEquals("Hello World", body); + } +} \ No newline at end of file diff --git a/aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java b/aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java new file mode 100644 index 000000000..1c912e0e7 --- /dev/null +++ b/aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package example.micronaut; + +import io.micronaut.runtime.EmbeddedApplication; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; + +import jakarta.inject.Inject; + +@MicronautTest +class MicronautguideTest { + + @Inject + EmbeddedApplication application; + + @Test + void testItWorks() { + Assertions.assertTrue(application.isRunning()); + } + +} From aff6e0c6c2f4925e73f27d5258f7a5863aea010d Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 19 Jun 2023 17:18:27 +0200 Subject: [PATCH 09/37] Update to new GraalVM for JDK 17 release. --- .github/workflows/espresso-jshell.yml | 12 ++++-------- .github/workflows/fortune-demo.yml | 14 +++----------- .github/workflows/functionGraphDemo.yml | 13 +++---------- .github/workflows/hello-graal.yml | 11 +++-------- .github/workflows/java-hello-world-maven.yml | 8 +++----- .github/workflows/java-kotlin-aot.yml | 11 +++-------- .github/workflows/java-simple-stream-benchmark.yml | 12 +++--------- .github/workflows/javagdbnative.yml | 11 +++-------- .github/workflows/jmh-binary-tree.yml | 10 ++++------ .github/workflows/js-java-async-helidon.yml | 10 +++------- .github/workflows/micronaut-hello-rest-maven.yml | 6 ++---- .github/workflows/multithreading-demo.yml | 11 +++-------- .github/workflows/native-heapdump-examples.yml | 11 +++-------- .github/workflows/native-hello-module.yml | 11 +++-------- .../workflows/native-image-configure-examples.yml | 9 ++++----- .github/workflows/native-image-jmx-demo.yml | 9 +++------ .../workflows/native-image-logging-examples.yml | 11 +++-------- .../workflows/native-image-reflection-example.yml | 11 +++-------- .github/workflows/native-jfr-demo.yml | 10 +++------- .github/workflows/native-list-dir.yml | 12 ++++-------- .github/workflows/native-netty-plot.yml | 9 ++++----- .github/workflows/native-shared-library.yml | 12 ++++-------- .github/workflows/native-static-images.yml | 13 ++++--------- .github/workflows/polyglot-chat-app.yml | 4 ++-- .github/workflows/polyglot-debug.yml | 10 +++------- .github/workflows/polyglot-javascript-java-r.yml | 4 +--- .github/workflows/spring-native-image.yml | 9 ++++----- .github/workflows/streams.yml | 11 ++++++----- .github/workflows/tiny-java-containers.yml | 8 +++----- .../java/com/oracle/example/javapython/Main.java | 1 - spring-native-image/pom.xml | 1 + 31 files changed, 95 insertions(+), 200 deletions(-) diff --git a/.github/workflows/espresso-jshell.yml b/.github/workflows/espresso-jshell.yml index 0c5696cd3..4b57d32b0 100644 --- a/.github/workflows/espresso-jshell.yml +++ b/.github/workflows/espresso-jshell.yml @@ -17,21 +17,17 @@ jobs: run: name: Run 'espresso-jshell' runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'espresso,native-image' + distribution: 'graalvm' + components: 'espresso' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run 'espresso-jshell' run: | diff --git a/.github/workflows/fortune-demo.yml b/.github/workflows/fortune-demo.yml index 210b1e22d..ab930e413 100644 --- a/.github/workflows/fortune-demo.yml +++ b/.github/workflows/fortune-demo.yml @@ -17,21 +17,13 @@ jobs: run: name: Run 'fortune-demo' runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: '17' + timeout-minutes: 30 steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} - java-version: ${{ matrix.java-version }} - components: 'native-image' + java-version: '17.0.7' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run 'fortune' run: | diff --git a/.github/workflows/functionGraphDemo.yml b/.github/workflows/functionGraphDemo.yml index f1202ca95..3d0dc1f18 100644 --- a/.github/workflows/functionGraphDemo.yml +++ b/.github/workflows/functionGraphDemo.yml @@ -17,20 +17,13 @@ jobs: run: name: Run 'functionGraphDemo' runs-on: ubuntu-latest - timeout-minutes: 10 - strategy: - matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + timeout-minutes: 15 steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} - java-version: ${{ matrix.java-version }} + version: '22.3.0' + java-version: '17' components: 'nodejs,R,ruby' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run 'functionGraphDemo' diff --git a/.github/workflows/hello-graal.yml b/.github/workflows/hello-graal.yml index 443bc31a8..9cb127313 100644 --- a/.github/workflows/hello-graal.yml +++ b/.github/workflows/hello-graal.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'hello-graal' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'hello-graal' diff --git a/.github/workflows/java-hello-world-maven.yml b/.github/workflows/java-hello-world-maven.yml index 49d5fccc5..06540c335 100644 --- a/.github/workflows/java-hello-world-maven.yml +++ b/.github/workflows/java-hello-world-maven.yml @@ -14,15 +14,13 @@ jobs: run: name: Run 'java-hello-world-maven' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: 'latest' # EE dev builds not supported - gds-token: ${{ secrets.GDS_TOKEN }} - java-version: '17' - components: 'native-image' + java-version: '17.0.7' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/java-kotlin-aot.yml b/.github/workflows/java-kotlin-aot.yml index f66a35c6e..17e445b71 100644 --- a/.github/workflows/java-kotlin-aot.yml +++ b/.github/workflows/java-kotlin-aot.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'java-kotlin-aot' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: '17' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'java-kotlin-aot' diff --git a/.github/workflows/java-simple-stream-benchmark.yml b/.github/workflows/java-simple-stream-benchmark.yml index 8d8d2b3c7..058d940f0 100644 --- a/.github/workflows/java-simple-stream-benchmark.yml +++ b/.github/workflows/java-simple-stream-benchmark.yml @@ -17,23 +17,17 @@ jobs: run: name: Run 'java-simple-stream-benchmark' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - native-image-job-reports: 'true' - name: Run 'java-simple-stream-benchmark' run: | cd java-simple-stream-benchmark diff --git a/.github/workflows/javagdbnative.yml b/.github/workflows/javagdbnative.yml index 77066251a..2f32e1e50 100644 --- a/.github/workflows/javagdbnative.yml +++ b/.github/workflows/javagdbnative.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'javagdbnative' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/jmh-binary-tree.yml b/.github/workflows/jmh-binary-tree.yml index bb87512f7..fc41f6ec4 100644 --- a/.github/workflows/jmh-binary-tree.yml +++ b/.github/workflows/jmh-binary-tree.yml @@ -15,18 +15,16 @@ permissions: contents: read jobs: build: - name: GraalVM Binary Tree Benchmark on ${{ matrix.os }} + name: GraalVM Binary Tree Benchmark runs-on: ubuntu-latest timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: 'latest' # EE dev builds not supported - gds-token: ${{ secrets.GDS_TOKEN }} - java-version: '17' - components: 'native-image' + java-version: '17.0.7' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build and Test Java Code diff --git a/.github/workflows/js-java-async-helidon.yml b/.github/workflows/js-java-async-helidon.yml index 401692908..705a94324 100644 --- a/.github/workflows/js-java-async-helidon.yml +++ b/.github/workflows/js-java-async-helidon.yml @@ -17,20 +17,16 @@ jobs: run: name: Run 'js-java-async-helidon' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' - name: Run 'js-java-async-helidon' diff --git a/.github/workflows/micronaut-hello-rest-maven.yml b/.github/workflows/micronaut-hello-rest-maven.yml index 3bf26c894..3e57c561e 100644 --- a/.github/workflows/micronaut-hello-rest-maven.yml +++ b/.github/workflows/micronaut-hello-rest-maven.yml @@ -14,15 +14,13 @@ jobs: run: name: Run 'micronaut-hello-rest-maven' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: 'latest' # EE dev builds not supported - gds-token: ${{ secrets.GDS_TOKEN }} java-version: '17' - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/multithreading-demo.yml b/.github/workflows/multithreading-demo.yml index d942ef719..44e643a07 100644 --- a/.github/workflows/multithreading-demo.yml +++ b/.github/workflows/multithreading-demo.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'multithreading-demo' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' - name: Run 'multithreading-demo-oversized' diff --git a/.github/workflows/native-heapdump-examples.yml b/.github/workflows/native-heapdump-examples.yml index c7f2729fa..46ab773dc 100644 --- a/.github/workflows/native-heapdump-examples.yml +++ b/.github/workflows/native-heapdump-examples.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'native-heapdump-examples' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-heapdump-examples' diff --git a/.github/workflows/native-hello-module.yml b/.github/workflows/native-hello-module.yml index 6d5a2af4a..d9296c868 100644 --- a/.github/workflows/native-hello-module.yml +++ b/.github/workflows/native-hello-module.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'native-hello-module' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/native-image-configure-examples.yml b/.github/workflows/native-image-configure-examples.yml index 7b6ec1b96..fe4c1229e 100644 --- a/.github/workflows/native-image-configure-examples.yml +++ b/.github/workflows/native-image-configure-examples.yml @@ -17,17 +17,16 @@ jobs: run: name: Run 'native-image-configure-examples' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - version: [latest, dev] + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} - java-version: '17' - components: 'native-image' + java-version: ${{ matrix.java-version }} + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' - name: Run 'configure-at-runtime-example' diff --git a/.github/workflows/native-image-jmx-demo.yml b/.github/workflows/native-image-jmx-demo.yml index ad8a7ea74..0d57c9176 100644 --- a/.github/workflows/native-image-jmx-demo.yml +++ b/.github/workflows/native-image-jmx-demo.yml @@ -17,19 +17,16 @@ jobs: run: name: Run 'native-image-jmx-demo' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'dev' - java-version: '17' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-image-jmx-demo' diff --git a/.github/workflows/native-image-logging-examples.yml b/.github/workflows/native-image-logging-examples.yml index 874c0d23c..05e87efda 100644 --- a/.github/workflows/native-image-logging-examples.yml +++ b/.github/workflows/native-image-logging-examples.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'native-image-logging-examples' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-image-logging-examples' diff --git a/.github/workflows/native-image-reflection-example.yml b/.github/workflows/native-image-reflection-example.yml index 28ff9260e..c5f401d6c 100644 --- a/.github/workflows/native-image-reflection-example.yml +++ b/.github/workflows/native-image-reflection-example.yml @@ -17,21 +17,16 @@ jobs: run: name: Run 'native-image-reflection-example' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-image-reflection-example' diff --git a/.github/workflows/native-jfr-demo.yml b/.github/workflows/native-jfr-demo.yml index 89cdd62d6..2c5b38779 100644 --- a/.github/workflows/native-jfr-demo.yml +++ b/.github/workflows/native-jfr-demo.yml @@ -17,20 +17,16 @@ jobs: run: name: Run 'native-jfr-demo' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} + distribution: 'graalvm' components: 'native-image,visualvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' diff --git a/.github/workflows/native-list-dir.yml b/.github/workflows/native-list-dir.yml index bfdca5ccb..152502072 100644 --- a/.github/workflows/native-list-dir.yml +++ b/.github/workflows/native-list-dir.yml @@ -17,21 +17,17 @@ jobs: run: name: Run 'native-list-dir' runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image,js' + distribution: 'graalvm' + components: 'js' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-list-dir' diff --git a/.github/workflows/native-netty-plot.yml b/.github/workflows/native-netty-plot.yml index fa412fae9..3537510c9 100644 --- a/.github/workflows/native-netty-plot.yml +++ b/.github/workflows/native-netty-plot.yml @@ -17,17 +17,16 @@ jobs: run: name: Run 'native-netty-plot' runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 strategy: matrix: - version: [latest, dev] + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} - java-version: '17' - components: 'native-image' + java-version: ${{ matrix.java-version }} + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/native-shared-library.yml b/.github/workflows/native-shared-library.yml index a0320dd56..840ab0fe2 100644 --- a/.github/workflows/native-shared-library.yml +++ b/.github/workflows/native-shared-library.yml @@ -17,21 +17,17 @@ jobs: run: name: Run 'native-shared-library' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image,llvm-toolchain' + distribution: 'graalvm' + components: 'llvm-toolchain' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'native-shared-library' diff --git a/.github/workflows/native-static-images.yml b/.github/workflows/native-static-images.yml index aaa5662bb..9b09d4387 100644 --- a/.github/workflows/native-static-images.yml +++ b/.github/workflows/native-static-images.yml @@ -17,7 +17,7 @@ jobs: run-static: name: Run static 'native-static-images' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: include: @@ -43,21 +43,16 @@ jobs: run-mostly-static: name: Run mostly-static 'native-static-images' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} - components: 'native-image' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run mostly-static 'mostly-static-image' diff --git a/.github/workflows/polyglot-chat-app.yml b/.github/workflows/polyglot-chat-app.yml index a7a2c1583..9d23624b5 100644 --- a/.github/workflows/polyglot-chat-app.yml +++ b/.github/workflows/polyglot-chat-app.yml @@ -17,10 +17,10 @@ jobs: run: name: Run 'polyglot-chat-app' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - version: [latest, dev] + version: [22.3.0] # temporarily locked to 22.3.0 due to R steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 diff --git a/.github/workflows/polyglot-debug.yml b/.github/workflows/polyglot-debug.yml index 8c3451e01..c51fdd870 100644 --- a/.github/workflows/polyglot-debug.yml +++ b/.github/workflows/polyglot-debug.yml @@ -17,20 +17,16 @@ jobs: run: name: Run 'polyglot-debug' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: 'dev' + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} + distribution: 'graalvm' components: 'js' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' diff --git a/.github/workflows/polyglot-javascript-java-r.yml b/.github/workflows/polyglot-javascript-java-r.yml index 761cabdf6..eaabc6095 100644 --- a/.github/workflows/polyglot-javascript-java-r.yml +++ b/.github/workflows/polyglot-javascript-java-r.yml @@ -21,10 +21,8 @@ jobs: strategy: matrix: include: - - version: 'latest' + - version: '22.3.0' # temporarily locked to 22.3.0 due to R java-version: '17' - - version: 'dev' - java-version: 'dev' steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 diff --git a/.github/workflows/spring-native-image.yml b/.github/workflows/spring-native-image.yml index 167683add..c5cfb4e63 100644 --- a/.github/workflows/spring-native-image.yml +++ b/.github/workflows/spring-native-image.yml @@ -17,17 +17,16 @@ jobs: run: name: Run 'spring-native-graal' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 20 strategy: matrix: - version: [22.3.0] # temporarily locked to 22.3.0 for Spring Boot 3 compatibility + java-version: ['17', 'dev'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} - java-version: '17' - components: 'native-image' + java-version: ${{ matrix.java-version }} + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} cache: 'maven' native-image-job-reports: 'true' diff --git a/.github/workflows/streams.yml b/.github/workflows/streams.yml index d39d8b528..5d7c268f2 100644 --- a/.github/workflows/streams.yml +++ b/.github/workflows/streams.yml @@ -14,15 +14,16 @@ jobs: run: name: Run 'streams' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 + strategy: + matrix: + java-version: ['17', '20'] steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: 'latest' # EE dev builds not supported - gds-token: ${{ secrets.GDS_TOKEN }} - java-version: '11' - components: 'native-image' + java-version: ${{ matrix.java-version }} + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Run 'streams' diff --git a/.github/workflows/tiny-java-containers.yml b/.github/workflows/tiny-java-containers.yml index e31e772ea..d032b9fef 100644 --- a/.github/workflows/tiny-java-containers.yml +++ b/.github/workflows/tiny-java-containers.yml @@ -13,15 +13,13 @@ jobs: run: name: Run 'tiny-java-containers' runs-on: ubuntu-20.04 # Docker has changed its behavior on Ubuntu 22.04 - timeout-minutes: 15 + timeout-minutes: 20 steps: - uses: actions/checkout@v3 - uses: graalvm/setup-graalvm@v1 with: - version: 'latest' # EE dev builds not supported - gds-token: ${{ secrets.GDS_TOKEN }} - java-version: '19' - components: 'native-image' + java-version: '20.0.1' + distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - name: Run 'tiny-java-containers' run: | diff --git a/graalpy-notebook-example/src/main/java/com/oracle/example/javapython/Main.java b/graalpy-notebook-example/src/main/java/com/oracle/example/javapython/Main.java index bcbecf801..8f67f46e4 100644 --- a/graalpy-notebook-example/src/main/java/com/oracle/example/javapython/Main.java +++ b/graalpy-notebook-example/src/main/java/com/oracle/example/javapython/Main.java @@ -39,7 +39,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - */ import java.awt.Button; import java.awt.Canvas; import java.awt.Component; diff --git a/spring-native-image/pom.xml b/spring-native-image/pom.xml index d92debe93..3933ec7c9 100644 --- a/spring-native-image/pom.xml +++ b/spring-native-image/pom.xml @@ -52,6 +52,7 @@ org.graalvm.buildtools native-maven-plugin + 0.9.21 org.springframework.boot From 2e28b3974ee7f3abe68eca5280e66f22bc0aa571 Mon Sep 17 00:00:00 2001 From: egadbois Date: Tue, 20 Jun 2023 18:58:06 +0000 Subject: [PATCH 10/37] new branch --- .../.mvn/wrapper/maven-wrapper.properties | 0 {aws-fargate => azure-container-instances}/README.md | 0 {aws-fargate => azure-container-instances}/micronaut-cli.yml | 0 {aws-fargate => azure-container-instances}/mvnw | 0 {aws-fargate => azure-container-instances}/mvnw.cmd | 0 {aws-fargate => azure-container-instances}/pom.xml | 0 .../src/main/java/example/micronaut/Application.java | 0 .../src/main/java/example/micronaut/HelloController.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/micronaut/HelloControllerTest.java | 0 .../src/test/java/example/micronaut/MicronautguideTest.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {aws-fargate => azure-container-instances}/.mvn/wrapper/maven-wrapper.properties (100%) rename {aws-fargate => azure-container-instances}/README.md (100%) rename {aws-fargate => azure-container-instances}/micronaut-cli.yml (100%) rename {aws-fargate => azure-container-instances}/mvnw (100%) rename {aws-fargate => azure-container-instances}/mvnw.cmd (100%) rename {aws-fargate => azure-container-instances}/pom.xml (100%) rename {aws-fargate => azure-container-instances}/src/main/java/example/micronaut/Application.java (100%) rename {aws-fargate => azure-container-instances}/src/main/java/example/micronaut/HelloController.java (100%) rename {aws-fargate => azure-container-instances}/src/main/resources/application.yml (100%) rename {aws-fargate => azure-container-instances}/src/main/resources/logback.xml (100%) rename {aws-fargate => azure-container-instances}/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename {aws-fargate => azure-container-instances}/src/test/java/example/micronaut/MicronautguideTest.java (100%) diff --git a/aws-fargate/.mvn/wrapper/maven-wrapper.properties b/azure-container-instances/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from aws-fargate/.mvn/wrapper/maven-wrapper.properties rename to azure-container-instances/.mvn/wrapper/maven-wrapper.properties diff --git a/aws-fargate/README.md b/azure-container-instances/README.md similarity index 100% rename from aws-fargate/README.md rename to azure-container-instances/README.md diff --git a/aws-fargate/micronaut-cli.yml b/azure-container-instances/micronaut-cli.yml similarity index 100% rename from aws-fargate/micronaut-cli.yml rename to azure-container-instances/micronaut-cli.yml diff --git a/aws-fargate/mvnw b/azure-container-instances/mvnw similarity index 100% rename from aws-fargate/mvnw rename to azure-container-instances/mvnw diff --git a/aws-fargate/mvnw.cmd b/azure-container-instances/mvnw.cmd similarity index 100% rename from aws-fargate/mvnw.cmd rename to azure-container-instances/mvnw.cmd diff --git a/aws-fargate/pom.xml b/azure-container-instances/pom.xml similarity index 100% rename from aws-fargate/pom.xml rename to azure-container-instances/pom.xml diff --git a/aws-fargate/src/main/java/example/micronaut/Application.java b/azure-container-instances/src/main/java/example/micronaut/Application.java similarity index 100% rename from aws-fargate/src/main/java/example/micronaut/Application.java rename to azure-container-instances/src/main/java/example/micronaut/Application.java diff --git a/aws-fargate/src/main/java/example/micronaut/HelloController.java b/azure-container-instances/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from aws-fargate/src/main/java/example/micronaut/HelloController.java rename to azure-container-instances/src/main/java/example/micronaut/HelloController.java diff --git a/aws-fargate/src/main/resources/application.yml b/azure-container-instances/src/main/resources/application.yml similarity index 100% rename from aws-fargate/src/main/resources/application.yml rename to azure-container-instances/src/main/resources/application.yml diff --git a/aws-fargate/src/main/resources/logback.xml b/azure-container-instances/src/main/resources/logback.xml similarity index 100% rename from aws-fargate/src/main/resources/logback.xml rename to azure-container-instances/src/main/resources/logback.xml diff --git a/aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java b/azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from aws-fargate/src/test/java/example/micronaut/HelloControllerTest.java rename to azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java b/azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java similarity index 100% rename from aws-fargate/src/test/java/example/micronaut/MicronautguideTest.java rename to azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java From c0bb0fb1f74566411b2bd3326262feef80f89e01 Mon Sep 17 00:00:00 2001 From: egadbois Date: Tue, 20 Jun 2023 20:49:39 +0000 Subject: [PATCH 11/37] renamed --- .../.mvn/wrapper/maven-wrapper.properties | 0 {azure-container-instances => azure-functions}/README.md | 0 {azure-container-instances => azure-functions}/micronaut-cli.yml | 0 {azure-container-instances => azure-functions}/mvnw | 0 {azure-container-instances => azure-functions}/mvnw.cmd | 0 {azure-container-instances => azure-functions}/pom.xml | 0 .../src/main/java/example/micronaut/Application.java | 0 .../src/main/java/example/micronaut/HelloController.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/micronaut/HelloControllerTest.java | 0 .../src/test/java/example/micronaut/MicronautguideTest.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {azure-container-instances => azure-functions}/.mvn/wrapper/maven-wrapper.properties (100%) rename {azure-container-instances => azure-functions}/README.md (100%) rename {azure-container-instances => azure-functions}/micronaut-cli.yml (100%) rename {azure-container-instances => azure-functions}/mvnw (100%) rename {azure-container-instances => azure-functions}/mvnw.cmd (100%) rename {azure-container-instances => azure-functions}/pom.xml (100%) rename {azure-container-instances => azure-functions}/src/main/java/example/micronaut/Application.java (100%) rename {azure-container-instances => azure-functions}/src/main/java/example/micronaut/HelloController.java (100%) rename {azure-container-instances => azure-functions}/src/main/resources/application.yml (100%) rename {azure-container-instances => azure-functions}/src/main/resources/logback.xml (100%) rename {azure-container-instances => azure-functions}/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename {azure-container-instances => azure-functions}/src/test/java/example/micronaut/MicronautguideTest.java (100%) diff --git a/azure-container-instances/.mvn/wrapper/maven-wrapper.properties b/azure-functions/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from azure-container-instances/.mvn/wrapper/maven-wrapper.properties rename to azure-functions/.mvn/wrapper/maven-wrapper.properties diff --git a/azure-container-instances/README.md b/azure-functions/README.md similarity index 100% rename from azure-container-instances/README.md rename to azure-functions/README.md diff --git a/azure-container-instances/micronaut-cli.yml b/azure-functions/micronaut-cli.yml similarity index 100% rename from azure-container-instances/micronaut-cli.yml rename to azure-functions/micronaut-cli.yml diff --git a/azure-container-instances/mvnw b/azure-functions/mvnw similarity index 100% rename from azure-container-instances/mvnw rename to azure-functions/mvnw diff --git a/azure-container-instances/mvnw.cmd b/azure-functions/mvnw.cmd similarity index 100% rename from azure-container-instances/mvnw.cmd rename to azure-functions/mvnw.cmd diff --git a/azure-container-instances/pom.xml b/azure-functions/pom.xml similarity index 100% rename from azure-container-instances/pom.xml rename to azure-functions/pom.xml diff --git a/azure-container-instances/src/main/java/example/micronaut/Application.java b/azure-functions/src/main/java/example/micronaut/Application.java similarity index 100% rename from azure-container-instances/src/main/java/example/micronaut/Application.java rename to azure-functions/src/main/java/example/micronaut/Application.java diff --git a/azure-container-instances/src/main/java/example/micronaut/HelloController.java b/azure-functions/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from azure-container-instances/src/main/java/example/micronaut/HelloController.java rename to azure-functions/src/main/java/example/micronaut/HelloController.java diff --git a/azure-container-instances/src/main/resources/application.yml b/azure-functions/src/main/resources/application.yml similarity index 100% rename from azure-container-instances/src/main/resources/application.yml rename to azure-functions/src/main/resources/application.yml diff --git a/azure-container-instances/src/main/resources/logback.xml b/azure-functions/src/main/resources/logback.xml similarity index 100% rename from azure-container-instances/src/main/resources/logback.xml rename to azure-functions/src/main/resources/logback.xml diff --git a/azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java b/azure-functions/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java rename to azure-functions/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java b/azure-functions/src/test/java/example/micronaut/MicronautguideTest.java similarity index 100% rename from azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java rename to azure-functions/src/test/java/example/micronaut/MicronautguideTest.java From ae770324231563d517214f06ac55f737c2c6076d Mon Sep 17 00:00:00 2001 From: egadbois Date: Wed, 21 Jun 2023 23:38:39 +0000 Subject: [PATCH 12/37] renamed --- .../.mvn/wrapper/maven-wrapper.properties | 0 {azure-functions => azure-container-instances}/README.md | 0 {azure-functions => azure-container-instances}/micronaut-cli.yml | 0 {azure-functions => azure-container-instances}/mvnw | 0 {azure-functions => azure-container-instances}/mvnw.cmd | 0 {azure-functions => azure-container-instances}/pom.xml | 0 .../src/main/java/example/micronaut/Application.java | 0 .../src/main/java/example/micronaut/HelloController.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/micronaut/HelloControllerTest.java | 0 .../src/test/java/example/micronaut/MicronautguideTest.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {azure-functions => azure-container-instances}/.mvn/wrapper/maven-wrapper.properties (100%) rename {azure-functions => azure-container-instances}/README.md (100%) rename {azure-functions => azure-container-instances}/micronaut-cli.yml (100%) rename {azure-functions => azure-container-instances}/mvnw (100%) rename {azure-functions => azure-container-instances}/mvnw.cmd (100%) rename {azure-functions => azure-container-instances}/pom.xml (100%) rename {azure-functions => azure-container-instances}/src/main/java/example/micronaut/Application.java (100%) rename {azure-functions => azure-container-instances}/src/main/java/example/micronaut/HelloController.java (100%) rename {azure-functions => azure-container-instances}/src/main/resources/application.yml (100%) rename {azure-functions => azure-container-instances}/src/main/resources/logback.xml (100%) rename {azure-functions => azure-container-instances}/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename {azure-functions => azure-container-instances}/src/test/java/example/micronaut/MicronautguideTest.java (100%) diff --git a/azure-functions/.mvn/wrapper/maven-wrapper.properties b/azure-container-instances/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from azure-functions/.mvn/wrapper/maven-wrapper.properties rename to azure-container-instances/.mvn/wrapper/maven-wrapper.properties diff --git a/azure-functions/README.md b/azure-container-instances/README.md similarity index 100% rename from azure-functions/README.md rename to azure-container-instances/README.md diff --git a/azure-functions/micronaut-cli.yml b/azure-container-instances/micronaut-cli.yml similarity index 100% rename from azure-functions/micronaut-cli.yml rename to azure-container-instances/micronaut-cli.yml diff --git a/azure-functions/mvnw b/azure-container-instances/mvnw similarity index 100% rename from azure-functions/mvnw rename to azure-container-instances/mvnw diff --git a/azure-functions/mvnw.cmd b/azure-container-instances/mvnw.cmd similarity index 100% rename from azure-functions/mvnw.cmd rename to azure-container-instances/mvnw.cmd diff --git a/azure-functions/pom.xml b/azure-container-instances/pom.xml similarity index 100% rename from azure-functions/pom.xml rename to azure-container-instances/pom.xml diff --git a/azure-functions/src/main/java/example/micronaut/Application.java b/azure-container-instances/src/main/java/example/micronaut/Application.java similarity index 100% rename from azure-functions/src/main/java/example/micronaut/Application.java rename to azure-container-instances/src/main/java/example/micronaut/Application.java diff --git a/azure-functions/src/main/java/example/micronaut/HelloController.java b/azure-container-instances/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from azure-functions/src/main/java/example/micronaut/HelloController.java rename to azure-container-instances/src/main/java/example/micronaut/HelloController.java diff --git a/azure-functions/src/main/resources/application.yml b/azure-container-instances/src/main/resources/application.yml similarity index 100% rename from azure-functions/src/main/resources/application.yml rename to azure-container-instances/src/main/resources/application.yml diff --git a/azure-functions/src/main/resources/logback.xml b/azure-container-instances/src/main/resources/logback.xml similarity index 100% rename from azure-functions/src/main/resources/logback.xml rename to azure-container-instances/src/main/resources/logback.xml diff --git a/azure-functions/src/test/java/example/micronaut/HelloControllerTest.java b/azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from azure-functions/src/test/java/example/micronaut/HelloControllerTest.java rename to azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/azure-functions/src/test/java/example/micronaut/MicronautguideTest.java b/azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java similarity index 100% rename from azure-functions/src/test/java/example/micronaut/MicronautguideTest.java rename to azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java From 622f379ada0603f6aba777ab86665198e8d5aa65 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Wed, 21 Jun 2023 16:47:05 -0700 Subject: [PATCH 13/37] Update README.md --- azure-container-instances/README.md | 78 ++++++++++++----------------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index f98e9b7c4..299ecad5c 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -1,69 +1,55 @@ -GraalVM on Google Cloud Run Demo -================================ -This demo will walk you through the processes for deploying Native Image applications onto the Google Cloud Run platform. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. +GraalVM on Azure Container Instances Demo +============================= +This demo will walk you through the process of containerizing a Native Image application and then launching the image on the Azure platform by using the Azure Container Registry and Azure Container Instances. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. Prerequisites ---------------------- Ensure that you have the following installed and follow the linked instructions for any that you are missing: - Docker: https://docs.docker.com/desktop/ -- Google Cloud CLI: https://cloud.google.com/sdk/docs/install#linux +- Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli - GraalVM: https://www.graalvm.org/downloads/ Download or clone GraalVM demos repository: ```bash git clone https://github.com/graalvm/graalvm-demos ``` + +Micronaut "Hello World" Application +---------------------- +The code provided in this demo is a simple "Hello World" REST application created using the Micronaut framework. To understand what the code is doing, take a look at the _Application.java_ and _HelloController.java_ files: + +**Application.java** + +Application.java + +This is the location of the main() function and entry point for the application. + +**HelloController.java** + +HelloController.java + +This code implements the actual RESTful "Hello World" functionality. It produces the "Hello World" string when a GET request is made to the "/hello" URL. -Deploying a Native Image Application +Deploy a Native Image Container on Azure Container Registry ---------------------- 1. Navigate to the directory for this demo: ```bash -cd graalvm-demos/google-cloud-run -``` -2. Login to your Google account using the Google Cloud CLI: -``` -gcloud auth login -``` -3. Run the following command to configure Docker credentuals for the CLI: -``` -gcloud auth configure-docker -``` -4. Create a new project using the following command, where "xxxxxx" denotes the 6-digit identifier you choose for your project: -``` -gcloud projects create graal-demo-xxxxxx +cd graalvm-demos/azure-container-instances ``` -5. Set your newly created project to be currently selected: -``` -gcloud config set project graal-demo-xxxxxx -``` -To see a list of all projects use: -``` -gcloud projects list -``` -6. Use a browser to login to the Google Cloud dashboard and navigate to the [Billing](https://console.cloud.google.com/billing/projects) tab -7. Ensure that you have a billing account set up and enable billing for the newly created project by clicking on the dots beside the project name and selecting "Change billing" -Screen Shot 2023-05-16 at 12 52 19 PM +2. Create a new ACR repository to store the image: + + -8. Back on your terminal interface, activate the required project APIs: -``` -gcloud services enable run.googleapis.com container.googleapis.com -``` -9. Push the application image to Google Cloud Container Registry (once again replacing "xxxxxx" as appropriate): -``` -./mvnw deploy -Dpackaging=docker-native -Djib.to.image=gcr.io/graal-demo-xxxxxx/graaldemo:latest -``` -Screen Shot 2023-05-16 at 12 47 20 PM -10. Deploy the application to Google Cloud Run: + + +__OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: ``` -gcloud run deploy --image=gcr.io/graal-demo-xxxxxx/graaldemo:latest --platform managed --allow-unauthenticated +./mvnw mn:dockerfile -Dpackaging=docker-native ``` -Screen Shot 2023-05-16 at 12 46 05 PM +The newly created Dockerfile will be automatically stored in the "target" directory -11. Once the application is successfully deployed, a Service URL will be outputted. Use that URL in the following command to test the application - a success will return the string "Hello World": +5. Use the Uri once again to push the image to the Amazon ECR: ``` -curl SERVICE_URL/hello +./mvnw deploy -Dpackaging=docker-native -Djib.to.image=REPOSITORYURI ``` -Screen Shot 2023-05-16 at 12 45 40 PM - -12. To view detailed information about the application performace such as build & response times, visit the [Google Cloud Logging](https://console.cloud.google.com/logs/) page From 4f9dbe4d0ab5dbc599a79194f58bc13ab7334867 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Wed, 21 Jun 2023 16:59:53 -0700 Subject: [PATCH 14/37] Update README.md --- azure-container-instances/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index 299ecad5c..085277398 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -36,7 +36,23 @@ Deploy a Native Image Container on Azure Container Registry ```bash cd graalvm-demos/azure-container-instances ``` -2. Create a new ACR repository to store the image: +2. Create a new Azure resource group that will store all resources for this demo: +``` +az group create --name nativeResourceGroup --location +``` + +**NOTE**: Available regions will be dependent on your current subscription, use the following command to see a list of those available to you: +``` +az account list-locations +``` + +3. Create a container registry within the resource group (Chosen name must be unique across Azure and contain 5-50 lowercase alphanumeric characters): +``` +az acr create --resource-group nativeResourceGroup --name --sku Basic +``` + +A successful creation will output something similar to that shown in the screenshot; take note of the "loginServer" value as this is the fully qualified registry name. +4. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) From 5e4fc6f92463ed7ce066d771285a8cb2dd42445d Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Wed, 21 Jun 2023 17:01:09 -0700 Subject: [PATCH 15/37] Update README.md --- azure-container-instances/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index 085277398..20b8714f6 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -51,13 +51,14 @@ az account list-locations az acr create --resource-group nativeResourceGroup --name --sku Basic ``` -A successful creation will output something similar to that shown in the screenshot; take note of the "loginServer" value as this is the fully qualified registry name. -4. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) +A successful creation will output something similar to that shown in the screenshot above. Take note of the "loginServer" value as this is the fully qualified registry name. +4. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) +------------------------------------------------- __OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: ``` From a306ae837c8b08249668fbdcd36c2611f77f3112 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 22 Jun 2023 17:47:10 -0700 Subject: [PATCH 16/37] Update README.md --- azure-container-instances/README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index 20b8714f6..a5d521aa1 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -54,11 +54,14 @@ az acr create --resource-group nativeResourceGroup --name --sku A successful creation will output something similar to that shown in the screenshot above. Take note of the "loginServer" value as this is the fully qualified registry name. 4. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) - - - - -------------------------------------------------- +5. Use the search bar at the top of the page to navigate to the "Container registries" page +6. Select the registry you previously created and select "Access keys" on the left side of the page +7. Toggle the "Admin User" switch so that it is enabled - a username and password(s) will appear that you will use to login to the registry on the CLI +8. To provide your credentials to Docker, run the following command and use the Username and Password from the previous step when prompted: +``` +docker login .azurecr.io +`` +A successful authentication will return a "Login Succeeded" message __OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: ``` @@ -66,7 +69,7 @@ __OPTIONAL__: In the next step you will use a single command to build the applic ``` The newly created Dockerfile will be automatically stored in the "target" directory -5. Use the Uri once again to push the image to the Amazon ECR: +5. Use the Uri once again to push the image to the ACR: ``` -./mvnw deploy -Dpackaging=docker-native -Djib.to.image=REPOSITORYURI +./mvnw deploy -Dpackaging=docker-native -Djib.to.image=.azurecr.io/nativedemo ``` From 6e9e050f1df4460289bf5997c7e90752206d4814 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 22 Jun 2023 17:48:36 -0700 Subject: [PATCH 17/37] Update README.md --- azure-container-instances/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index a5d521aa1..fdb66be62 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -60,7 +60,7 @@ A successful creation will output something similar to that shown in the screens 8. To provide your credentials to Docker, run the following command and use the Username and Password from the previous step when prompted: ``` docker login .azurecr.io -`` +``` A successful authentication will return a "Login Succeeded" message __OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: From d97e97ba533420e86da0a1cc336c821d929dc6ac Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Thu, 22 Jun 2023 17:59:51 -0700 Subject: [PATCH 18/37] Update README.md --- azure-container-instances/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index fdb66be62..53abcfc16 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -40,6 +40,7 @@ cd graalvm-demos/azure-container-instances ``` az group create --name nativeResourceGroup --location ``` +Screen Shot 2023-06-20 at 12 38 21 PM **NOTE**: Available regions will be dependent on your current subscription, use the following command to see a list of those available to you: ``` @@ -50,6 +51,8 @@ az account list-locations ``` az acr create --resource-group nativeResourceGroup --name --sku Basic ``` +Screen Shot 2023-06-20 at 12 47 46 PM + A successful creation will output something similar to that shown in the screenshot above. Take note of the "loginServer" value as this is the fully qualified registry name. @@ -57,11 +60,15 @@ A successful creation will output something similar to that shown in the screens 5. Use the search bar at the top of the page to navigate to the "Container registries" page 6. Select the registry you previously created and select "Access keys" on the left side of the page 7. Toggle the "Admin User" switch so that it is enabled - a username and password(s) will appear that you will use to login to the registry on the CLI + +![Screen Shot 2023-06-20 at 12 50 39 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/c732cb96-14d1-428c-a23a-0637b22ee8ee) + + 8. To provide your credentials to Docker, run the following command and use the Username and Password from the previous step when prompted: ``` docker login .azurecr.io ``` -A successful authentication will return a "Login Succeeded" message +Screen Shot 2023-06-20 at 12 51 31 PM __OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: ``` @@ -69,7 +76,8 @@ __OPTIONAL__: In the next step you will use a single command to build the applic ``` The newly created Dockerfile will be automatically stored in the "target" directory -5. Use the Uri once again to push the image to the ACR: +9. Use the Uri once again to push the image to the ACR: ``` ./mvnw deploy -Dpackaging=docker-native -Djib.to.image=.azurecr.io/nativedemo ``` +Screen Shot 2023-06-20 at 1 09 02 PM From 8dc4ce4dda17a214431944db771a0d05f6280b67 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Fri, 23 Jun 2023 15:50:48 -0700 Subject: [PATCH 19/37] Update README.md --- azure-container-instances/README.md | 49 ++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index 53abcfc16..77fcd95bf 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -10,7 +10,7 @@ Ensure that you have the following installed and follow the linked instructions - GraalVM: https://www.graalvm.org/downloads/ Download or clone GraalVM demos repository: - ```bash + ```sh git clone https://github.com/graalvm/graalvm-demos ``` @@ -33,22 +33,22 @@ This code implements the actual RESTful "Hello World" functionality. It produces Deploy a Native Image Container on Azure Container Registry ---------------------- 1. Navigate to the directory for this demo: -```bash +```sh cd graalvm-demos/azure-container-instances ``` 2. Create a new Azure resource group that will store all resources for this demo: -``` +```sh az group create --name nativeResourceGroup --location ``` Screen Shot 2023-06-20 at 12 38 21 PM **NOTE**: Available regions will be dependent on your current subscription, use the following command to see a list of those available to you: -``` +```sh az account list-locations ``` 3. Create a container registry within the resource group (Chosen name must be unique across Azure and contain 5-50 lowercase alphanumeric characters): -``` +```sh az acr create --resource-group nativeResourceGroup --name --sku Basic ``` Screen Shot 2023-06-20 at 12 47 46 PM @@ -65,19 +65,52 @@ A successful creation will output something similar to that shown in the screens 8. To provide your credentials to Docker, run the following command and use the Username and Password from the previous step when prompted: -``` +```sh docker login .azurecr.io ``` Screen Shot 2023-06-20 at 12 51 31 PM __OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: -``` +```sh ./mvnw mn:dockerfile -Dpackaging=docker-native ``` The newly created Dockerfile will be automatically stored in the "target" directory 9. Use the Uri once again to push the image to the ACR: -``` +```sh ./mvnw deploy -Dpackaging=docker-native -Djib.to.image=.azurecr.io/nativedemo ``` Screen Shot 2023-06-20 at 1 09 02 PM + +Deploy the application on Azure Container Instances +---------------------- +1. Create a container within the same resource group that you created in the last section (When prompted, enter the registry username and password as you did in the previous section): +```sh +az container create --resource-group nativeResourceGroup --name nativecontainer --image .azurecr.io/nativedemo --dns-name-label nativeapp --ports 8080 +``` +Screen Shot 2023-06-20 at 1 29 47 PM + +2. Ensure that the provision has been successful: +```sh +az container show --resource-group nativeResourceGroup --name nativecontainer --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table +``` +Screen Shot 2023-06-23 at 3 38 32 PM + +3. If the ProvisioningState is "Succeeded" then you have properly deployed the application; to test it out use the outputted FQDN in your internet browser in the format: +```sh +:8080/hello +``` + +You should see a "Hello World" message displayed on the webpage: + +![Screen Shot 2023-06-20 at 1 31 20 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/d902babc-8516-4b3d-a177-51261c6820fb) + +Clean-up +--------------------- +Once you are completed with this demo, follow these steps to clean-up the resources created and ensure that you do not incur any charges: +1. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) +2. Use the search bar at the top of the screen to navigate to the "Resource groups" page +3. Select the resource group that you created, click "Delete resource group", and then follow the on-screen instructions to confirm the deletion + +![Screen Shot 2023-06-23 at 3 43 31 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/a53da96b-5ba1-46ea-a071-7b3dd756080f) + From 929f9726fc04c84378b5032b3af52a86ce13a2f4 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Fri, 23 Jun 2023 15:51:30 -0700 Subject: [PATCH 20/37] Update README.md --- azure-container-instances/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-container-instances/README.md b/azure-container-instances/README.md index 77fcd95bf..ad987c06a 100644 --- a/azure-container-instances/README.md +++ b/azure-container-instances/README.md @@ -10,9 +10,9 @@ Ensure that you have the following installed and follow the linked instructions - GraalVM: https://www.graalvm.org/downloads/ Download or clone GraalVM demos repository: - ```sh - git clone https://github.com/graalvm/graalvm-demos - ``` +```sh +git clone https://github.com/graalvm/graalvm-demos +``` Micronaut "Hello World" Application ---------------------- From 241222c9f9b10a5254ad609dfdbdb3484e25cf23 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:48:10 -0700 Subject: [PATCH 21/37] Update and rename aws-fargate.yml to native-azure-container-instances.yml --- .github/workflows/aws-fargate.yml | 40 ------------------- .../native-azure-container-instances.yml | 31 ++++++++++++++ 2 files changed, 31 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/aws-fargate.yml create mode 100644 .github/workflows/native-azure-container-instances.yml diff --git a/.github/workflows/aws-fargate.yml b/.github/workflows/aws-fargate.yml deleted file mode 100644 index 27988f8f4..000000000 --- a/.github/workflows/aws-fargate.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: aws-fargate -on: - push: - paths: - - 'aws-fargate/**' - - '.github/workflows/aws-fargate.yml' - pull_request: - paths: - - 'aws-fargate/**' - - '.github/workflows/aws-fargate.yml' - schedule: - - cron: "0 0 1 * *" # run every month - workflow_dispatch: -permissions: - contents: read -jobs: - run: - name: Run 'aws-fargate' - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - include: - - version: 'latest' - java-version: '17' - - version: 'dev' - java-version: '17' - steps: - - uses: actions/checkout@v3 - - uses: graalvm/setup-graalvm@v1 - with: - version: ${{ matrix.version }} - java-version: ${{ matrix.java-version }} - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run 'aws-fargate' - run: | - pwd - cd aws-fargate - mvn -Pnative spring-boot:build-image diff --git a/.github/workflows/native-azure-container-instances.yml b/.github/workflows/native-azure-container-instances.yml new file mode 100644 index 000000000..25f37ca86 --- /dev/null +++ b/.github/workflows/native-azure-container-instances.yml @@ -0,0 +1,31 @@ +name: native-azure-container-instances +on: + push: + paths: + - 'native-azure-container-instances/**' + - '.github/workflows/native-azure-container-instances.yml' + pull_request: + paths: + - 'native-azure-container-instances/**' + - '.github/workflows/native-azure-container-instances.yml' + schedule: + - cron: "0 0 1 * *" # run every month + workflow_dispatch: +permissions: + contents: read +jobs: + run: + name: Run 'native-azure-container-instances' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '17.0.7' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Run 'native-azure-container-instances' + run: | + cd native-azure-container-instances + ./mvnw package -Dpackaging=docker-native From 6580365ec9d4103b676874fcbbcf482bd6a46a4c Mon Sep 17 00:00:00 2001 From: egadbois Date: Tue, 27 Jun 2023 18:51:40 +0000 Subject: [PATCH 22/37] renamed --- .../.mvn/wrapper/maven-wrapper.properties | 0 .../README.md | 0 .../micronaut-cli.yml | 0 .../mvnw | 0 .../mvnw.cmd | 0 .../pom.xml | 0 .../src/main/java/example/micronaut/Application.java | 0 .../src/main/java/example/micronaut/HelloController.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/micronaut/HelloControllerTest.java | 0 .../src/test/java/example/micronaut/MicronautguideTest.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {azure-container-instances => native-azure-container-instances}/.mvn/wrapper/maven-wrapper.properties (100%) rename {azure-container-instances => native-azure-container-instances}/README.md (100%) rename {azure-container-instances => native-azure-container-instances}/micronaut-cli.yml (100%) rename {azure-container-instances => native-azure-container-instances}/mvnw (100%) rename {azure-container-instances => native-azure-container-instances}/mvnw.cmd (100%) rename {azure-container-instances => native-azure-container-instances}/pom.xml (100%) rename {azure-container-instances => native-azure-container-instances}/src/main/java/example/micronaut/Application.java (100%) rename {azure-container-instances => native-azure-container-instances}/src/main/java/example/micronaut/HelloController.java (100%) rename {azure-container-instances => native-azure-container-instances}/src/main/resources/application.yml (100%) rename {azure-container-instances => native-azure-container-instances}/src/main/resources/logback.xml (100%) rename {azure-container-instances => native-azure-container-instances}/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename {azure-container-instances => native-azure-container-instances}/src/test/java/example/micronaut/MicronautguideTest.java (100%) diff --git a/azure-container-instances/.mvn/wrapper/maven-wrapper.properties b/native-azure-container-instances/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from azure-container-instances/.mvn/wrapper/maven-wrapper.properties rename to native-azure-container-instances/.mvn/wrapper/maven-wrapper.properties diff --git a/azure-container-instances/README.md b/native-azure-container-instances/README.md similarity index 100% rename from azure-container-instances/README.md rename to native-azure-container-instances/README.md diff --git a/azure-container-instances/micronaut-cli.yml b/native-azure-container-instances/micronaut-cli.yml similarity index 100% rename from azure-container-instances/micronaut-cli.yml rename to native-azure-container-instances/micronaut-cli.yml diff --git a/azure-container-instances/mvnw b/native-azure-container-instances/mvnw similarity index 100% rename from azure-container-instances/mvnw rename to native-azure-container-instances/mvnw diff --git a/azure-container-instances/mvnw.cmd b/native-azure-container-instances/mvnw.cmd similarity index 100% rename from azure-container-instances/mvnw.cmd rename to native-azure-container-instances/mvnw.cmd diff --git a/azure-container-instances/pom.xml b/native-azure-container-instances/pom.xml similarity index 100% rename from azure-container-instances/pom.xml rename to native-azure-container-instances/pom.xml diff --git a/azure-container-instances/src/main/java/example/micronaut/Application.java b/native-azure-container-instances/src/main/java/example/micronaut/Application.java similarity index 100% rename from azure-container-instances/src/main/java/example/micronaut/Application.java rename to native-azure-container-instances/src/main/java/example/micronaut/Application.java diff --git a/azure-container-instances/src/main/java/example/micronaut/HelloController.java b/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from azure-container-instances/src/main/java/example/micronaut/HelloController.java rename to native-azure-container-instances/src/main/java/example/micronaut/HelloController.java diff --git a/azure-container-instances/src/main/resources/application.yml b/native-azure-container-instances/src/main/resources/application.yml similarity index 100% rename from azure-container-instances/src/main/resources/application.yml rename to native-azure-container-instances/src/main/resources/application.yml diff --git a/azure-container-instances/src/main/resources/logback.xml b/native-azure-container-instances/src/main/resources/logback.xml similarity index 100% rename from azure-container-instances/src/main/resources/logback.xml rename to native-azure-container-instances/src/main/resources/logback.xml diff --git a/azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java b/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java rename to native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java b/native-azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java similarity index 100% rename from azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java rename to native-azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java From 6912a0a10f8d811198c69cb7b8229ffac559cd8a Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:53:37 -0700 Subject: [PATCH 23/37] Update README.md --- native-azure-container-instances/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native-azure-container-instances/README.md b/native-azure-container-instances/README.md index ad987c06a..6216bdce6 100644 --- a/native-azure-container-instances/README.md +++ b/native-azure-container-instances/README.md @@ -34,7 +34,7 @@ Deploy a Native Image Container on Azure Container Registry ---------------------- 1. Navigate to the directory for this demo: ```sh -cd graalvm-demos/azure-container-instances +cd graalvm-demos/native-azure-container-instances ``` 2. Create a new Azure resource group that will store all resources for this demo: ```sh From b04e63b76061645fe2c08960f150954fbe508393 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:54:59 -0700 Subject: [PATCH 24/37] Update README.md --- native-azure-container-instances/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/native-azure-container-instances/README.md b/native-azure-container-instances/README.md index 6216bdce6..c2f5f81fe 100644 --- a/native-azure-container-instances/README.md +++ b/native-azure-container-instances/README.md @@ -9,6 +9,8 @@ Ensure that you have the following installed and follow the linked instructions - Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli - GraalVM: https://www.graalvm.org/downloads/ +**COMPATIBILITY**: Please note that this demo must be performed on an x86-based system in order to properly function. Working through this demo on an ARM-based system will result in the generation of a native image executable that is not compatible with the platform. + Download or clone GraalVM demos repository: ```sh git clone https://github.com/graalvm/graalvm-demos From c9f4d9585a7e61f33f0b33c43118e2ce996caaf8 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:57:31 -0700 Subject: [PATCH 25/37] Update Application.java --- .../java/example/micronaut/Application.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/native-azure-container-instances/src/main/java/example/micronaut/Application.java b/native-azure-container-instances/src/main/java/example/micronaut/Application.java index cc74c50ee..164a8f2bd 100644 --- a/native-azure-container-instances/src/main/java/example/micronaut/Application.java +++ b/native-azure-container-instances/src/main/java/example/micronaut/Application.java @@ -1,4 +1,43 @@ - +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package example.micronaut; import io.micronaut.runtime.Micronaut; @@ -8,4 +47,4 @@ public class Application { public static void main(String[] args) { Micronaut.run(Application.class, args); } -} \ No newline at end of file +} From 2d65441e3cdb8c117104585dd1a58297ad20909a Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:57:45 -0700 Subject: [PATCH 26/37] Update HelloController.java --- .../example/micronaut/HelloController.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java b/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java index e474ca3d8..23a98d9d6 100644 --- a/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java +++ b/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java @@ -1,3 +1,43 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package example.micronaut; import io.micronaut.http.MediaType; @@ -12,4 +52,4 @@ public class HelloController { public String index() { return "Hello World"; } -} \ No newline at end of file +} From daebcf2ca60a22ea6474230b0322c5ef4b70a2fa Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 11:58:19 -0700 Subject: [PATCH 27/37] Update HelloControllerTest.java --- .../micronaut/HelloControllerTest.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java b/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java index 4ecd967bf..d58c7e43d 100644 --- a/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java +++ b/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java @@ -1,3 +1,43 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package example.micronaut; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -26,4 +66,4 @@ public void testHello() { assertNotNull(body); assertEquals("Hello World", body); } -} \ No newline at end of file +} From a2d7d587d9a710c0f7159b62b23d1e601fd51030 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:04:54 -0700 Subject: [PATCH 28/37] Update README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 879468c24..7f14f44da 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,23 @@ cd graalvm-demos +### Native Image on Cloud Platforms + + + + + + + + + + + + + + +
NameDescription
native-azure-container-instances
native-azure-container-instances
This demo covers the steps required to deploy native image applications on the Azure Container Instances platform.
Technologies: Native Image, Docker, Azure CLI, Azure Container Instances
+ ### Java on Truffle (Espresso) From c486fbf0505dfc3cfde6a1a51ed4b2b9fb39ee36 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:05:42 -0700 Subject: [PATCH 29/37] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 7f14f44da..539338d8f 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,7 @@ cd graalvm-demos - - - -
native-image-jmx-demo
nnative-image-jmx-demo
This demo covers the steps required to build, run, and interact with a native executable using JMX.
Technologies: Native Image, JMX, VisualVM
Reference: Build and Run Native Executables with Remote JMX
aws-fargate
aws-fargate
This demo covers the steps required to create a container image of a native executable application and deploy the image onto AWS Fargate.
Technologies: Native Image, Apache Maven, Docker, AWS Fargate
+
From c26cfee659d664f87c750d6f4ff117590f7d0489 Mon Sep 17 00:00:00 2001 From: egadbois Date: Tue, 27 Jun 2023 19:12:53 +0000 Subject: [PATCH 30/37] renamed --- .../.mvn/wrapper/maven-wrapper.properties | 0 .../README.md | 0 .../micronaut-cli.yml | 0 .../mvnw | 0 .../mvnw.cmd | 0 .../pom.xml | 0 .../src/main/java/example/micronaut/Application.java | 0 .../src/main/java/example/micronaut/HelloController.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/example/micronaut/HelloControllerTest.java | 0 .../src/test/java/example/micronaut/MicronautguideTest.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {native-azure-container-instances => native-oci-container-instances}/.mvn/wrapper/maven-wrapper.properties (100%) rename {native-azure-container-instances => native-oci-container-instances}/README.md (100%) rename {native-azure-container-instances => native-oci-container-instances}/micronaut-cli.yml (100%) rename {native-azure-container-instances => native-oci-container-instances}/mvnw (100%) rename {native-azure-container-instances => native-oci-container-instances}/mvnw.cmd (100%) rename {native-azure-container-instances => native-oci-container-instances}/pom.xml (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/main/java/example/micronaut/Application.java (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/main/java/example/micronaut/HelloController.java (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/main/resources/application.yml (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/main/resources/logback.xml (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename {native-azure-container-instances => native-oci-container-instances}/src/test/java/example/micronaut/MicronautguideTest.java (100%) diff --git a/native-azure-container-instances/.mvn/wrapper/maven-wrapper.properties b/native-oci-container-instances/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from native-azure-container-instances/.mvn/wrapper/maven-wrapper.properties rename to native-oci-container-instances/.mvn/wrapper/maven-wrapper.properties diff --git a/native-azure-container-instances/README.md b/native-oci-container-instances/README.md similarity index 100% rename from native-azure-container-instances/README.md rename to native-oci-container-instances/README.md diff --git a/native-azure-container-instances/micronaut-cli.yml b/native-oci-container-instances/micronaut-cli.yml similarity index 100% rename from native-azure-container-instances/micronaut-cli.yml rename to native-oci-container-instances/micronaut-cli.yml diff --git a/native-azure-container-instances/mvnw b/native-oci-container-instances/mvnw similarity index 100% rename from native-azure-container-instances/mvnw rename to native-oci-container-instances/mvnw diff --git a/native-azure-container-instances/mvnw.cmd b/native-oci-container-instances/mvnw.cmd similarity index 100% rename from native-azure-container-instances/mvnw.cmd rename to native-oci-container-instances/mvnw.cmd diff --git a/native-azure-container-instances/pom.xml b/native-oci-container-instances/pom.xml similarity index 100% rename from native-azure-container-instances/pom.xml rename to native-oci-container-instances/pom.xml diff --git a/native-azure-container-instances/src/main/java/example/micronaut/Application.java b/native-oci-container-instances/src/main/java/example/micronaut/Application.java similarity index 100% rename from native-azure-container-instances/src/main/java/example/micronaut/Application.java rename to native-oci-container-instances/src/main/java/example/micronaut/Application.java diff --git a/native-azure-container-instances/src/main/java/example/micronaut/HelloController.java b/native-oci-container-instances/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from native-azure-container-instances/src/main/java/example/micronaut/HelloController.java rename to native-oci-container-instances/src/main/java/example/micronaut/HelloController.java diff --git a/native-azure-container-instances/src/main/resources/application.yml b/native-oci-container-instances/src/main/resources/application.yml similarity index 100% rename from native-azure-container-instances/src/main/resources/application.yml rename to native-oci-container-instances/src/main/resources/application.yml diff --git a/native-azure-container-instances/src/main/resources/logback.xml b/native-oci-container-instances/src/main/resources/logback.xml similarity index 100% rename from native-azure-container-instances/src/main/resources/logback.xml rename to native-oci-container-instances/src/main/resources/logback.xml diff --git a/native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java b/native-oci-container-instances/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from native-azure-container-instances/src/test/java/example/micronaut/HelloControllerTest.java rename to native-oci-container-instances/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/native-azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java b/native-oci-container-instances/src/test/java/example/micronaut/MicronautguideTest.java similarity index 100% rename from native-azure-container-instances/src/test/java/example/micronaut/MicronautguideTest.java rename to native-oci-container-instances/src/test/java/example/micronaut/MicronautguideTest.java From db74449ce29cdb53c5053f03f143025f3bbe8932 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:14:15 -0700 Subject: [PATCH 31/37] Update README.md --- native-oci-container-instances/README.md | 177 +++++++++++------------ 1 file changed, 81 insertions(+), 96 deletions(-) diff --git a/native-oci-container-instances/README.md b/native-oci-container-instances/README.md index c2f5f81fe..54849cea5 100644 --- a/native-oci-container-instances/README.md +++ b/native-oci-container-instances/README.md @@ -1,118 +1,103 @@ -GraalVM on Azure Container Instances Demo +GraalVM on OCI Container Instances Demo ============================= -This demo will walk you through the process of containerizing a Native Image application and then launching the image on the Azure platform by using the Azure Container Registry and Azure Container Instances. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. +This demo will walk you through the process of containerizing a Native Image application and then launching the image on the OCI platform by using the Container Instance service. In this demo, you will deploy a simple "Hello World" HTTP application and have the ability to see details about its performance. Prerequisites ---------------------- Ensure that you have the following installed and follow the linked instructions for any that you are missing: - Docker: https://docs.docker.com/desktop/ -- Azure CLI: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli -- GraalVM: https://www.graalvm.org/downloads/ - -**COMPATIBILITY**: Please note that this demo must be performed on an x86-based system in order to properly function. Working through this demo on an ARM-based system will result in the generation of a native image executable that is not compatible with the platform. - -Download or clone GraalVM demos repository: -```sh -git clone https://github.com/graalvm/graalvm-demos -``` - -Micronaut "Hello World" Application +- Apache Maven: https://maven.apache.org/install.html +- Your OCI account also must have the proper permissions to create container instances; follow this guide to grant access: https://docs.oracle.com/en-us/iaas/Content/container-instances/permissions/policy-reference.htm#examples__let-users-create-container-instances + +1. Download and install the latest GraalVM JDK with Native Image using the [GraalVM JDK Downloader](https://github.com/graalvm/graalvm-jdk-downloader). + ```bash + bash <(curl -sL https://get.graalvm.org/jdk) + ``` +2. Download or clone GraalVM demos repository: + ```bash + git clone https://github.com/graalvm/graalvm-demos + ``` + +Configure authentication ---------------------- -The code provided in this demo is a simple "Hello World" REST application created using the Micronaut framework. To understand what the code is doing, take a look at the _Application.java_ and _HelloController.java_ files: - -**Application.java** - -Application.java - -This is the location of the main() function and entry point for the application. - -**HelloController.java** +1. Open the OCI [dashboard](https://cloud.oracle.com/) and login to your profile +2. Open the Profile menu on the top-right of the screen and click "User Settings" +3. Under "Auth Tokens", click "Generate Token" +4. After choosing a description, the token will be presented to you. Immediately copy the token to a secure location because you will not be able to view it again in the console +5. On your local machine's terminal (where Docker is installed), login to the Registry: +``` +docker login .ocir.io +``` +For a list of all region keys, [click here](https://docs.oracle.com/en-us/iaas/Content/Registry/Concepts/registryprerequisites.htm#regional-availability) -HelloController.java +6. When prompted for a username, provide yours in the format: +``` +/ +``` +Tenancy namespace can be found on the [Tenancy Information](https://cloud.oracle.com/tenancy) page if you do not know it -This code implements the actual RESTful "Hello World" functionality. It produces the "Hello World" string when a GET request is made to the "/hello" URL. +7. Use the authorization token to created previously as the password when prompted -Deploy a Native Image Container on Azure Container Registry +Deploy a Native Image Container on OCI Container Registry ---------------------- 1. Navigate to the directory for this demo: -```sh -cd graalvm-demos/native-azure-container-instances +```bash +cd graalvm-demos/oci-instances ``` -2. Create a new Azure resource group that will store all resources for this demo: -```sh -az group create --name nativeResourceGroup --location +2. Build the container image: ``` -Screen Shot 2023-06-20 at 12 38 21 PM - -**NOTE**: Available regions will be dependent on your current subscription, use the following command to see a list of those available to you: -```sh -az account list-locations +mvn -Pnative spring-boot:build-image ``` - -3. Create a container registry within the resource group (Chosen name must be unique across Azure and contain 5-50 lowercase alphanumeric characters): -```sh -az acr create --resource-group nativeResourceGroup --name --sku Basic -``` -Screen Shot 2023-06-20 at 12 47 46 PM - - -A successful creation will output something similar to that shown in the screenshot above. Take note of the "loginServer" value as this is the fully qualified registry name. - -4. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) -5. Use the search bar at the top of the page to navigate to the "Container registries" page -6. Select the registry you previously created and select "Access keys" on the left side of the page -7. Toggle the "Admin User" switch so that it is enabled - a username and password(s) will appear that you will use to login to the registry on the CLI - -![Screen Shot 2023-06-20 at 12 50 39 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/c732cb96-14d1-428c-a23a-0637b22ee8ee) - - -8. To provide your credentials to Docker, run the following command and use the Username and Password from the previous step when prompted: -```sh -docker login .azurecr.io +3. Tag the image with the location for it to be stored (`````` may be an existing repository or any name for a repository that will be created upon pushing the image): ``` -Screen Shot 2023-06-20 at 12 51 31 PM - -__OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: -```sh -./mvnw mn:dockerfile -Dpackaging=docker-native +docker tag oci-instance-demo:0.0.1-SNAPSHOT .ocir.io// ``` -The newly created Dockerfile will be automatically stored in the "target" directory - -9. Use the Uri once again to push the image to the ACR: -```sh -./mvnw deploy -Dpackaging=docker-native -Djib.to.image=.azurecr.io/nativedemo +4. Push the image to the registry: ``` -Screen Shot 2023-06-20 at 1 09 02 PM - -Deploy the application on Azure Container Instances ----------------------- -1. Create a container within the same resource group that you created in the last section (When prompted, enter the registry username and password as you did in the previous section): -```sh -az container create --resource-group nativeResourceGroup --name nativecontainer --image .azurecr.io/nativedemo --dns-name-label nativeapp --ports 8080 +docker push .ocir.io//:latest ``` -Screen Shot 2023-06-20 at 1 29 47 PM - -2. Ensure that the provision has been successful: -```sh -az container show --resource-group nativeResourceGroup --name nativecontainer --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table +5. On a browser, visit the OCI dashboard and open the side menu to locate "Developer Services" -> "Containers & Artifacts" -> "Container Registry" +6. Select the directory in which you stored your image (the location corresponds to the `````` that you tagged the image with) +7. Ensure that the Access type is "Public"; if it is not, click "Actions" in the top-right corner and select "Change to public" +Screen Shot 2023-06-06 at 4 57 54 PM + +Create an OCI Container Instance +------------------------- +1. From the main OCI dashboard, open the side menu and click on "Developer Services" -> "Containers & Artifacts" -> "Container Instances" +Screen Shot 2023-06-06 at 4 28 20 PM + +2. Click "Create container instance" +3. Input a name and compartment location for the instance +4. In the "Shape" section, adjust the sliders to your desired amounts of OCPUs and Memory (For this demo, 4 OCPUs and 128 GBs will be plenty) +Screen Shot 2023-06-06 at 4 29 11 PM + +5. In the "Networking" section, you may either use a pre-existing VCN or create a new one +6. Leave the remaining options as their default and click "Next" +7. Choose a name for the container (or leave as default) and in the "Image" section click "Select image" +Screen Shot 2023-06-06 at 4 31 31 PM + +8. Locate the image that you pushed in the previous section according to the `````` directory that you chose +9. Create the container and allow it a moment to intialize +Screen Shot 2023-06-06 at 4 31 55 PM + +10. A successful deployment will result in the large icon box turning green and the status "ACTIVE" displayed beneath it +Screen Shot 2023-06-07 at 12 12 57 PM + +Configure the Security Group +------------------------ +1. On the OCI platform, open the side menu and click on "Networking" -> "Virtual cloud networks" +2. Click on the VCN that your container instance is using (If you do not see the VCN, ensure that you are in the correct compartment via the drop-down menu on the left side of the screen) +3. Click "Network Security Groups" and then "Create Network Security Group" +4. Choose a name and compartment for the new group then click "Next" +5. Select "Ingress" as the Direction, CIDR for Source Type, "0.0.0.0/0" for Source CIDR, and leave the remaining fields as their default - then click "Create" +Screen Shot 2023-06-07 at 12 28 43 PM + +6. Return to the page for your container instance and click "Edit" beside "Network security groups" +7. Locate the newly created security group and click "Save changes" +8. To test the deployment, copy the Public IP address and input it into your web browser in the format: ``` -Screen Shot 2023-06-23 at 3 38 32 PM - -3. If the ProvisioningState is "Succeeded" then you have properly deployed the application; to test it out use the outputted FQDN in your internet browser in the format: -```sh -:8080/hello +http://:8080/hello ``` +9. If you have completed the demo successfully, a "Hello World!" message will be displayed! -You should see a "Hello World" message displayed on the webpage: - -![Screen Shot 2023-06-20 at 1 31 20 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/d902babc-8516-4b3d-a177-51261c6820fb) - -Clean-up ---------------------- -Once you are completed with this demo, follow these steps to clean-up the resources created and ensure that you do not incur any charges: -1. On an internet browser, open the [Azure dashboard](https://portal.azure.com/#home) -2. Use the search bar at the top of the screen to navigate to the "Resource groups" page -3. Select the resource group that you created, click "Delete resource group", and then follow the on-screen instructions to confirm the deletion - -![Screen Shot 2023-06-23 at 3 43 31 PM](https://github.com/egadbois/graalvm-demos/assets/134104678/a53da96b-5ba1-46ea-a071-7b3dd756080f) - +![Hello World!](https://github.com/egadbois/graalvm-demos/assets/134104678/1035cf33-a53a-4f12-af5d-ee88e83244c8) From 72b277b61ebd91e4712cf64cae7e4e40df27fe43 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:16:45 -0700 Subject: [PATCH 32/37] Update README.md --- native-oci-container-instances/README.md | 48 +++++++++++++++--------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/native-oci-container-instances/README.md b/native-oci-container-instances/README.md index 54849cea5..92483e932 100644 --- a/native-oci-container-instances/README.md +++ b/native-oci-container-instances/README.md @@ -6,17 +6,31 @@ Prerequisites ---------------------- Ensure that you have the following installed and follow the linked instructions for any that you are missing: - Docker: https://docs.docker.com/desktop/ -- Apache Maven: https://maven.apache.org/install.html +- GraalVM: https://www.graalvm.org/downloads/ - Your OCI account also must have the proper permissions to create container instances; follow this guide to grant access: https://docs.oracle.com/en-us/iaas/Content/container-instances/permissions/policy-reference.htm#examples__let-users-create-container-instances -1. Download and install the latest GraalVM JDK with Native Image using the [GraalVM JDK Downloader](https://github.com/graalvm/graalvm-jdk-downloader). - ```bash - bash <(curl -sL https://get.graalvm.org/jdk) - ``` -2. Download or clone GraalVM demos repository: - ```bash - git clone https://github.com/graalvm/graalvm-demos - ``` +**COMPATIBILITY**: Please note that this demo must be performed on an x86-based system in order to properly function. Working through this demo on an ARM-based system will result in the generation of a native image executable that is not compatible with the platform. + +Download or clone GraalVM demos repository: +```sh +git clone https://github.com/graalvm/graalvm-demos +``` + +Micronaut "Hello World" Application +---------------------- +The code provided in this demo is a simple "Hello World" REST application created using the Micronaut framework. To understand what the code is doing, take a look at the _Application.java_ and _HelloController.java_ files: + +**Application.java** + +Application.java + +This is the location of the main() function and entry point for the application. + +**HelloController.java** + +HelloController.java + +This code implements the actual RESTful "Hello World" functionality. It produces the "Hello World" string when a GET request is made to the "/hello" URL. Configure authentication ---------------------- @@ -25,13 +39,13 @@ Configure authentication 3. Under "Auth Tokens", click "Generate Token" 4. After choosing a description, the token will be presented to you. Immediately copy the token to a secure location because you will not be able to view it again in the console 5. On your local machine's terminal (where Docker is installed), login to the Registry: -``` +```sh docker login .ocir.io ``` For a list of all region keys, [click here](https://docs.oracle.com/en-us/iaas/Content/Registry/Concepts/registryprerequisites.htm#regional-availability) 6. When prompted for a username, provide yours in the format: -``` +```sh / ``` Tenancy namespace can be found on the [Tenancy Information](https://cloud.oracle.com/tenancy) page if you do not know it @@ -41,19 +55,19 @@ Tenancy namespace can be found on the [Tenancy Information](https://cloud.oracle Deploy a Native Image Container on OCI Container Registry ---------------------- 1. Navigate to the directory for this demo: -```bash -cd graalvm-demos/oci-instances +```sh +cd graalvm-demos/native-oci-instances ``` 2. Build the container image: -``` +```sh mvn -Pnative spring-boot:build-image ``` 3. Tag the image with the location for it to be stored (`````` may be an existing repository or any name for a repository that will be created upon pushing the image): -``` +```sh docker tag oci-instance-demo:0.0.1-SNAPSHOT .ocir.io// ``` 4. Push the image to the registry: -``` +```sh docker push .ocir.io//:latest ``` 5. On a browser, visit the OCI dashboard and open the side menu to locate "Developer Services" -> "Containers & Artifacts" -> "Container Registry" @@ -95,7 +109,7 @@ Configure the Security Group 6. Return to the page for your container instance and click "Edit" beside "Network security groups" 7. Locate the newly created security group and click "Save changes" 8. To test the deployment, copy the Public IP address and input it into your web browser in the format: -``` +```sh http://:8080/hello ``` 9. If you have completed the demo successfully, a "Hello World!" message will be displayed! From 98bf87a90e5932e0f2b16ca821fb915beeb03f51 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:19:46 -0700 Subject: [PATCH 33/37] Update README.md --- native-oci-container-instances/README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/native-oci-container-instances/README.md b/native-oci-container-instances/README.md index 92483e932..603f7d547 100644 --- a/native-oci-container-instances/README.md +++ b/native-oci-container-instances/README.md @@ -58,21 +58,20 @@ Deploy a Native Image Container on OCI Container Registry ```sh cd graalvm-demos/native-oci-instances ``` -2. Build the container image: -```sh -mvn -Pnative spring-boot:build-image -``` -3. Tag the image with the location for it to be stored (`````` may be an existing repository or any name for a repository that will be created upon pushing the image): + +__OPTIONAL__: In the next step you will use a single command to build the application into a container image and deploy it to the repository you have created; if you would like to first view the Docker file that will be used to create the image, run the following command: ```sh -docker tag oci-instance-demo:0.0.1-SNAPSHOT .ocir.io// +./mvnw mn:dockerfile -Dpackaging=docker-native ``` -4. Push the image to the registry: +The newly created Dockerfile will be automatically stored in the "target" directory + +2. Build the container image and push it to the OCI registry (`````` may be an existing repository or any name for a repository that will be created upon pushing the image): ```sh -docker push .ocir.io//:latest +./mvnw deploy -Dpackaging=docker-native -Djib.to.image=.ocir.io// ``` -5. On a browser, visit the OCI dashboard and open the side menu to locate "Developer Services" -> "Containers & Artifacts" -> "Container Registry" -6. Select the directory in which you stored your image (the location corresponds to the `````` that you tagged the image with) -7. Ensure that the Access type is "Public"; if it is not, click "Actions" in the top-right corner and select "Change to public" +3. On a browser, visit the OCI dashboard and open the side menu to locate "Developer Services" -> "Containers & Artifacts" -> "Container Registry" +4. Select the directory in which you stored your image (the location corresponds to the `````` that you tagged the image with) +5. Ensure that the Access type is "Public"; if it is not, click "Actions" in the top-right corner and select "Change to public" Screen Shot 2023-06-06 at 4 57 54 PM Create an OCI Container Instance @@ -115,3 +114,6 @@ http://:8080/hello 9. If you have completed the demo successfully, a "Hello World!" message will be displayed! ![Hello World!](https://github.com/egadbois/graalvm-demos/assets/134104678/1035cf33-a53a-4f12-af5d-ee88e83244c8) + +Clean-Up +--------------------------- From 80cd5f03ae4dab52b9cc063a312135ed57f9a85e Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 12:22:00 -0700 Subject: [PATCH 34/37] Update README.md --- native-oci-container-instances/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native-oci-container-instances/README.md b/native-oci-container-instances/README.md index 603f7d547..a825a6aeb 100644 --- a/native-oci-container-instances/README.md +++ b/native-oci-container-instances/README.md @@ -111,9 +111,9 @@ Configure the Security Group ```sh http://:8080/hello ``` -9. If you have completed the demo successfully, a "Hello World!" message will be displayed! +9. If you have completed the demo successfully, a "Hello World" message will be displayed! -![Hello World!](https://github.com/egadbois/graalvm-demos/assets/134104678/1035cf33-a53a-4f12-af5d-ee88e83244c8) +![Hello World](https://github.com/egadbois/graalvm-demos/assets/134104678/593016fb-6623-4757-aeab-723d93c010ad) Clean-Up --------------------------- From 124880f980282b808352e89076484b310eafa927 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 13:09:29 -0700 Subject: [PATCH 35/37] Update and rename native-azure-container-instances.yml to native-oci-container-instances.yml --- ...es.yml => native-oci-container-instances.yml} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename .github/workflows/{native-azure-container-instances.yml => native-oci-container-instances.yml} (55%) diff --git a/.github/workflows/native-azure-container-instances.yml b/.github/workflows/native-oci-container-instances.yml similarity index 55% rename from .github/workflows/native-azure-container-instances.yml rename to .github/workflows/native-oci-container-instances.yml index 25f37ca86..176ef7941 100644 --- a/.github/workflows/native-azure-container-instances.yml +++ b/.github/workflows/native-oci-container-instances.yml @@ -1,13 +1,13 @@ -name: native-azure-container-instances +name: native-oci-container-instances on: push: paths: - - 'native-azure-container-instances/**' - - '.github/workflows/native-azure-container-instances.yml' + - 'native-oci-container-instances/**' + - '.github/workflows/native-oci-container-instances.yml' pull_request: paths: - - 'native-azure-container-instances/**' - - '.github/workflows/native-azure-container-instances.yml' + - 'native-oci-container-instances/**' + - '.github/workflows/native-oci-container-instances.yml' schedule: - cron: "0 0 1 * *" # run every month workflow_dispatch: @@ -15,7 +15,7 @@ permissions: contents: read jobs: run: - name: Run 'native-azure-container-instances' + name: Run 'native-oci-container-instances' runs-on: ubuntu-latest timeout-minutes: 20 steps: @@ -25,7 +25,7 @@ jobs: java-version: '17.0.7' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run 'native-azure-container-instances' + - name: Run 'native-oci-container-instances' run: | - cd native-azure-container-instances + cd native-oci-container-instances ./mvnw package -Dpackaging=docker-native From 9af1d246fea9fcbbe615759aecaecbf014e5969b Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 13:51:01 -0700 Subject: [PATCH 36/37] Update README.md --- native-oci-container-instances/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/native-oci-container-instances/README.md b/native-oci-container-instances/README.md index a825a6aeb..ba4b108ee 100644 --- a/native-oci-container-instances/README.md +++ b/native-oci-container-instances/README.md @@ -117,3 +117,23 @@ http://:8080/hello Clean-Up --------------------------- +Once you have completed this demo, follow these instructions to delete the created resources: +1. Visit the OCI [dashboard](https://cloud.oracle.com/) +2. Open the side menu and click on "Developer Services" -> "Containers & Artifacts" -> "Container Registry" +3. Select the container image that you uploaded and under the "Actions" drop down select "Delete repository" + +![Delete repository](https://github.com/egadbois/graalvm-demos/assets/134104678/da43004b-d017-49c4-8273-5bf0a4acc2cd) + +4. On the left side of the page, select "Container Instances" +5. Select the container instance that you created and under the "More actions" drop down select "Delete" + +![Delete instance](https://github.com/egadbois/graalvm-demos/assets/134104678/5289230a-1a19-4f71-b4bb-1669e1c6f671) + +6. Open the side menu and click on "Networking" -> "Virtual cloud networks" +7. Select the VCN that you created for your container instance +8. Click the red "Delete" button + +![Delete VCN](https://github.com/egadbois/graalvm-demos/assets/134104678/a45cbb7e-59ec-4952-9a54-899907a9e094) + +9. Click "Scan" - this will return a list of any lingering resources that are referencing the VCN +10. Click "Delete all" to remove the listed resources (if this fails you can select each resource individually to delete them on their own pages) From 1f96700eddcfed537b79053f2f6035317ebcae69 Mon Sep 17 00:00:00 2001 From: Eric Gadbois Date: Tue, 27 Jun 2023 13:53:42 -0700 Subject: [PATCH 37/37] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 539338d8f..58343973b 100644 --- a/README.md +++ b/README.md @@ -113,8 +113,8 @@ cd graalvm-demos - native-azure-container-instances
native-azure-container-instances - This demo covers the steps required to deploy native image applications on the Azure Container Instances platform.
Technologies: Native Image, Docker, Azure CLI, Azure Container Instances
+ native-oci-container-instances
native-oci-container-instances + This demo covers the steps required to deploy native image applications on the OCI Container Instances platform.
Technologies: Native Image, Docker, OCI Container Instances