Giter VIP home page Giter VIP logo

nano-vaadin-jetty's Introduction

Image

Nano Vaadin - Ramp up in a second.

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.

Demo running on a local Docker

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

cleaning up after trying

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

building this Docker-image by yourself

If you want to build this docker image on your machine you can use the provided Dockerfile

docker build -t nanovaadin/jetty .

Demo running on Heroku

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/

How to build this locally?

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

How to prepare a vaadin app for Heroku

To support the Heroku pipeline we need a few preparations.

  1. the app must be able to get a configured port for the http port during the start up
  2. add the shade plugin to create a fat jar
  3. 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
  4. add a file settings.xml to configure the maven build process

Supported JDK

This example is running from JDK8 up to JDK13

target of this project

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.

How does it work?

Internally it will ramp up a Jetty. If you want to see how this is done, have a look inside the class CoreUIService.

How a developer can use this

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.

nano-vaadin-jetty's People

Contributors

dependabot[bot] avatar svenruppert avatar svenruppert-jfrog avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

blackbluegl

nano-vaadin-jetty's Issues

split into modules

split into modules like

01_impl - so that this is used as a dependency
02_test - JUnit5 tests
03_demo - a Vaadin Demo app, deployed on Heroku

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.