This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Posts tagged: OpenShift

VisionX 2.2 with OpenShift support

Our next VisionX release will support OpenShift. We wrote about OpenShift and our application test some weeks ago. It was so impressive that we did an integration in VisionX.
VisionX got additional menus and options for OpenShift and it handles complete communication. It's really end-user friendly. Usually, only developers can use OpenShift and create applications for the platform.

OpenShift platform was our preferred platform for VisionX because it has a complete REST API and a simple Java library. Many other platforms don't offer the same quality or are too complex for an integration. OpenShift itself has a simple frontend but it wasn't designed for end-users.

Why does an end-user need OpenShift?

To realize ideas.

Why should an end-user do that?

Why does and end-user need a website? ... to present itself or products.

Many end-users create Excel sheets or use app builders to realize ideas. The problem is often the deployment because and end-user can't deal with databases, application servers or PaaS providers. The same applies to startups.

VisionX is end-user friendly and enables innovation.

What we have in VisionX?

VisionX supports configuration of your OpenShift account. The only thing you need is an already activated OpenShift account. Simply register on OpenShift and that's it. The rest will be handled by VisionX. Don't create SSH keys or open tunnels to access your remote database or application server. VisionX will do all this tricky things for you.

We have a short Video for you. It demonstrates the OpenShift integration of VisionX. The first part shows configuration of a fresh OpenShift account. In the second part, we create a simple (unstyled) application and the last part is the deployment.

The whole video lasts 4:30 minutes. Have you ever created a full database application with menu, toolbar, user authentication, an input form and deployed in around 5 minutes?

Multi-IDE support for VisionX


(To be honest: Deployment wasn't as fast as shown in the video, because upload time can't be improved)

OpenShift Deployment

OpenShift is a PaaS product from Red Hat.
Read further details at Wikipedia or the product site.

It's of interest to us because it's easy to use, supports deployment of pre-created war files and it offers an application server (e.g. Tomcat, JBoss) and a database (MySQL, PostgreSQL) for your applications. OpenShift also has Vert.x as runtime platform if you won't use an application server. The configuration is super easy and your server is ready in around 5 minutes.

The access to your server is protected and you should use a specific client tool from RedHat for advanced configuration or an SSH client like putty.

The PaaS service is so nice because it's the perfect deployment platform for JVx applications. There's a free service for simple tests and maybe smaller applications because there are some limits for memory usage, CPU, and number of applications.

We made some tests with OpenShift and the result was as expected: Our applications did work without problems. Sure, the whole deployment procedure could be more end-user friendly but it wasn't designed for end-users without technical know-how, I guess. It's good enough for software developers or admins.

Our test

We created a new JVx application with VisionX (because it creates the database, has a GUI builder and creates the war file for us) and the application should run with VaadinUI on OpenShift. We didn't have any experience with OpenShift, but with other PaaS products, e.g. Heroku, Cloudbees, Jelastic, AWS.

First steps:

  1. Registering an account (what else :) )
  2. Creating a first application
  3. Cartridge: Tomcat 7 (JBoss EWS 2.0)
  4. Setting application name and domain
  5. Adding MySQL 5.5 cartridge

Above steps were enough to run our OpenShift service(s).

Next was accessing the server via SSH client because we didn't install the RedHat client tool (We won't use client tools for cloud services - why the hell). Sure, we had to use another client tool for accessing the server via SSH, but it was working without installation: PuTTY (still strange). A nice web UI would be great... just my thoughts. We found a Java client but didn't test it.

So, what we did:

  1. Creating private/public RSA keys with PuTTYgen
  2. Configuring OpenShift (used the key from PuTTYgen TextArea because OpenShift didn't like other formats)
  3. Testing connection

    Username was displayed in Application settings under SSH Code, e.g. ssh://<username>@app-domain.rhcloud.com/....
    Used the private key file for putty as key (Key authentication, without password)

Next task was, configuring the access to the database because SSH access was already working. It wasn't possible to access the database without tunnel - means, no direct (Internet) access from your client. This wasn't a real problem and PuTTY had support for port tunneling. Simply detected the IP address of the MySQL server. The hostname was set as environment variable and the command export displayed all variables. The variable OPENSHIFT_MYSQL_DB_HOST had all information and our tunnel was working. There's also a property for the MySQL Port but 3306 is default.

What was next?

Deployment.

This wasn't trivial because the platform expected source code and a maven project for automatic deployment. Wrong for us. But there's an official documentation for manual war deployment.

Short summary of steps

  1. GIT clone
  2. Delete src folder and pom.xml
  3. GIT commit & push
  4. Copy WAR file into webapps folder
  5. GIT commit & push

You don't need git on your client, it's available in your terminal. But... as a developer, git is one of those standard tools...
It's also possible to upload the WAR file via SCP or SFTP...

Done...

Not really because our application was deployed without problems but it didn't work because the JDBC URL was wrong. We set the MySQL servername to localhost because of the tunnel!

Here's the original config.xml:

<?xml version="1.0" encoding="UTF-8"?>

<application>
  <securitymanager>
    <class>com.sibvisions.rad.server.security.DBSecurityManager</class>
    <accesscontroller>com.sibvisions.apps.server.object.DBWorkScreenAccess</accesscontroller>
    <passwordalgorithm>SHA</passwordalgorithm>
  </securitymanager>
  <connection>
    <!-- GLOBAL | DATASOURCE | OFF -->
    <property name="client.metadata_cacherole">OFF</property>
  </connection>
  <lifecycle>
    <application>com.sibvisions.apps.openshifterp.Application</application>
    <mastersession>com.sibvisions.apps.openshifterp.Session</mastersession>
  </lifecycle>
  <datasource>
    <db name="default">
      <url>jdbc:mysql://localhost:3306/erp</url>
      <username>username</username>
      <password>password</password>
    </db>
  </datasource>
</application>

JVx has a nice feature which allows environment dependent settings and VisionX sets the environment automatically to prod. So, we simply changed the datasource to:

<datasource>
    <db name="default">
      <url>jdbc:mysql://localhost:3306/erp</url>
      <url_prod>jdbc:mysql://hostname_from_env_variable:3306/erp</url_prod>
      <username>username</username>
      <password>password</password>
    </db>
  </datasource>

VisionX sets the environment to prod, if it creates a WAR file:

<securitymanager>
    <class>com.sibvisions.rad.server.security.DBSecurityManager</class>
    <accesscontroller>com.sibvisions.apps.server.object.DBWorkScreenAccess</accesscontroller>
    <passwordalgorithm>SHA</passwordalgorithm>
    <environment>prod</environment>
  </securitymanager>

Sure, the solution isn't perfect because the MySQL hostname should be read from the environment variable.
Would be better:

<url_prod>jdbc:mysql://${env:OPENSHIFT_MYSQL_DB_HOST}:${env:OPENSHIFT_MYSQL_DB_PORT}/erp</url_prod>

But JVx doesn't support this syntax (right now) -> Feature Request.

Done. Really done.

The application works fine (Login as admin with password admin).

Here's a screenshot, for the case that our OpenShift service isn't running:

OpenShift ERP with JVx and VaadinUI

OpenShift ERP with JVx and VaadinUI