openshift - BAMGames/europa-universalis-implementation GitHub Wiki

First step : create an openshift account and download the oc client (you have all information on your webconsole help section).

After logging to your openshift dashboard (using token as explained in your web console help section), we will first create the database:

oc new-app -e MYSQL_USER=eu -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=eu mysql-persistent --name=eu-db

The database can only be queried from your pods. To be able to query it from your home, you have to forward ports. First thing is to retrieve the pod id where the database is running.

oc get pods

Then forward your local port (here 6666 but can be anything):

oc port-forward mysql-2-lckvq 6666:3306 &

Now, you can query the database using localhost as host, 6666 as port, eu as database, eu as login and password as password.

To install a tomcat with the webapp on it, run the following command:

oc new-app --name=eu-bg jboss-webserver50-tomcat9-openshift:1.2~https://github.com/BAMGames/europa-universalis-configuration.git -e MYSQL_USER=eu -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=eu

And to make the webapp accessible, run :

oc expose svc/eu-bg

By the way, if you want to deploy on openshift a war with a datasource configured, just fork the 'europa-universalis-configuration' git project and put your war in the deployments folder. Database credentials are obviously in the command line.

Update the application

To update the application, just put the new war in the europa-universalis-configuration git project and push it. Then start a build on the build configuration eu-bg. Or add a webhook to the europa-universalis-configuration to trigger the openshift build (type is json).