Skip to content

OptaPlanner OpenShift template for Employee Rostering Optimization as a Service

Notifications You must be signed in to change notification settings

cuijulian/optaweb-employee-rostering

 
 

Repository files navigation

Employee Rostering Optimization as a Service

Quality Gate Status Reliability Rating Security Rating Maintainability Rating Lines of Code Coverage

An end-to-end OptaPlanner web application ready to deploy on OpenShift 4.

Building

Build the project with maven in the project’s root directory:

mvn clean install -DskipTests -DskipITs

Running

After building the project, run the application with:

java -jar employee-rostering-distribution/target/employee-rostering-distribution-*-exec.jar --spring.profiles.active=dev

Then open http://localhost:8080/ to see the web application.

Alternatively, run npm start in employee-rostering-frontend to start the frontend in one terminal, and run mvn spring-boot:run in employee-rostering-backend to start the backend in another terminal.

Use a different port

To run on an another port use --server.port=…​:

java -jar employee-rostering-distribution/target/employee-rostering-distribution-*-exec.jar --spring.profiles.active=dev --server.port=18080

Benchmark Application

After building the project above, run the benchmark application with:

java -jar employee-rostering-benchmark/target/employee-rostering-benchmark-*.jar

Note: make sure to run the project application and benchmark application on different ports if they are run simultaneously.

After benchmarking is complete, a benchmark report will be generated in the local/benchmarkReport directory. Open the index.html file in your browser to view the benchmark results.

Configure the benchmarker

To configure the benchmarker, modify the employeeRosteringBenchmarkConfig.xml file found in the employee-rostering-benchmark/src/main/resources directory. Make sure to rebuild the project after modifying the config file for the benchmarker changes to be applied.

Refer to the OptaPlanner Docs for more information on benchmark tweaking.

Running on a local OpenShift cluster

Use Red Hat CodeReady Containers to easily set up a single-node OpenShift 4 cluster on your local computer.

Prerequisites

You have successfully built the project with Maven.

Procedure
  1. To install CRC, follow the Getting Started Guide.

  2. When the cluster has started,

    1. add oc command-line interface to your $PATH:

      eval $(crc oc-env)
    2. log in as "developer".

  3. Create a new project

    oc new-project project_name
  4. Run the script:

    ./provision.sh

Updating the deployed application with local changes

Backend

Change the source code and build the backend module with Maven. Then start OpenShift build:

cd employee-rostering-backend
oc start-build backend --from-dir=. --follow

Frontend

Change the source code and build the frontend module with npm. Then start OpenShift build:

cd employee-rostering-frontend
oc start-build frontend --from-dir=docker --follow

Development

Code formatter

Both IntelliJ and Eclipse formatters are available here: https://github.com/kiegroup/droolsjbpm-build-bootstrap/tree/master/ide-configuration

About

OptaPlanner OpenShift template for Employee Rostering Optimization as a Service

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 55.1%
  • Java 43.3%
  • CSS 0.6%
  • JavaScript 0.6%
  • Shell 0.2%
  • HTML 0.1%
  • Dockerfile 0.1%