Chapter 9. Run OptaWeb Vehicle Routing on Red Hat OpenShift Container Platform
Linux users can use the runOnOpenShift.sh
Bash script to install OptaWeb Vehicle Routing on Red Hat OpenShift Container Platform.
The runOnOpenShift.sh
script does not run on macOS.
Prerequisites
-
You have access to an OpenShift cluster and the OpenShift command-line interface (
oc
) has been installed. For information about Red Hat OpenShift Container Platform, see Installing OpenShift Container Platform. - OptaWeb Vehicle Routing has been successfully built with Maven as described in Chapter 6, Download and build the OptaWeb Vehicle Routing deployment files.
- Internet access is available.
Procedure
- Log in to or start a Red Hat OpenShift Container Platform cluster.
Enter the following command where
<PROJECT_NAME>
is the name of your new project:oc new-project <PROJECT_NAME>
-
If necessary, change directory to
optaweb-vehicle-routing-distribution-7.44.0.Final-redhat-00006/sources
. Enter the following command to execute the
runOnOpenShift.sh
script and download an OpenStreetMap (OSM) file:./runOnOpenShift.sh <OSM_FILE_NAME> <COUNTRY_CODE_LIST> <OSM_FILE_DOWNLOAD_URL>
In this command, replace the following variables:
-
<OSM_FILE_NAME>
: The name of a file downloaded from<OSM_FILE_DOWNLOAD_URL>
. -
<COUNTRY_CODE_LIST>
: A comma-separated list of country codes used to filter geosearch queries. For a list of country codes, see ISO 3166 Country Codes. <OSM_FILE_DOWNLOAD_URL>
: The URL of an OSM data file in PBF format accessible from OpenShift. The file will be downloaded during backend startup and saved as/deployments/local/<OSM_FILE_NAME>
.The following example configures OptaWeb Vehicle Routing to filter geosearch results to Belgium and downloads the latest Belgium OSM extract from Geofabrik:
In the following example, OptaWeb Vehicle Routing downloads the OSM map of Central America (
central-america-latest.osm.pbf
) and searches in the countries Belize (BZ) and Guatemala (GT)../runOnOpenShift.sh central-america-latest.osm.pbf BZ,GT http://download.geofabrik.de/europe/central-america-latest.osm.pbf
-
For help with the runOnOpenShift.sh
script, enter ./runOnOpenShift.sh --help
.
9.1. Updating the deployed OptaWeb Vehicle Routing application with local changes
After you deploy your OptaWeb Vehicle Routing application on Red Hat OpenShift Container Platform, you can update the back end and front end.
Prerequisites
- OptaWeb Vehicle Routing has been successfully built with Maven and deployed on OpenShift.
Procedure
To update the back end, perform the following steps:
- Change the source code and build the back end module with Maven.
-
Change directory to
optaweb-vehicle-routing-distribution-7.44.0.Final-redhat-00006/sources/optaweb-vehicle-routing-backend
. Enter the following command to start the OpenShift build:
oc start-build backend --from-dir=. --follow
To update the front end, perform the following steps:
-
Change the source code and build the front end module with the
npm
utility. -
Change directory to
sources/optaweb-vehicle-routing-frontend
. Enter the following command to start the OpenShift build:
oc start-build frontend --from-dir=docker --follow
-
Change the source code and build the front end module with the
Next steps