Compare commits

...

70 commits
main ... main

Author SHA1 Message Date
41aa59d17d Fix exception "new request handling", tie beans to the lifecycle of Vaadin Flow routing components; PreserveOnRefresh is not necessaary 2024-09-05 15:33:47 +02:00
8ce25820e8 Fix entrypoint 2024-08-09 09:45:59 +02:00
b2841e2e24 Fix ci & push image to Docker 2024-07-26 10:40:40 +02:00
5b55a30d57 Fix ci & push image to Docker 2024-07-25 16:12:18 +02:00
033490a896 Fix ci & push image to Docker 2024-07-25 15:38:31 +02:00
b69a3f93e6 Fix ci & push image to Docker 2024-07-22 09:03:14 +02:00
0caa0aabca Fix ci & push image to Docker 2024-07-22 09:02:03 +02:00
c5d11bf760 Fix ci 2024-07-18 11:25:26 +02:00
0ecf5c2dd8 Fix ci 2024-07-18 11:15:59 +02:00
48f818bc57 [skip ci] correct path settings 2024-07-18 11:13:54 +02:00
9256ed0bc8 Try build image in ci 2024-07-12 13:32:25 +02:00
7be6db5469 Try build image in ci 2024-07-12 13:31:13 +02:00
69b9664c0f Try build image in ci 2024-07-12 13:29:29 +02:00
b7813a14e8 Try build image in ci 2024-07-12 13:28:46 +02:00
8d49e4d6cf Try build image in ci 2024-07-12 13:26:27 +02:00
4f67ba3c23 Try build image in ci 2024-07-12 13:22:55 +02:00
dceb69a44a [skip-ci] Moved .dockerignore 2024-07-12 13:18:43 +02:00
8eaaf91f92 Be compliant with deployment needs 2024-07-12 13:15:12 +02:00
2f59536c54 Take local files 2024-07-12 13:14:37 +02:00
06276fad8c Fix yml 2024-07-11 21:56:35 +02:00
d967c98440 Try to cache and build artifact 2024-07-11 21:54:15 +02:00
0c9cefc347 [skip ci] No snapshot version 2024-07-11 21:36:59 +02:00
e2d1a9144b [skip ci] Dockerize section, how to handle different Dockerfile stages 2024-07-11 21:36:24 +02:00
ae34bec4df [skip ci]Refactoring in Docker image building, see also section dockerizing in doc/dev_notes.md to handle one Dockerfile for different builds 2024-07-11 21:35:08 +02:00
38edbbfb94 Fix, try caching gradle 2024-07-09 14:43:53 +02:00
f1fcdba612 try caching gradle 2024-07-09 14:38:56 +02:00
8f2bc53a3e fix: work with img section in ci, test stage added 2024-07-09 13:57:21 +02:00
bdcbc3ebdc work with img section in ci, test stage added 2024-07-09 13:55:39 +02:00
6c0ef48a9d easy build in ci 2024-07-09 13:31:16 +02:00
0872a7fd3f build in ci 2024-07-09 10:40:04 +02:00
db6fc13092 [skip ci] new META-INF/native-image created with graalvm agent 22 2024-07-09 09:09:37 +02:00
c6f6ce8d32 [skip ci] further linting 2024-07-09 09:08:38 +02:00
a2793c19a4 [skip ci] some linting 2024-07-09 09:07:03 +02:00
76336077a2 [skip ci] Fix Test for usage with processTestAot & refactor/linting 2024-07-09 09:06:14 +02:00
fbf5ca1cac [skip ci] Bump to latest versions: springframework, spring.dependency-management, com.vaadin, java/graalvm 22 2024-07-09 09:02:32 +02:00
4b64fed80a [skip ci] Cleanup dev_notes 2024-07-09 08:58:05 +02:00
04a7b3c834 Further try to run Test only in CI 2024-07-08 12:29:32 +02:00
716d241689 Try to run Test only in CI 2024-07-08 12:17:24 +02:00
e1fa9d8c25 Run test as build just for testing gitlab-ci 2024-07-05 11:56:10 +02:00
b84faf0ae3 Further try to run gitlab-ci 2024-07-05 11:43:30 +02:00
407007bf11 Further try to run gitlab-ci 2024-07-05 11:41:02 +02:00
a36448fa4c Further try to run gitlab-ci 2024-07-05 10:56:45 +02:00
4df3ef23ba Further try to run gitlab-ci 2024-07-05 10:14:25 +02:00
162b44c01f Fix gitlab-ci 2024-07-05 08:40:50 +02:00
bf4e8eff74 Added gitlab-ci 2024-07-05 08:35:48 +02:00
68054fc75d Fix test 2024-07-05 08:17:29 +02:00
4725ce71d0 Added README.md 2024-07-04 11:18:21 +02:00
c1fd762241 No need for https Port number 2024-06-28 10:23:02 +02:00
326fac6207 Fix Port number 2024-06-27 21:11:41 +02:00
65651cad10 switch to https and no need for MEMBERNAMES env call 2024-06-27 21:02:57 +02:00
88b94b61f3 Main branch for production 2024-06-26 12:11:50 +02:00
b9850af239 add __pycache__/ to .gitignore 2024-06-26 12:03:58 +02:00
3e6a9109af Deliver env MEMBERNAMES from k8 deployment 2024-06-26 11:55:28 +02:00
5f5db8f49b Some cleanup 2024-06-25 15:34:59 +02:00
05dfa191b4 Deliver compiled libs with binary 2024-06-25 15:24:00 +02:00
4cd69350d1 Added new autogenerated reflect-config.json 2024-06-25 13:32:42 +02:00
d39b733d0d Some Docker improvemennts to build graalvm binary 2024-06-25 07:46:00 +02:00
40c45f1b17 Added Test functionality to build.py 2024-06-25 07:29:04 +02:00
15dc206830 Added @PreserveOnRefresh annotation to prevent Singleton exception 2024-06-25 07:21:27 +02:00
4d508660eb Added @PreserveOnRefresh annotation to prevent Singleton exception 2024-06-25 07:20:21 +02:00
9f8d433106 binary compilation in image successfully 2024-06-21 00:27:52 +02:00
1b598653d0 Prebuild commit - build graalvm bin in phase 1, use bin to stage app in phase 2 2024-06-20 22:05:15 +02:00
b2e3ef9ade Providing Docker image eclipse-temurin:17.0.11_9-jdk to run stage 2024-06-20 15:45:49 +02:00
25f7289346 Run Stage to docker image 2024-06-20 15:42:53 +02:00
a0691894ac Some further docker image steps 2024-06-20 15:09:08 +02:00
8ae0416f0c Some further improvements 2024-06-19 17:04:54 +02:00
aa0461e448 Some cleanup, research results in dev_notes :: "refresh/singleton" exception 2024-06-19 15:14:39 +02:00
623e8a9d72 Installing graalvm and usage to build binary for deploying, need some improvements 2024-06-14 17:41:12 +02:00
afb0f46545 Fix in logic, further documentation in dev_notes 2024-06-14 12:11:10 +02:00
6900a54157 Build Docker image with pyb, dev_notes with ToDo 2024-06-13 22:20:25 +02:00
24 changed files with 8166 additions and 2222 deletions

8
.dockerignore Normal file
View file

@ -0,0 +1,8 @@
/.gradle/
/.idea/
/.pybuilder/
/build/
/doc/
.gitignore
gradlew.bat

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ build/
.gradle/
.idea/
frontend/generated/
__pycache__/

70
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,70 @@
stages:
# - test
# - buildjar
- buildimage
# - publish
variables:
CACHE_FALLBACK_KEY: fallback-key
.img: &img
image: openjdk:22-jdk-slim
cache:
- key: ${CI_COMMIT_REF_SLUG}
fallback_keys:
- cache-$CI_DEFAULT_BRANCH
- cache-default
- paths:
- /var/cache/apt
- .gradle/wrapper
- .gradle/caches
before_script:
- echo "___________________START_before_script________________________"
- echo ${CI_COMMIT_REF_SLUG}
- apt-get update && apt-get -qqy upgrade
#test:
# <<: *img
# stage: test
# script:
# - ./gradlew test
#buildjar:
# <<: *img
# stage: buildjar
# cache:
# - key: ${CI_COMMIT_REF_SLUG}
# script:
# - ./gradlew clean build -Pvaadin.productionMode
# artifacts:
# name: "ModeratorElection"
# paths:
# - build/libs/
# expire_in: 1 week
buildimage:
stage: buildimage
image: docker:latest
services:
- docker:dind
cache:
- key: ${CI_COMMIT_REF_SLUG}
# dependencies:
# - buildjar
before_script:
- echo "---------- BEFORE -------------"
# - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
script:
- export DOCKER_BUILDKIT=1
- docker build --tag=$DOCKERHUB_USER/moderator-election-vaadin_fullstack:latest --target=ci-image-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
- docker push $DOCKERHUB_USER/moderator-election-vaadin_fullstack
# stage: image
# script:
#publish:
# stage: publish
#- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
#- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD

41
Dockerfile Normal file
View file

@ -0,0 +1,41 @@
#buildJar-stage
FROM openjdk:22-jdk-slim as build-jar-stage
RUN \
--mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get -qqy upgrade
ADD ./ /usr/local/src/ModeratorElection
WORKDIR /usr/local/src/ModeratorElection/
RUN ./gradlew build -Pvaadin.productionMode
# Run jar stage
FROM build-jar-stage AS run-jar-stage
EXPOSE 8080
WORKDIR /usr/local/src/ModeratorElection/build/libs/
RUN chmod 0740 ./ModeratorElection.jar
ENTRYPOINT ["java", "-jar", "./ModeratorElection.jar"]
FROM build-jar-stage AS ci-image-stage
RUN chmod 0740 ./build/libs/ModeratorElection.jar
ENTRYPOINT ["java", "-jar", "./build/libs/ModeratorElection.jar"]
#build-native-stage
FROM ubuntu:latest as build-native-stage
ADD image/resources /tmp
RUN \
--mount=type=cache,target=/var/cache/apt \
/tmp/install.sh
ENV LANG=en_US.UTF-8 \
JAVA_HOME=/usr/lib/jvm/graalvm/bin
# Run native binary stage
FROM build-native-stage AS run-native-stage
EXPOSE 8080
#CMD ["mkdir /usr/local/src/ModeratorElection"]
WORKDIR /usr/local/src/ModeratorElection/build/native/nativeCompile/
##copy native binary
#COPY --from=buildNative-stage /usr/local/src/ModeratorElection/build/native/nativeCompile/ .
RUN chmod 0740 ./ModeratorElection
ENTRYPOINT ["./ModeratorElection"]

48
README.md Normal file
View file

@ -0,0 +1,48 @@
# meapp-fullstack: ModeratorElection
## Purpose
**ModeratorElection** provides a fullstack java app development as **graalvm binary** containing:
* Java app to elect a team member from a comma separated list delivered by environment variable
* Backend Spring Boot embeded Tomcat<sup>®</sup> Server
* Frontend Vaadin Framework
* Dockerfile to generate multi stage image,
first stage compilation to graalvm binary, second stage as run stage - graalvm binary execution
## Try out
Development phase is completed, we will deploy production soon - reachable at
https://meapp-fullstack.jitsi.prod.meissa.de
## Setup
* in **IDE development**, run
`./gradlew clean vaadinPrepareFrontend`
* build **jar file**
`./gradlew clean build -Pvaadin.productionMode`
-> output jar to build/libs/
* compile **native-image graalvm binary**
(1) use graalvm agent to announce project dependencies
```shell
MEMBERNAMES=er,sie,es java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar build/libs/ModeratorElection-0.0.1-SNAPSHOT.jar
```
(2)
`./gradlew nativeCompile -Dvaadin.productionMode=true`
-> output binary and necessary libs to build/native/nativeCompile/
* **py builder/build.py** usage recommendation:
`pyb <task>` to either create docker image, publish docker image, run test or dry run.
py builder is using **meissa PyPi package ddadevops** for smart deployment.
## Get help
`./gradlew tasks`
## Development & mirrors
Development completed at:
https://repo.prod.meissa.de/meissa/ModeratorElection
Mirror:
https://gitlab.com/domaindrivenarchitecture/ModeratorElection (CI)
## License
Copyright © 2024 meissa GmbH
Licensed under the [Apache License, Version 2.0](LICENSE)

View file

@ -6,11 +6,14 @@ buildscript {
}
}
plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'org.springframework.boot' version '3.3.1'
id 'io.spring.dependency-management' version '1.1.6'
id 'java'
id 'com.vaadin'
id 'com.vaadin' version '24.4.4'
id 'org.graalvm.buildtools.native' version '0.10.2'
}
group = 'com.ModeratorElection'
//version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
@ -19,6 +22,10 @@ repositories {
maven { setUrl("https://maven.vaadin.com/vaadin-addons") }
}
ext {
set('vaadinVersion', '24.4.4')
}
configurations {
developmentOnly
runtimeClasspath {
@ -27,11 +34,13 @@ configurations {
}
dependencies {
implementation('com.vaadin:vaadin-spring-boot-starter')
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.vaadin:vaadin-spring-boot-starter'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
dependencyManagement {
@ -40,6 +49,47 @@ dependencyManagement {
}
}
test{
tasks.named('test') {
useJUnitPlatform()
jvmArgs "-Xshare:off"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(22)
}
}
graalvmNative {
binaries {
main {
mainClass = 'com.ModeratorElection.MEApplication'
buildArgs.add("-march=native")
buildArgs.add("-R:MaxHeapSize=6442450944")
fallback = false
imageName.set('ModeratorElection')
//javaLauncher @JavaExec :: Configures the java executable to be used to run the tests.
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(22))
//vendor.set(JvmVendorSpec.GRAAL_VM)
})
}
}
testSupport = false
toolchainDetection = false
}
/*tasks.withType(JavaCompile) {
options.compilerArgs += ['-Xlint:deprecation']
//,'-Xlint:unchecked'
}*/
/*
task runApp(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'package.Main'
// arguments to pass to the application
args 'membernames'
}*/

56
build.py Normal file
View file

@ -0,0 +1,56 @@
from os import environ
from subprocess import run
from datetime import datetime
from pybuilder.core import task, init
from ddadevops import *
name = 'moderator-election'
MODULE = ''
PROJECT_ROOT_PATH = '../..'
version = "0.0.1-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": "vaadin_fullstack",
"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)
run("./gradlew test", shell=True, check=True)
@task
def publish(project):
build = get_devops_build(project)
build.dockerhub_login()
build.dockerhub_publish()

106
doc/dev_notes.md Normal file
View file

@ -0,0 +1,106 @@
### 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
```
```
-x processTestAot - exclude, skip tests
https://docs.spring.io/spring-boot/gradle-plugin/aot.html
Processing Tests
The AOT engine can be applied to JUnit 5 tests that use Springs Test Context Framework.
Suitable tests are processed by the 'processTestAot' task to generate
'ApplicationContextInitializer' code. As with application AOT processing, the 'BeanFactory'
is fully prepared at build-time. As with 'processAot', the 'processTestAot' task is 'JavaExec'
subclass and can be configured as needed to influence this processing.
The 'nativeTest' task of the GraalVM Native Image plugin is automatically configured to
use the output of the 'processAot' and 'processTestAot' tasks.
```
```
For production:
* install.sh
git clone --single-branch --branch main https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
```
```
build graalvm binary
1. First build jar locally, and get META-INF with
./gradlew clean build -Pvaadin.productionMode -x processTestAot
MEMBERNAMES=er,sie,es java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar build/libs/ModeratorElection-0.0.1-SNAPSHOT.jar
curl -X GET localhost:8080
2. graalvm native-image compilation
./gradlew nativeCompile -Dvaadin.productionMode=true //-H:ConfigurationFileDirectories=/path/to/config-dir/ notwendig falls nicht in src/main/resources/META-INF/native-image/
```
```
Dockerizing -> image/Dockerfile
install buildx-plugin by binary to use build-native-stage only with DOCKER_BUILDKIT:
- https://github.com/docker/buildx/releases/download/v0.15.1/buildx-v0.15.1.linux-amd64
- sha256sum buildx-v0.15.1.linux-amd64
- move to file: mv buildx-v0.15.1.linux-amd64 $HOME/.docker/cli-plugins/docker-buildx
- chmod x $HOME/.docker/cli-plugins/docker-buildx
further:
It could be either build jar file or graalvm binary
(1)build-jar-stage
docker build --tag=meapp-jar --target=build-jar-stage .
(2)ENTRYPOINT as run-jar-stage
docker build --tag=run-meapp-jar --target=run-jar-stage
(3)build-native-stage
DOCKER_BUILDKIT=1 docker build --tag=meapp-native --target= build-native-stage .
(4)ENTRYPOINT as run-native-stage
DOCKER_BUILDKIT=1 docker build --tag=meapp-run-native --target=run-native-stage .
Test images:
docker run -e MEMBERNAMES=er,sie,es -p 8080:8080 run-jar-stage:latest
docker run -e MEMBERNAMES=er,sie,es -p 8080:8080 run-native-stage:latest
Buildkit caching:
export DOCKER_BUILDKIT=1
--build-arg BUILDKIT_INLINE_CACHE=1
(1)docker build --tag=meapp-jar --target=build-jar-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
(2)docker build --tag=moderator-election-vaadin_fullstack --target=run-jar-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
(3)docker build --tag=meapp-native --target=build-native-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
(4)docker build --tag=meapp-run-native --target=run-native-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
```
```
gu available
https://docs.oracle.com/en/graalvm/enterprise/21/docs/reference-manual/graalvm-updater/#component-installation
```
```
vaadin 24.3.3, 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
```
```
Refresh, Singleton Issue
https://github.com/vaadin/flow/issues/9376
https://mvysny.github.io/cant-move-node/
https://vaadin.com/forum/t/unregistered-node-was-not-found-based-on-its-id-the-tree-is-most-likely-co/161068
https://vaadin.com/docs/v14/flow/integrations/spring/tutorial-spring-scopes
=> @PreserveOnRefresh annotation in MainView.java does the trick
```
```
ddadevops anpassung, dass src code ins docker image übergeben werden kann - ohne git clone
```

View file

@ -3,7 +3,7 @@
This file is auto-generated by Vaadin.
-->
<html lang="en">
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1 +1 @@
vaadinVersion=24.3.13
vaadinVersion=24.4.4

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

77
image/resources/install.sh Executable file
View file

@ -0,0 +1,77 @@
#!/bin/bash
set -exo pipefail
function main()
{
#upgradeSystem
apt-get update && apt-get -qqy upgrade
apt-get -qqy install curl git build-essential libz-dev zlib1g-dev
#change to main branch for production
#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
#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
#graalvm-community-jdk, v22.0.1 2024-04-16
graalvm_jdk_version="22.0.1"
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
#checksum graalvm
checksum
#install graalvm
graalvm_inst
#nativeCompile
buildproc
#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 {} \;
} > /dev/null
function checksum() {
#graalvm
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
}
function graalvm_inst(){
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
}
function buildproc() {
cd /usr/local/src/ModeratorElection/
#build graalvm binary
./gradlew nativeCompile -Dvaadin.productionMode=true -x processTestAot
}
#source /tmp/install_functions_debian.sh
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main

3728
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,248 +4,102 @@
"type": "module",
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/a11y-base": "24.3.13",
"@vaadin/accordion": "24.3.13",
"@vaadin/app-layout": "24.3.13",
"@vaadin/avatar": "24.3.13",
"@vaadin/avatar-group": "24.3.13",
"@vaadin/bundles": "24.3.13",
"@vaadin/button": "24.3.13",
"@vaadin/checkbox": "24.3.13",
"@vaadin/checkbox-group": "24.3.13",
"@vaadin/combo-box": "24.3.13",
"@vaadin/bundles": "24.4.0",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/component-base": "24.3.13",
"@vaadin/confirm-dialog": "24.3.13",
"@vaadin/context-menu": "24.3.13",
"@vaadin/custom-field": "24.3.13",
"@vaadin/date-picker": "24.3.13",
"@vaadin/date-time-picker": "24.3.13",
"@vaadin/details": "24.3.13",
"@vaadin/dialog": "24.3.13",
"@vaadin/email-field": "24.3.13",
"@vaadin/field-base": "24.3.13",
"@vaadin/field-highlighter": "24.3.13",
"@vaadin/form-layout": "24.3.13",
"@vaadin/grid": "24.3.13",
"@vaadin/horizontal-layout": "24.3.13",
"@vaadin/icon": "24.3.13",
"@vaadin/icons": "24.3.13",
"@vaadin/input-container": "24.3.13",
"@vaadin/integer-field": "24.3.13",
"@vaadin/item": "24.3.13",
"@vaadin/list-box": "24.3.13",
"@vaadin/lit-renderer": "24.3.13",
"@vaadin/login": "24.3.13",
"@vaadin/menu-bar": "24.3.13",
"@vaadin/message-input": "24.3.13",
"@vaadin/message-list": "24.3.13",
"@vaadin/multi-select-combo-box": "24.3.13",
"@vaadin/notification": "24.3.13",
"@vaadin/number-field": "24.3.13",
"@vaadin/overlay": "24.3.13",
"@vaadin/password-field": "24.3.13",
"@vaadin/polymer-legacy-adapter": "24.3.13",
"@vaadin/progress-bar": "24.3.13",
"@vaadin/radio-group": "24.3.13",
"@vaadin/polymer-legacy-adapter": "24.4.0",
"@vaadin/react-components": "24.4.0",
"@vaadin/router": "1.7.5",
"@vaadin/scroller": "24.3.13",
"@vaadin/select": "24.3.13",
"@vaadin/side-nav": "24.3.13",
"@vaadin/split-layout": "24.3.13",
"@vaadin/tabs": "24.3.13",
"@vaadin/tabsheet": "24.3.13",
"@vaadin/text-area": "24.3.13",
"@vaadin/text-field": "24.3.13",
"@vaadin/time-picker": "24.3.13",
"@vaadin/tooltip": "24.3.13",
"@vaadin/upload": "24.3.13",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.3.13",
"@vaadin/vaadin-material-styles": "24.3.13",
"@vaadin/vaadin-themable-mixin": "24.3.13",
"@vaadin/vaadin-lumo-styles": "24.4.0",
"@vaadin/vaadin-material-styles": "24.4.0",
"@vaadin/vaadin-themable-mixin": "24.4.0",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"@vaadin/vertical-layout": "24.3.13",
"@vaadin/virtual-list": "24.3.13",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.2"
"lit": "3.1.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
},
"devDependencies": {
"@rollup/plugin-replace": "5.0.5",
"@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@vitejs/plugin-react": "4.2.1",
"@vitejs/plugin-react-swc": "3.5.0",
"async": "3.2.4",
"glob": "10.3.3",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0",
"transform-ast": "2.4.4",
"typescript": "5.3.3",
"vite": "5.1.7",
"typescript": "5.4.5",
"vite": "5.3.1",
"vite-plugin-checker": "0.6.4",
"workbox-build": "7.0.0",
"workbox-core": "7.0.0",
"workbox-precaching": "7.0.0"
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"vaadin": {
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/a11y-base": "24.3.13",
"@vaadin/accordion": "24.3.13",
"@vaadin/app-layout": "24.3.13",
"@vaadin/avatar": "24.3.13",
"@vaadin/avatar-group": "24.3.13",
"@vaadin/bundles": "24.3.13",
"@vaadin/button": "24.3.13",
"@vaadin/checkbox": "24.3.13",
"@vaadin/checkbox-group": "24.3.13",
"@vaadin/combo-box": "24.3.13",
"@vaadin/bundles": "24.4.0",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/component-base": "24.3.13",
"@vaadin/confirm-dialog": "24.3.13",
"@vaadin/context-menu": "24.3.13",
"@vaadin/custom-field": "24.3.13",
"@vaadin/date-picker": "24.3.13",
"@vaadin/date-time-picker": "24.3.13",
"@vaadin/details": "24.3.13",
"@vaadin/dialog": "24.3.13",
"@vaadin/email-field": "24.3.13",
"@vaadin/field-base": "24.3.13",
"@vaadin/field-highlighter": "24.3.13",
"@vaadin/form-layout": "24.3.13",
"@vaadin/grid": "24.3.13",
"@vaadin/horizontal-layout": "24.3.13",
"@vaadin/icon": "24.3.13",
"@vaadin/icons": "24.3.13",
"@vaadin/input-container": "24.3.13",
"@vaadin/integer-field": "24.3.13",
"@vaadin/item": "24.3.13",
"@vaadin/list-box": "24.3.13",
"@vaadin/lit-renderer": "24.3.13",
"@vaadin/login": "24.3.13",
"@vaadin/menu-bar": "24.3.13",
"@vaadin/message-input": "24.3.13",
"@vaadin/message-list": "24.3.13",
"@vaadin/multi-select-combo-box": "24.3.13",
"@vaadin/notification": "24.3.13",
"@vaadin/number-field": "24.3.13",
"@vaadin/overlay": "24.3.13",
"@vaadin/password-field": "24.3.13",
"@vaadin/polymer-legacy-adapter": "24.3.13",
"@vaadin/progress-bar": "24.3.13",
"@vaadin/radio-group": "24.3.13",
"@vaadin/polymer-legacy-adapter": "24.4.0",
"@vaadin/react-components": "24.4.0",
"@vaadin/router": "1.7.5",
"@vaadin/scroller": "24.3.13",
"@vaadin/select": "24.3.13",
"@vaadin/side-nav": "24.3.13",
"@vaadin/split-layout": "24.3.13",
"@vaadin/tabs": "24.3.13",
"@vaadin/tabsheet": "24.3.13",
"@vaadin/text-area": "24.3.13",
"@vaadin/text-field": "24.3.13",
"@vaadin/time-picker": "24.3.13",
"@vaadin/tooltip": "24.3.13",
"@vaadin/upload": "24.3.13",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.3.13",
"@vaadin/vaadin-material-styles": "24.3.13",
"@vaadin/vaadin-themable-mixin": "24.3.13",
"@vaadin/vaadin-lumo-styles": "24.4.0",
"@vaadin/vaadin-material-styles": "24.4.0",
"@vaadin/vaadin-themable-mixin": "24.4.0",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"@vaadin/vertical-layout": "24.3.13",
"@vaadin/virtual-list": "24.3.13",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.2"
"lit": "3.1.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
},
"devDependencies": {
"@rollup/plugin-replace": "5.0.5",
"@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@vitejs/plugin-react": "4.2.1",
"@vitejs/plugin-react-swc": "3.5.0",
"async": "3.2.4",
"glob": "10.3.3",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0",
"transform-ast": "2.4.4",
"typescript": "5.3.3",
"vite": "5.1.7",
"typescript": "5.4.5",
"vite": "5.3.1",
"vite-plugin-checker": "0.6.4",
"workbox-build": "7.0.0",
"workbox-core": "7.0.0",
"workbox-precaching": "7.0.0"
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "1b578191af08a883e68dfca9e08ad525b69d9824e0ec3e82a2689cdcf77b5ffe"
"hash": "a138b9347a25dacd61eb23a186fb55a3bff3993609bd58738beb6651e7993e01"
},
"overrides": {
"@vaadin/bundles": "$@vaadin/bundles",
"@vaadin/a11y-base": "$@vaadin/a11y-base",
"@vaadin/accordion": "$@vaadin/accordion",
"@vaadin/app-layout": "$@vaadin/app-layout",
"@vaadin/avatar": "$@vaadin/avatar",
"@vaadin/avatar-group": "$@vaadin/avatar-group",
"@vaadin/button": "$@vaadin/button",
"@vaadin/checkbox": "$@vaadin/checkbox",
"@vaadin/checkbox-group": "$@vaadin/checkbox-group",
"@vaadin/combo-box": "$@vaadin/combo-box",
"@vaadin/component-base": "$@vaadin/component-base",
"@vaadin/confirm-dialog": "$@vaadin/confirm-dialog",
"@vaadin/context-menu": "$@vaadin/context-menu",
"@vaadin/custom-field": "$@vaadin/custom-field",
"@vaadin/date-picker": "$@vaadin/date-picker",
"@vaadin/date-time-picker": "$@vaadin/date-time-picker",
"@vaadin/details": "$@vaadin/details",
"@vaadin/dialog": "$@vaadin/dialog",
"@vaadin/email-field": "$@vaadin/email-field",
"@vaadin/field-base": "$@vaadin/field-base",
"@vaadin/field-highlighter": "$@vaadin/field-highlighter",
"@vaadin/form-layout": "$@vaadin/form-layout",
"@vaadin/grid": "$@vaadin/grid",
"@vaadin/horizontal-layout": "$@vaadin/horizontal-layout",
"@vaadin/icon": "$@vaadin/icon",
"@vaadin/icons": "$@vaadin/icons",
"@vaadin/input-container": "$@vaadin/input-container",
"@vaadin/integer-field": "$@vaadin/integer-field",
"@vaadin/item": "$@vaadin/item",
"@vaadin/list-box": "$@vaadin/list-box",
"@vaadin/lit-renderer": "$@vaadin/lit-renderer",
"@vaadin/login": "$@vaadin/login",
"@vaadin/menu-bar": "$@vaadin/menu-bar",
"@vaadin/message-input": "$@vaadin/message-input",
"@vaadin/message-list": "$@vaadin/message-list",
"@vaadin/multi-select-combo-box": "$@vaadin/multi-select-combo-box",
"@vaadin/notification": "$@vaadin/notification",
"@vaadin/number-field": "$@vaadin/number-field",
"@vaadin/overlay": "$@vaadin/overlay",
"@vaadin/password-field": "$@vaadin/password-field",
"@vaadin/polymer-legacy-adapter": "$@vaadin/polymer-legacy-adapter",
"@vaadin/progress-bar": "$@vaadin/progress-bar",
"@vaadin/radio-group": "$@vaadin/radio-group",
"@vaadin/scroller": "$@vaadin/scroller",
"@vaadin/select": "$@vaadin/select",
"@vaadin/side-nav": "$@vaadin/side-nav",
"@vaadin/split-layout": "$@vaadin/split-layout",
"@vaadin/tabs": "$@vaadin/tabs",
"@vaadin/tabsheet": "$@vaadin/tabsheet",
"@vaadin/text-area": "$@vaadin/text-area",
"@vaadin/text-field": "$@vaadin/text-field",
"@vaadin/time-picker": "$@vaadin/time-picker",
"@vaadin/tooltip": "$@vaadin/tooltip",
"@vaadin/upload": "$@vaadin/upload",
"@vaadin/vaadin-development-mode-detector": "$@vaadin/vaadin-development-mode-detector",
"@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles",
"@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles",
"@vaadin/router": "$@vaadin/router",
"@vaadin/vaadin-usage-statistics": "$@vaadin/vaadin-usage-statistics",
"@vaadin/vertical-layout": "$@vaadin/vertical-layout",
"@vaadin/virtual-list": "$@vaadin/virtual-list",
"@vaadin/common-frontend": "$@vaadin/common-frontend",
"construct-style-sheets-polyfill": "$construct-style-sheets-polyfill",
"lit": "$lit",
"@polymer/polymer": "$@polymer/polymer",
"@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin",
"date-fns": "$date-fns"
"date-fns": "$date-fns",
"@vaadin/react-components": "$@vaadin/react-components",
"react-dom": "$react-dom",
"react-router-dom": "$react-router-dom",
"react": "$react"
}
}

View file

@ -14,6 +14,7 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.spring.annotation.RouteScope;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@ -23,6 +24,7 @@ import java.util.List;
@Route("")
@PageTitle("Moderatorenwahl")
@RouteScope
@Configuration
public class MainView extends VerticalLayout {
@ -38,8 +40,10 @@ public class MainView extends VerticalLayout {
Button electNow = new Button("Elect!", buttonClickEvent -> {
try {
Notification moderatorNotification = new Notification()
.show("Nächster Moderator: " + electMember(selectMemberItemsNameslist));
ArrayList<String> checkboxSelectedMembers = new ArrayList<>(checkboxGroup.getSelectedItems());
new Notification();
Notification moderatorNotification = Notification
.show("Nächster Moderator: " + electMember(checkboxSelectedMembers));
moderatorNotification.setPosition(Notification.Position.BOTTOM_CENTER);
} catch(Exception exceptionEvent) {
Notification errorNotification = new Notification();
@ -50,9 +54,7 @@ public class MainView extends VerticalLayout {
Button closeButton = new Button(new Icon("lumo", "cross"));
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
closeButton.setAriaLabel("Close");
closeButton.addClickListener(closeButtonEvent -> {
errorNotification.close();
});
closeButton.addClickListener(closeButtonEvent -> errorNotification.close());
HorizontalLayout layout = new HorizontalLayout(text, closeButton);
layout.setAlignItems(Alignment.CENTER);

View file

@ -0,0 +1,49 @@
[
{
"name":"java.awt.GraphicsEnvironment",
"methods":[{"name":"isHeadless","parameterTypes":[] }]
},
{
"name":"java.awt.image.BufferedImage",
"fields":[{"name":"colorModel"}, {"name":"imageType"}, {"name":"raster"}],
"methods":[{"name":"getRGB","parameterTypes":["int","int","int","int","int[]","int","int"] }, {"name":"setRGB","parameterTypes":["int","int","int","int","int[]","int","int"] }]
},
{
"name":"java.awt.image.ColorModel",
"fields":[{"name":"colorSpace"}, {"name":"colorSpaceType"}, {"name":"isAlphaPremultiplied"}, {"name":"is_sRGB"}, {"name":"nBits"}, {"name":"numComponents"}, {"name":"supportsAlpha"}, {"name":"transparency"}],
"methods":[{"name":"getRGBdefault","parameterTypes":[] }]
},
{
"name":"java.awt.image.Raster",
"fields":[{"name":"dataBuffer"}, {"name":"height"}, {"name":"minX"}, {"name":"minY"}, {"name":"numBands"}, {"name":"numDataElements"}, {"name":"sampleModel"}, {"name":"sampleModelTranslateX"}, {"name":"sampleModelTranslateY"}, {"name":"width"}]
},
{
"name":"java.awt.image.SampleModel",
"fields":[{"name":"height"}, {"name":"width"}],
"methods":[{"name":"getPixels","parameterTypes":["int","int","int","int","int[]","java.awt.image.DataBuffer"] }, {"name":"setPixels","parameterTypes":["int","int","int","int","int[]","java.awt.image.DataBuffer"] }]
},
{
"name":"java.awt.image.SinglePixelPackedSampleModel",
"fields":[{"name":"bitMasks"}, {"name":"bitOffsets"}, {"name":"bitSizes"}, {"name":"maxBitSize"}]
},
{
"name":"java.lang.Boolean",
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
},
{
"name":"java.lang.System",
"methods":[{"name":"load","parameterTypes":["java.lang.String"] }]
},
{
"name":"sun.awt.image.ByteComponentRaster",
"fields":[{"name":"data"}, {"name":"dataOffsets"}, {"name":"pixelStride"}, {"name":"scanlineStride"}, {"name":"type"}]
},
{
"name":"sun.java2d.Disposer",
"methods":[{"name":"addRecord","parameterTypes":["java.lang.Object","long","long"] }]
},
{
"name":"sun.management.VMManagementImpl",
"fields":[{"name":"compTimeMonitoringSupport"}, {"name":"currentThreadCpuTimeSupport"}, {"name":"objectMonitorUsageSupport"}, {"name":"otherThreadCpuTimeSupport"}, {"name":"remoteDiagnosticCommandsSupport"}, {"name":"synchronizerUsageSupport"}, {"name":"threadAllocatedMemorySupport"}, {"name":"threadContentionMonitoringSupport"}]
}
]

View file

@ -0,0 +1,8 @@
[
{
"type":"agent-extracted",
"classes":[
]
}
]

View file

@ -0,0 +1,26 @@
[
{
"interfaces":["java.lang.reflect.ParameterizedType","org.springframework.core.SerializableTypeWrapper$SerializableTypeProxy","java.io.Serializable"]
},
{
"interfaces":["java.lang.reflect.TypeVariable","org.springframework.core.SerializableTypeWrapper$SerializableTypeProxy","java.io.Serializable"]
},
{
"interfaces":["java.lang.reflect.WildcardType","org.springframework.core.SerializableTypeWrapper$SerializableTypeProxy","java.io.Serializable"]
},
{
"interfaces":["org.atmosphere.cpr.AtmosphereHandler"]
},
{
"interfaces":["org.atmosphere.cpr.Broadcaster"]
},
{
"interfaces":["org.springframework.boot.context.properties.ConfigurationProperties"]
},
{
"interfaces":["org.springframework.web.bind.annotation.PathVariable"]
},
{
"interfaces":["org.springframework.web.bind.annotation.RequestMapping"]
}
]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
{
"types":[
],
"lambdaCapturingTypes":[
],
"proxies":[
]
}

View file

@ -1,4 +1,8 @@
server.port=${PORT:6333}
spring.application.name=ModeratorElection
spring.main.banner-mode=off
server.port=${PORT:8080}
logging.level.org.atmosphere = warn
spring.mustache.check-template-location = false
@ -6,6 +10,6 @@ spring.mustache.check-template-location = false
vaadin.launch-browser=true
# To improve the performance during development.
# For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.ModeratorElection.MEApplication
spring.jpa.defer-datasource-initialization = true
membernames=${MEMBERNAMES:Micha,Ansgar,Clemens,Mattis,Erik,Mirco}
membernames=${MEMBERNAMES}

View file

@ -1,13 +0,0 @@
package com.ModeratorElection;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}

View file

@ -5,12 +5,13 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
//@SpringBootTest
@SpringBootTest(classes = MainView.class)
public class MainViewTest {
@Test
void mainViewConstructor() {
MainView sut = new MainView("Harry,Sven,Ida");
CheckboxGroup cgroupTest = (CheckboxGroup) sut.getChildren().filter(child -> child instanceof CheckboxGroup).findAny().orElse(null);
assert cgroupTest != null;
int cgroupTestSelectedItemsSize = cgroupTest.getSelectedItems().size();
Assertions.assertEquals(3,cgroupTestSelectedItemsSize);
}