You should have a locally installed version of OpenShift, or access to an OpenShift cluster. If you don’t have either, you can set up your own OpenShift local cluster by reading this document.
Bring up your cluster with:
oc cluster up --public-hostname=127.0.0.1 --host-data-dir=$HOME/os/data-dir --host-config-dir=$HOME/os/config-dir
Log into your cluster via
We will be using the UPS docker image from Docker Hub. This image requires that we have 2 MySQL instances named ‘unifiedpush’ and ‘keycloak’. Create these by:
oc new-app mysql MYSQL_USER=unifiedpush MYSQL_PASSWORD=unifiedpush MYSQL_DATABASE=keycloak --name=keycloak
oc new-app mysql MYSQL_USER=unifiedpush MYSQL_PASSWORD=unifiedpush MYSQL_DATABASE=unifiedpush --name=unifiedpush
Confirm that both MySQL instances have come online by checking the OpenShift console, or via the terminal with
With both required MySQL instances installed and running, UPS can now be deployed by running the following command in your terminal:
oc new-app aerogear/unifiedpush-wildfly \ UNIFIEDPUSH_PORT_3306_TCP_ADDR=unifiedpush \ UNIFIEDPUSH_PORT_3306_TCP_PORT=3306 \ UNIFIEDPUSH_ENV_MYSQL_DATABASE=unifiedpush \ KEYCLOAK_PORT_3306_TCP_ADDR=keycloak \ KEYCLOAK_PORT_3306_TCP_PORT=3306 \ KEYCLOAK_ENV_MYSQL_DATABASE=keycloak \ UNIFIEDPUSH_ENV_MYSQL_USER=unifiedpush \ UNIFIEDPUSH_ENV_MYSQL_PASSWORD=unifiedpush \ KEYCLOAK_ENV_MYSQL_USER=unifiedpush \ KEYCLOAK_ENV_MYSQL_PASSWORD=unifiedpush \ --name=unifiedpush-wildfly
This will deploy UPS and pass in the necessary environmental variables for UPS to pick up the MySQL instances. You can see these environmental variables in the OpenShift console:
With UPS deployed, the final step is to expose route(s) so we can access our UPS instance through a web browser. The following creates 2 routes; one to access UPS through localhost on our web browser, and one through which the android emulator can access UPS:
oc expose service unifiedpush-wildfly --hostname=ups.127.0.0.1.nip.io --port=8080-tcp --name=ups-local-unsecured
oc expose service unifiedpush-wildfly --hostname=ups.10.0.2.2.nip.io --port=8080-tcp --name=ups-android-unsecured
You should see confirmation that the routes have been created:
The OpenShift console will confirm that this also:
** if you require any other routes to be exposed to UPS for your apps, you can simply add them in the above manner.
UPS uses an embedded Keycloak server to handle its authentication. Right now there is an issue when the UPS pod starts up it can’t route to Keycloak using the public route. To work around this, do the following after the pod has loaded fully
wget http://localhost:8080/ag-push/index.htmlin the Terminal for the unifiedpush-wildfly pod
UPS can now be configured via the browser and the route you have created:
** This tutorial does not cover how to configure UPS to send push notifications to your mobile app. For guidance on how to do so, the AeroGear HelloPush tutorial may be found here which covers cover how to configure push notifications to an app with UPS.