Export your application from the sandbox into Red Hat OpenShift Service on AWS

Learn how to take an application you created in the Developer Sandbox for Red Hat OpenShift and move it into another cluster, such as a new instance of the Developer Sandbox or a more permanent solution such as Red Hat OpenShift Service on AWS.

Learn more about the Developer Sandbox

It's time to get started. For the first lesson, you will be logging into your Developer Sandbox instance and running an application.

In order to get full benefit from taking this lesson, you need:

In this lesson, you will:

  • Create a two-component application
  • Run the application

Log into your sandbox at the command line

If you’re unsure how to do this, you can find instructions here: Access your Developer Sandbox for Red Hat OpenShift from the command line | Red Hat Developer

Create a two-component application

Now that you’re logged in, it’s time to create an application that can be exported from your sandbox.

  1. To do this, simply run the following command:

    oc create -f https://raw.githubusercontent.com/redhat-developer-demos/ocp-demo-load/main/qotd-app-objects.yaml
  2. You will immediately start to see the applications built under the group name QuoteOfTheDay (Figure 1). This grouping name is important. You’ll use it later when preparing your objects to be imported into another cluster. 

    Figure 1: Application is finished building
    Figure 1: Application is finished building.

Run the application

Now that the application is built, it’s time to test it and see it working.

  1. Looking at the two applications in the dashboard, you can see that both applications have an external Route, which is a public URL by which they can be accessed.
  2. This is evidenced by the small arrow icons in the upper right corner of each application (Figure 2). 

    Figure 2: Routes (external URLs) are highlighted
    Figure 2: Routes (external URLs) are highlighted.
  3. The qotd-nodejs container is the back-end portion of our app. This is the REST web API that supplies data to the front end. The URL for that back-end container will be copied and pasted into the front-end web page.
  4. You can get the URL by clicking on the arrow (route) icon, or by running the following command at the command line:
    1. (If using PowerShell):

      oc get routes | select-string '^qotd-nodejs'

      (If using Bash):​​​​​​​

      oc get routes | grep qotd-nodejs
  5. Once you have the route, you will need to prefix it with the protocol https://, append it with /quotes/random, and save that result.
  6. Here’s an example of the route and the finished URL:

  7. Open the front-end application by clicking on its Route icon. You’ll be presented with a screen similar to Figure 3: 

    Figure 3: Quote of the Day web app
    Figure 3: Quote of the Day web app.
  8. Click the prompt at the top to reveal the Settings page, where you will paste in your URL: 

    Figure 4: Enter API Server URL here
    Figure 4: Enter API Server URL here.
  9. Click Save and return to the home page. You will now be able to retrieve random quotes.

That's it for Lesson 1. You can now retrieve random quotes. Now it's time to export your application then import it to another cluster.

Previous resource
Overview: Export your application from the sandbox into Red Hat OpenShift Service on AWS
Next resource
Export your application and move it to another cluster