Getting Started on APPUiO Cloud with the OpenShift Web Console using Scala

Programming language logo This tutorial explains how to run applications written in the Scala programming language on APPUiO Cloud using the OpenShift web console.

If you would rather use the command line, you might want to try the Getting Started with Scala on the Terminal guide instead.

Requirements

This tutorial doesn’t require anything else than an APPUiO Cloud account and a modern web browser with JavaScript enabled.

About the Application

To demo how to run applications written in the Scala programming language on APPUiO Cloud, we will use a small demo application using the Scalatra Framework, bundled as a container thanks to its corresponding Dockerfile, and ready to be used on APPUiO Cloud.

The "Fortune in Scala" application does one simple thing: when invoked on the browser, it returns a random number and a funny quote. That’s all!

You can browse the full source code of this application on GitLab.

Step 1: Deploy a Container

Follow these steps to create an OpenShift project and deploy the application:

  1. Login to APPUiO Cloud and open the "Developer" perspective.

    • You can find the link to the APPUiO Cloud web console of your chosen zone in the APPUiO Cloud Zones documentation page.

  2. Create a new project called "[YOUR_USERNAME]-fortune-scala."

  3. Click the "+Add" button on the sidebar.

  4. Select the "Container images" option.

    As explained in this page, not all options in this screen are available in APPUiO Cloud. In particular, it’s not possible to choose the "Import from Git" option, as this requires image building capabilities that aren’t yet available in APPUiO Cloud.
  5. In the "Image name from external registry" field, enter the URL of the Fortune in Scala container:

    • registry.gitlab.com/vshn/applications/fortune-scala:latest

  6. Change the runtime icon to match the Scala programming language, the Scalatra Framework, or any other icon you’d like to use.

  7. Click "Create."

  8. After a few seconds, you will see in the "Topology" section an icon representing the "Fortune in Scala" application running. If you click on it, you will see that there is a "Route" to access the object; it will contain a clickable URL similar to the following:

    • fortune-scala-[YOUR_USERNAME]-fortune-scala.apps.[YOUR_CHOSEN_ZONE].appuio.cloud

  9. If you click on it, you will see your daily fortune cookie message!

Step 2: There’s no Step 2!

The "Fortune in Scala" application is now running on APPUiO Cloud. Congratulations! Hit the R key in your keyboard to see a new fortune message, or just wait 10 seconds to get a new one automatically.

What’s next? To run your own application written in Scala or using the Scalatra Framework on APPUiO Cloud, follow these steps:

Finally, when you’re done testing the fortune application, you can open the "Projects" menu in the "Administrator" perspective and delete the fortune-scala project, by selecting the appropriate entry on the "Actions" menu.