Code Monkey home page Code Monkey logo

vaadin-demo-bakery-app's Introduction

This project is no longer maintained!

Vaadin Demo Bakery App

Master Branch

This project contains the source code generated by Vaadin's Starter Pack (Vaadin Bakery App Starter for Flow and Spring)

Branches

  • master - Vaadin 14 (updated on February 2nd, 2022)
  • V13 - Vaadin 13
  • V10 - Vaadin 10
  • V8 - Vaadin 8

Other Example Apps

Running the Project in Production Mode with Docker

$ docker build --rm -t bakery-app .
$ docker run --name bakery-app -d bakery-app
$ docker logs -f bakery-app 

The application is available at http://container-ip:8080/. To get the container IP address, execute the following command:

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bakery-app

Via the host machine on port 80:

$ docker run --name bakery-app -p 80:8080 -d bakery-app

The application is available at http://localhost:80/ or http://host-ip:80/.

... or with an image from Docker Hub:

$ docker run --name bakery-app -p 80:8080 -d ibaiborodine/vaadin-bakery-app

Running the Project in Development Mode

mvn spring-boot:run

Wait for the application to start

Open http://localhost:8080/ to view the application.

Default credentials are [email protected]/admin for admin access and [email protected]/barista for normal user access.

Note that when running in development mode, the application will not work in IE11.

Running Integration Tests and Linter

Integration tests are implemented using TestBench. The tests take tens of minutes to run and are therefore included in a separate profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability. To run the tests, execute:

mvn verify -Pit,production

and make sure you have a valid TestBench license installed.

Profile it adds the following parameters to run integration tests:

-Dwebdriver.chrome.driver=path_to_driver
-Dcom.vaadin.testbench.Parameters.runLocally=chrome

if you would like to run a separate test make sure you have added these parameters to VM Options of JUnit run configuration

Run linter to check frontend code by adding -DrunLint to build/run command.

Automatic Restart and Live Reload

To activate spring-boot-devtools is needed to:

  1. Add spring-boot-devtools dependency
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>runtime</scope>
</dependency>
  1. Fork the process used to run the application by changing spring-boot-maven-plugin configuration
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring-boot.version}</version>
    <configuration>
        <fork>true</fork>
    </configuration>
</plugin>
  1. Optionally you might want to avoid the data generator to be run on each single reload, therefore, make H2 database store entities in file-system instead of in memory by adding the following lines to the src/main/resources/application.properties
spring.datasource.url=jdbc:h2:file:~/bakery-test-data
spring.jpa.hibernate.ddl-auto=update

To trigger the restart it is needed to update classpath. In Eclipse it can be done automatically after save modified file. In IntelliJ IDEA can be done manually Build -> Build Project

Live reload is supported and browser extensions can be found at http://livereload.com/extensions/.

Running the Project in Production Mode

mvn spring-boot:run -Pproduction

The default mode when the application is built or started is 'development'. The 'production' mode is turned on by enabling the production profile when building or starting the app.

In the 'production' mode all frontend resources of the application are passed through the polymer build command, which minifies them and outputs two versions: for ES5- and ES6-supporting browsers. That adds extra time to the build process, but reduces the total download size for clients and allows running the app in browsers that do not support ES6 (e.g. in Internet Explorer 11).

Note that if you switch between running in production mode and development mode, you need to do

mvn clean

before running in the other mode.

Running in Eclipse or IntelliJ

As both IDEs support running Spring Boot applications you just have to import the project and select com.kiroule.vaadin.bakeryapp.Application as main class if not done automatically. Using an IDE will also allow you to speed up development even more. Just check https://vaadin.com/blog/developing-without-server-restarts.

IntelliJ < 2018

Unfortunately, up to IntelliJ 2017 dependencies scoped as provided in the Maven POM will not be loaded on startup. As a workaround you will have to remove the scope definition of spring-boot-starter-tomcat and javax.servlet-api from the pom.xml.

Running Scalability Tests

The Bakery App Starter includes scalability tests. Once you have deployed a production build of Bakery you can run them to check how the app behaves under load. The scalability tests can be run completely on your local machine, but you might as well want to run locally only the test agents while the Bakery app under test is deployed to an environment that is close to your production.

In order to run the scalability tests locally:

  1. Make sure you are using Java 8 (Gatling Maven plugin does not yet work with Java 9+)

  2. Build and start Bakery in the production mode (e.g. mvn clean spring-boot:run -DskipTests -Pproduction)

  3. Open terminal in the project root

  4. Start a test from the command line:

    mvn -Pscalability gatling:test
  5. Test results are stored into target folder (e.g. to target/gatling/BaristaFlow-1487784042461/index.html)

  6. By default, the scalability test starts 100 user sessions at a 100 ms interval for one repeat, all of which connect to a locally running Bakery app. These defaults can be overridden with the gatling.sessionCount, gatling.sessionStartInterval gatling.sessionRepeats, and gatling.baseUrl system properties. See an example execution for 300 users started within 50 s:

    mvn -Pscalability gatling:test -Dgatling.sessionCount=300 -Dgatling.sessionStartInterval=50

Note: If you run Bakery with an in-memory database (like H2, which is the default), it will logically use more memory than when using an external database (like PostgreSQL). It is recommend to run scalability tests for Bakery only after you have configured it to use an external database.

License

A paid Pro or Prime subscription is required for creating a new software project from this starter. After its creation, results can be used, developed and distributed freely, but licenses for the used commercial components are required during development. The starter or its parts cannot be redistributed as a code example or template.

For full terms, see LICENSE

Pro components

Pro components used in the starter are :

Also, the tests are created using Testbench library.

vaadin-demo-bakery-app's People

Contributors

dependabot[bot] avatar igor-baiborodine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vaadin-demo-bakery-app's Issues

Problem update version vaadin to 8.5.1

I downloaded and changed the vaadin version (line 20 of POM.xml) from 8.4.1 to 8.5.1 (the last existing vaadin). Compiled, appeared the login page .. but when you log in go to the page "Whitelabel Error Page".
Just this version of vaadin I have tried to put in my projects (because it has a correction I need) but it gives this problem of "mapping".
What could it be?

Build fails when I try to run the project

It says:

Failed to execute goal com.vaadin:vaadin-maven-plugin:8.1.5:update-widgetset (default) on project vaadin-demo-bakery-app: Cval license check failed!: License for Vaadin Board 1 not found. Go to vaadin.com/pro for more details

The docs don't detail what to do.

Failed to retrieve RMIServer

Hello Igor,

I downloaded the branch v14 and after running mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v12.14.0" as requested by vaadin maven plugin I runned mvn clean package and mvn verify -Pit. This gave me the following exception:

  • Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:start (pre-integration-test) on project vaadin-demo-bakery-app: Could not contact Spring B
    oot application: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
    Did i do something wrong or is this an issue in the project?

Greetings, João Levy

admin views not being protected from other roles

I have been checking your bakery application for reference about using spring security + vaadin, and I think the admin views (users and products) aren't being protected.

If you log in as barista, you can't see the menu items since you don't add them in the AppRouterLayout, but if you type in the url bar /products or /users, you can go to those pages as barista and edit the information. According to the role, barista shouldnt be able to see these pages.

I don't know if this is exactly an issue, or its the desired behaviour for the application. Regardless of that, very good job.

Excuse me,Ask you a question

I downloaded the demo.springboot version, but when it is executed, it is displayed on the dashboard. "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain an implementation for com.vaadin.board.Board. Check the connector's @connect mapping, the widgetset's GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to",
Is there a good solution? thank you very much

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.