Installing graalvm and usage to build binary for deploying, need some improvements

This commit is contained in:
Mirco 2024-06-14 17:41:12 +02:00
parent afb0f46545
commit 623e8a9d72
4 changed files with 67 additions and 10 deletions

View file

@ -10,6 +10,7 @@ plugins {
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'com.vaadin'
id 'org.graalvm.buildtools.native' version '0.10.2'
}
repositories {
@ -42,4 +43,25 @@ dependencyManagement {
test{
useJUnitPlatform()
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
graalvmNative {
binaries {
main {
imageName.set('ModeratorElection')
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
//vendor.set(JvmVendorSpec.GRAAL_VM)
})
}
}
testSupport = false
toolchainDetection = false
}

View file

@ -10,8 +10,18 @@ java -jar build/libs/ModeratorElection.jar -> localhost:6333 "White Label..."-Er
..in ide dev: ./gradlew clean vaadinPrepareFrontend
```
```
For production:
* install.sh
git clone --single-branch --branch MEapp-development https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
=> --branch main
```
```
build graalvm binary
./gradlew nativeCompile failed, need for some improvements!
```
```

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -5,9 +5,11 @@ set -exo pipefail
function main()
{
upgradeSystem
apt-get -qqy install openjdk-17-jdk-headless git curl unzip
#openjdk-17-jdk-headless, no need, we are installing graalvm
apt-get -qqy install git curl unzip
mkdir /usr/local/src/ModeratorElection
git clone --single-branch --branch main https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
#change to main branch for production
git clone --single-branch --branch MEapp-development https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
cp /tmp/MEMBERNAMES /usr/local/src/ModeratorElection
#download gradle
@ -15,16 +17,35 @@ function main()
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip.sha256 https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip.sha256
#checksum gradle
#checksum
#download graalvm
#oracle graalvm-jdk, v17.0.11, 2024-06-14
graalvm_JDK_version="17"
curl -SsLo /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz https://download.oracle.com/graalvm/${graalvm_JDK_version}/latest/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
curl -SsLo /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256 https://download.oracle.com/graalvm/${graalvm_JDK_version}/latest/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
#graalvm-community-jdk, v17.0.8, 2023-07-25
#graalvm_jdk_version="17.0.8"
#curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz
#curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256
#checksum gradle, graalvm
checksum
#install gradle
#mkdir /opt/gradle
#unzip -qqd /opt/gradle /tmp/gradle-${gradle_version}-bin.zip
#export PATH=$PATH:/opt/gradle/gradle-${gradle_version}/bin
#install graalvm -- ToDo: need to be checked, graalvm after installing available as default-jvm?
tar -C /usr/lib/jvm/ -xzf graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz
dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
#ToDo install graalvm, put graalvm binary here
#ToDo install by graalvm, put graalvm binary here
#install -m 0700 /tmp/entrypoint-start-and-wait.sh /
#install -m 0700 /tmp/init.sh /usr/local/bin/
@ -37,14 +58,18 @@ function main()
function checksum() {
#gradle
echo " /tmp/gradle-${gradle_version}-bin.zip"|tee -a /tmp/gradle-${gradle_version}-bin.zip.sha256
sha256sum -c --status /tmp/gradle-${gradle_version}-bin.zip.sha256
#echo " /tmp/gradle-${gradle_version}-bin.zip"|tee -a /tmp/gradle-${gradle_version}-bin.zip.sha256
#sha256sum -c --status /tmp/gradle-${gradle_version}-bin.zip.sha256
#graalvm
echo " /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz"|tee -a /tmp/graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
sha256sum -c --status graalvm-jdk-${graalvm_JDK_version}_linux-x64_bin.tar.gz.sha256
}
source /tmp/install_functions_debian.sh
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
cd /usr/local/src/ModeratorElection
#cd /usr/local/src/ModeratorElection
#npm install -g npm@latest
#npm audit fix
#npm ci --omit=dev