Build the project with maven in the project’s root directory:
mvn clean install -DskipTests -DskipITs
After building the project, run the application with:
java -jar optaweb-employee-rostering-standalone/target/optaweb-employee-rostering-standalone-*-exec.jar
Then open http://localhost:8080/ to see the web application.
Alternatively, run npm start
in optaweb-employee-rostering-frontend
to start the frontend in one terminal,
and run mvn spring-boot:run
in optaweb-employee-rostering-backend
to start the backend in another terminal.
After building the project above, run the benchmark application with:
java -jar optaweb-employee-rostering-benchmark/target/optaweb-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.
To configure the benchmarker, modify the employeeRosteringBenchmarkConfig.xml
file found in the
optaweb-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.
In order to start running the database(Postgres) and the application, run the below command in your terminal:
docker-compose up
This will bring the database up and also the application. But the application will quit because the necessary database configuration is not setup yet. So you need to configure the database. To do that:
First you need to install the Postgres client. Here is a tutorial to do that for various platforms. Don’t quit the previous terminal tab/window and install the Postgres client in a separate tab/window.
Once you install psql, you can start configuring the database. In a separate terminal tab/window (keep Postgres running from the previous step), follow the below steps.
-
Connect to the database, by typing the below in command line in a new terminal tab/window:
psql -h localhost -U postgres
-
You will see the commandline prompt. First create the user that will access the database from the app. Type below in the psql command prompt:
CREATE USER optaweb WITH PASSWORD 'lay123lom6a' CREATEDB;
-
Now you need to create the database where the data will be stored. Type below in the psql command prompt:
CREATE DATABASE roster OWNER optaweb;
Now you can quit the psql client. Postgres is configured with a user and a fresh new database.
You can now stop the docker-compose either by typing CTRL-C in the terminal tab/window the docker-compose was running or do the below in the same folder your docker-compose.yml file is:
docker-compose down
Now everything is down. Bring them back up by typing:
docker-compose up
Both the app and the database should be running at this stage. Open a browser window and navigate to http://localhost:8080 to see the app running.
Use Red Hat CodeReady Containers to easily set up a single-node OpenShift 4 cluster on your local computer.
You have successfully built the project with Maven.
-
To install CRC, follow the Getting Started Guide.
-
When the cluster has started,
-
add oc command-line interface to your
$PATH
:eval $(crc oc-env)
-
log in as "developer".
-
-
Create a new project
oc new-project project_name
-
Run the script:
./runOnOpenShift.sh
Change the source code and build the backend module with Maven. Then start OpenShift build:
cd optaweb-employee-rostering-backend
oc start-build backend --from-dir=. --follow
Both IntelliJ and Eclipse formatters are available here: https://github.com/kiegroup/droolsjbpm-build-bootstrap/tree/master/ide-configuration
Configure your IDE to run the main class, which is in
org.optaweb.employeerostering.OptaWebEmployeeRosteringApplication
in optaweb-employee-rostering-backend
repository.