2024-06-13 20:20:25 +00:00
#!/bin/bash
set -exo pipefail
function main( )
{
2024-07-11 19:35:08 +00:00
#upgradeSystem
apt-get update && apt-get -qqy upgrade
2024-06-25 05:46:00 +00:00
apt-get -qqy install curl git build-essential libz-dev zlib1g-dev
2024-06-25 13:24:00 +00:00
2024-06-14 15:41:12 +00:00
#change to main branch for production
2024-06-26 10:11:50 +00:00
#change to MEapp-development branch for development
git clone --single-branch --branch main https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
2024-06-13 20:20:25 +00:00
#download gradle
#gradle_version="8.4"
#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
2024-06-14 15:41:12 +00:00
#download graalvm
2024-07-09 07:02:32 +00:00
#graalvm-community-jdk, v22.0.1 2024-04-16
graalvm_jdk_version = "22.0.1"
2024-07-11 19:35:08 +00:00
curl -SsLo /tmp/graalvm-community-jdk-${ graalvm_jdk_version } _linux-x64_bin.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-22.0.1/graalvm-community-jdk-22.0.1_linux-x64_bin.tar.gz
curl -SsLo /tmp/graalvm-community-jdk-${ graalvm_jdk_version } _linux-x64_bin.tar.gz.sha256 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
2024-06-14 15:41:12 +00:00
2024-06-20 13:09:08 +00:00
#checksum graalvm
2024-06-14 15:41:12 +00:00
checksum
2024-06-13 20:20:25 +00:00
2024-06-20 13:09:08 +00:00
#install graalvm
2024-06-25 13:24:00 +00:00
graalvm_inst
2024-06-13 20:20:25 +00:00
2024-07-09 07:02:32 +00:00
#nativeCompile
2024-06-25 13:24:00 +00:00
buildproc
2024-07-09 07:02:32 +00:00
2024-07-11 19:35:08 +00:00
#cleanupDocker
rm -f /root/.ssh/authorized_keys
rm -f /root/.ssh/authorized_keys2
apt-get clean
apt-get -qqy autoremove --purge
apt-get -qqy autoclean
rm -rf /var/lib/apt/lists/
rm -rf /tmp/*
find /var/cache -type f -exec rm -rf { } \;
find /var/log/ -name '*.log' -exec rm -f { } \;
2024-06-20 22:27:52 +00:00
2024-06-25 05:46:00 +00:00
} > /dev/null
2024-06-13 20:20:25 +00:00
function checksum( ) {
2024-06-14 15:41:12 +00:00
#graalvm
2024-07-11 19:35:08 +00:00
echo " /tmp/graalvm-community-jdk- ${ graalvm_jdk_version } _linux-x64_bin.tar.gz " | tee -a /tmp/graalvm-community-jdk-${ graalvm_jdk_version } _linux-x64_bin.tar.gz.sha256
sha256sum -c --status /tmp/graalvm-community-jdk-${ graalvm_jdk_version } _linux-x64_bin.tar.gz.sha256
2024-06-13 20:20:25 +00:00
}
2024-06-25 13:24:00 +00:00
function graalvm_inst( ) {
2024-07-11 19:35:08 +00:00
mkdir /usr/lib/jvm/
tar -C /usr/lib/jvm/ -xzf /tmp/graalvm-community-jdk-${ graalvm_jdk_version } _linux-x64_bin.tar.gz
dirname_graalvm = $( ls /usr/lib/jvm/| grep -e graa)
mkdir /usr/lib/jvm/graalvm/
ln -s /usr/lib/jvm/$dirname_graalvm /bin/ /usr/lib/jvm/graalvm/
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 0
echo " export PATH= $PATH :/usr/lib/jvm/graalvm/bin " | tee -a ~/.bashrc
2024-06-25 13:24:00 +00:00
}
function buildproc( ) {
2024-07-11 19:35:08 +00:00
cd /usr/local/src/ModeratorElection/
#build graalvm binary
./gradlew nativeCompile -Dvaadin.productionMode= true -x processTestAot
2024-06-25 13:24:00 +00:00
}
2024-07-11 19:35:08 +00:00
#source /tmp/install_functions_debian.sh
2024-06-13 20:20:25 +00:00
DEBIAN_FRONTEND = noninteractive DEBCONF_NOWARNINGS = yes main
2024-06-20 22:27:52 +00:00
2024-06-25 13:24:00 +00:00