A nano project to start a Vaadin project. Perfect for Micro-UIs packed as fat jar in a docker image. This demo is bundled together with the Open Source APM tool called stagemonitor.
If you want to run this demo on your local machine, you can try out the docker image that is provided. To run this type:
docker pull nanovaadin/jetty-kotlin
docker run -p8899:8899 --name nano-jetty-kotlin nanovaadin/jetty-kotlin
After the images/container started you can try this demo with your local browser by calling the following URL http://localhost:8899
After you used this docker image you can clean up your system with the following commands.
docker rm nano-jetty-kotlin
docker image rm nanovaadin/jetty-kotlin
If you want to build this docker image on your machine you can use the provided Dockerfile
docker build -t nanovaadin/jetty .
On Heroku you find a deployed version.
The branch develop will be deployed on heroku and you can have a sneak preview on what is coming: https://nano-vaadin-jetty-develop.herokuapp.com/
The Branch master is deployed on heroku as well and you can access it under https://nano-vaadin-jetty.herokuapp.com/
If you want to build this demo check out the repository and invoke the command: mvn clean package -Dmaven.test.skip=true -Dvaadin-install-nodejs
Together with this demo, you will find some jUnit5 Selenium UI Tests based on Testbench To get this running you need a license, or you can request a trial from https://vaadin.com/trial
To support the Heroku pipeline we need a few preparations.
- the app must be able to get a configured port for the http port during the start up
- add the shade plugin to create a fat jar
- create the file Procfile and add the line
``web: java -jar target/vaadin-app.jar -port $PORT```
- web - to activate the web profile
- -jar - define what fat jar must be started
- -port make the dynamic associated port available for the app
- add a file settings.xml to configure the maven build process
This example is running from JDK8 up to JDK13
The target of this project is a minimal rampup time for a first hello world. Why we need one more HelloWorld? Well, the answer is quite easy. If you have to try something out, or you want to make a small POC to present something, there is no time and budget to create a demo project. You don´t want to copy paste all small things together. Here you will get a Nano-Project that will give you all in a second.
Clone the repo and start editing the file NanoVaadinOnKotlin.kt
.
Nothing more.
Internally it will ramp up a Jetty. If you want to see how this is done, have a look inside
the class CoreUIService
.
You as a developer can use it like it is shown in the demo folder inside the src path.
fun main() {
CoreUIService().startup()
}
@Route("")
class VaadinApp : Composite<Div>(), HasLogger {
private val btnClickMe = Button("click me")
private val lbClickCount = Span("0")
private val layout = VerticalLayout(btnClickMe, lbClickCount)
private var clickcount = 0
init {
btnClickMe.setId(BTN_CLICK_ME)
btnClickMe.addClickListener { event -> lbClickCount.text = (++clickcount).toString() }
lbClickCount.setId(LB_CLICK_COUNT)
logger().info("and now.. setting the main content.. ")
content.add(layout)
}
companion object {
val BTN_CLICK_ME = "btn-click-me"
val LB_CLICK_COUNT = "lb-click-count"
}
}
Happy Coding.
if you have any questions: ping me on Twitter https://twitter.com/SvenRuppert or via mail.