forked from meissa/ModeratorElection
Compare commits
3 commits
main
...
MEapp-deve
Author | SHA1 | Date | |
---|---|---|---|
623e8a9d72 | |||
afb0f46545 | |||
6900a54157 |
8 changed files with 201 additions and 6 deletions
24
build.gradle
24
build.gradle
|
@ -10,6 +10,7 @@ plugins {
|
||||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'com.vaadin'
|
id 'com.vaadin'
|
||||||
|
id 'org.graalvm.buildtools.native' version '0.10.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -42,4 +43,25 @@ dependencyManagement {
|
||||||
|
|
||||||
test{
|
test{
|
||||||
useJUnitPlatform()
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
55
build.py
Normal file
55
build.py
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
from os import environ
|
||||||
|
from datetime import datetime
|
||||||
|
from pybuilder.core import task, init
|
||||||
|
from ddadevops import *
|
||||||
|
|
||||||
|
name = 'moderator-election'
|
||||||
|
MODULE = ''
|
||||||
|
PROJECT_ROOT_PATH = '../..'
|
||||||
|
version = "1.0.0-dev"
|
||||||
|
|
||||||
|
@init
|
||||||
|
def initialize(project):
|
||||||
|
image_tag = version
|
||||||
|
if "dev" in image_tag:
|
||||||
|
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
||||||
|
|
||||||
|
input = {
|
||||||
|
"name": name,
|
||||||
|
"module": "notused",
|
||||||
|
"stage": "notused",
|
||||||
|
"project_root_path": PROJECT_ROOT_PATH,
|
||||||
|
"build_types": ["IMAGE"],
|
||||||
|
"mixin_types": [],
|
||||||
|
"image_naming": "NAME_AND_MODULE",
|
||||||
|
"image_tag": f"{image_tag}",
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build_depends_on("ddadevops>=4.7.0")
|
||||||
|
|
||||||
|
build = DevopsImageBuild(project, input)
|
||||||
|
build.initialize_build_dir()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def image(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.image()
|
||||||
|
|
||||||
|
@task
|
||||||
|
def drun(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.drun()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def test(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.test()
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def publish(project):
|
||||||
|
build = get_devops_build(project)
|
||||||
|
build.dockerhub_login()
|
||||||
|
build.dockerhub_publish()
|
36
doc/dev_notes.md
Normal file
36
doc/dev_notes.md
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
### ToDo
|
||||||
|
|
||||||
|
```
|
||||||
|
HowTo BUILD jar?
|
||||||
|
|
||||||
|
Failed within local: ./gradle build
|
||||||
|
java -jar build/libs/ModeratorElection.jar -> localhost:6333 "White Label..."-Error
|
||||||
|
|
||||||
|
=> ./gradlew clean build -Pvaadin.productionMode
|
||||||
|
..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!
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
after npm audit fix during image build
|
||||||
|
npm warn deprecated workbox-google-analytics@7.0.0: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
|
||||||
|
npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
|
||||||
|
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
|
||||||
|
npm warn deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
|
||||||
|
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
|
||||||
|
```
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
6
image/Dockerfile
Normal file
6
image/Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Build Stage
|
||||||
|
FROM node:22.3.0-bookworm-slim
|
||||||
|
|
||||||
|
ADD resources /tmp
|
||||||
|
RUN /tmp/install.sh
|
||||||
|
|
1
image/resources/MEMBERNAMES
Normal file
1
image/resources/MEMBERNAMES
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Silke,Hans,Dieter,Anne
|
76
image/resources/install.sh
Executable file
76
image/resources/install.sh
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -exo pipefail
|
||||||
|
|
||||||
|
function main()
|
||||||
|
{
|
||||||
|
upgradeSystem
|
||||||
|
#openjdk-17-jdk-headless, no need, we are installing graalvm
|
||||||
|
apt-get -qqy install git curl unzip
|
||||||
|
mkdir /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
|
||||||
|
#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
|
||||||
|
|
||||||
|
#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 by graalvm, put graalvm binary here
|
||||||
|
#install -m 0700 /tmp/entrypoint-start-and-wait.sh /
|
||||||
|
|
||||||
|
#install -m 0700 /tmp/init.sh /usr/local/bin/
|
||||||
|
#install -m 0700 /tmp/backup.sh /usr/local/bin/
|
||||||
|
#install -m 0700 /tmp/restore.sh /usr/local/bin/
|
||||||
|
#install -m 0700 /tmp/restic-snapshots.sh /usr/local/bin/
|
||||||
|
|
||||||
|
#cleanupDocker
|
||||||
|
} #> /dev/null
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#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
|
||||||
|
#npm install -g npm@latest
|
||||||
|
#npm audit fix
|
||||||
|
#npm ci --omit=dev
|
||||||
|
#./gradlew build
|
|
@ -38,8 +38,9 @@ public class MainView extends VerticalLayout {
|
||||||
|
|
||||||
Button electNow = new Button("Elect!", buttonClickEvent -> {
|
Button electNow = new Button("Elect!", buttonClickEvent -> {
|
||||||
try {
|
try {
|
||||||
|
ArrayList checkboxSelectedMembers = new ArrayList(checkboxGroup.getSelectedItems());
|
||||||
Notification moderatorNotification = new Notification()
|
Notification moderatorNotification = new Notification()
|
||||||
.show("Nächster Moderator: " + electMember(selectMemberItemsNameslist));
|
.show("Nächster Moderator: " + electMember(checkboxSelectedMembers));
|
||||||
moderatorNotification.setPosition(Notification.Position.BOTTOM_CENTER);
|
moderatorNotification.setPosition(Notification.Position.BOTTOM_CENTER);
|
||||||
} catch(Exception exceptionEvent) {
|
} catch(Exception exceptionEvent) {
|
||||||
Notification errorNotification = new Notification();
|
Notification errorNotification = new Notification();
|
||||||
|
@ -50,9 +51,7 @@ public class MainView extends VerticalLayout {
|
||||||
Button closeButton = new Button(new Icon("lumo", "cross"));
|
Button closeButton = new Button(new Icon("lumo", "cross"));
|
||||||
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
|
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
|
||||||
closeButton.setAriaLabel("Close");
|
closeButton.setAriaLabel("Close");
|
||||||
closeButton.addClickListener(closeButtonEvent -> {
|
closeButton.addClickListener(closeButtonEvent -> errorNotification.close());
|
||||||
errorNotification.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
HorizontalLayout layout = new HorizontalLayout(text, closeButton);
|
HorizontalLayout layout = new HorizontalLayout(text, closeButton);
|
||||||
layout.setAlignItems(Alignment.CENTER);
|
layout.setAlignItems(Alignment.CENTER);
|
||||||
|
|
Loading…
Reference in a new issue