Many developers prefer to focus on their code without worrying about the underlying infrastructure. Our cloud platform can meet you at whatever level of control you want. Cloud-native "as-a-service" products, whether from CenturyLink Cloud or other providers, handle much of the infrastructure management for you. These types of services also give you the flexibility to expand and move your applications and your data.

In this post, I'll share an example of migrating a Presidential Executive Order Search application. The example was written to showcase the Orchestrate NoSQL Database-as-a-Service features running on a Platform-as-a-Service. Without changing any code, I moved both the application and the data to the CenturyLink Cloud infrastructure. Along with Orchestrate, I deployed the code to AppFog, our Cloud Foundry-based Platform-as-a-Service.

Executive order app

You can follow along with my migration and deploy your own version of the Executive Order Search application, without writing any code yourself.

Deploy from a GitHub Repository

The Executive Order Search application is a single page that uses JavaScript to interact with a simple Node API layer which queries Orchestrate. You can find all the code on GitHub, which we will use without modification to deploy to AppFog. Keep in mind that this same code originally ran on another Platform-as-a-Service.

AppFog control panel

  1. Within the CTL Control Panel, navigate to AppFog, then choose the data center and space where you'd like to deploy the application. Now click deploy an app.

    AppFog deploy an app screen

    Note: You may also be familiar with deploying AppFog apps from the Cloud Foundry CLI, but in this example we'll use the web interface.

  2. Give your application a unique name. Choose something like companyname-exor.

  3. Add the URL to the zip file from the GitHub repo:

  4. Click deploy app and wait for the magic to happen. AppFog will download the code from GitHub, decompress the file, and push it out as a new app. You should now be able to view the Executive Order Search web page, but we still need to connect it to an Orchestrate database.

Connect Orchestrate and AppFog

If you poke around the AppFog application, you'll notice that it returns no data. For one, we haven't imported the data (that's the next step), but we also don't have a place to put the data.

  1. Login to the Orchestrate dashboard and click New Application.

    New Orchestrate app

  2. Choose a unique name, such as companyname-exor, and choose the same data center that you used with AppFog. This will create a place to store the Executive Order data.

  3. Once your Orchestrate application is created, copy the API Key so you can store it as an environment variable in AppFog.

    AppFog environment variables

  4. From the detail view of your AppFog application, choose the Environment tab. Click add and use OIOKEY_EXOR as the name. Enter your copied API Key as a value.

  5. Click create. Then you'll need to click restage to make the variable available to your app.

Import Data into Orchestrate

Since you started with a fresh Orchestrate application, there's still no data in it. We could have used my previous copy of the data, which is stored in Orchestrate, but in another data center. Ensuring the database and the application are in the same data center will give you the lowest latencies.

I was able to use Orchestrate's data export feature to compile a file containing the nearly 800 executive orders run since 1994. Using that export file, we can import the data into your new Orchestrate application. To do this, we'll use bulk operations, which let you group up to 250 calls into one request. I split my export into four groups, then used cURL to import the data into Orchestrate.

  1. These segments of data are available on GitHub, or you can use the cURL command to import from the command line:

    curl | curl -i "" -XPOST -H "Content-Type: application/orchestrate-export-stream+json" -u "API_KEY:" -d @-
  2. You'll need to add your API Key from your new Orchestrate application in place of API_KEY. Also note that you may need to use a different Orchestrate API URL if you've chosen a different data center.

  3. Then repeat the call with exor-data-segment2.json and so on until you've imported all four segments.

  4. Finally, load your AppFog application again in a web browser. Try some searches and enjoy the speedy responses from Orchestrate.

This is both a sample application that you can play with and an example of the flexibility you get from "as-a-service" technologies. You don't have to worry about managing the infrastructure behind AppFog and Orchestrate. Deploying and migrating applications is as easy as pointing to a GitHub repo, importing data, and connecting them together via an API Key.

For another example of Orchestrate and AppFog in tandem, see this Geolocation App Tutorial, which includes using the AppFog command line utilities.

Photo by amysphere