mvn spring-boot:run
To run with the Infinispan connector:
-
Run infinispan server (make sure counters and DispatchEvents caches are added to the config file):
$INFINISPAN_HOME/bin/standalone.sh -c CONFIG_FILE.xml
-
Change hotrod endpoint in
hotrod-client.properties
:infinispan.client.hotrod.endpoint=localhost
-
Run the application:
`mvn spring-boot:run -Dprod`
-
Login to a running OpenShift instance
oc login -u USERNAME -p PASSWORD OPENSHIFT_URL
-
Make sure datagrid service is running, if not deploy it:
git clone [email protected]:rhdemo/2019-demo4-cluster-setup.git ./2019-demo4-cluster-setup/datagrid/deploy.sh
-
Either use an existing project or create a new one by executing:
oc new-project NAME
-
Deploy the application to the project
mvn clean package -Popenshift
-
Find out a URL the service was exposed on
oc get route
Below are examples on key/value pairs in Infinispan caches that are relevant to OptaPlanner.
MECHANIC_ID: {
responseType: "DISPATCH_MECHANIC" or "ADD_MECHANIC",
mechanic: {
"mechanicIndex": 0,
“originalMachineIndex”: 0,
"focusMachineIndex": 0,
"focusTravelDurationMillis": 1000,
"focusFixDurationMillis": 2000
}
}
MECHANIC_ID-futureIndexes: {
responseType: "UPDATE_FUTURE_VISITS",
mechanicIndex: 0,
futureMachineIndexes: [
0,
1,
...
]
}
First make sure docker daemon is running, if not type sudo systemctl start docker
(or add the property -Ddocker.host=DOCKER_DAEMON_URL
).
Create a .env
file similar to .env.example
containing your quay.io username and password and run the script
./pushImage.sh
This command will build an image optaplanner-demo:latest
and tag it temporarily as
quay.io/redhatdemo/optaplanner-demo:latest
then push it to quay.io registry.
Therefore, remove any images with the same tag before executing the command above.
Running the docker
command without sudo
should work, but doesn’t on a vanilla Fedora installation.
If it doesn’t, try this:
dnf install docker
sudo groupadd docker
sudo usermod -aG docker `whoami`
sudo systemctl start docker
// If this fails with a permission problem, reboot first
docker run hello-world
If you’re getting 401 authorization issues during the mvn
build, try this first:
docker login docker.io
docker login quay.io/redhatdemo
If you follow security protocols and have different passwords for both services,
run docker pull fabric8/java-centos-openjdk8-jdk:1.5
first with the docker.io credentials
and then run the mvn
command with the quay credentials.
-
Clone cluster-setup repostiory:
git clone [email protected]:rhdemo/2019-demo4-cluster-setup.git
-
Copy the environment variables file:
cp .env.example .env
-
Change the first four OC* variables to match your openshift cluster info
-
In .env under # Frontend, add
FRONTEND_DEV=true
and changeADMIN_PASSWORD
which will be required to access the admin UI. -
Change the number of datagrid pods from 10 to 1 by changing the value of
INSTANCES
variable indatagrid/deploy.sh
-
Remove all resources requests from projects files so the demo can run on a cluster with limited resources. These files are:
optaplanner/optaplanner-demo-template.yaml
,datagrid/datagrid-service-custom-xml.yaml
,frontend/*.yml
. For example, inoptaplanner/optaplanner-demo-template.yaml
line 60 specifies the cpu and memory requests as 4 cpu cores and 4GB of RAM. -
Now you will be able to deploy the demo apps, run:
make datagrid make optaplanner make frontend
-
Wait until the pods are running, then you can view the factory floor by accessing the Dashboard UI at http://dashboard-web-game-demo.127.0.0.1.nip.io. Go to the admin UI at http://admin-web-game-demo.127.0.0.1.nip.io using the password that you set in step 4 with the variable
ADMIN_PASSWORD
and click on OptaPlanner to start simulation, unpauze dispatching and add/remove mechanics.