Terence Bennett - September 11, 2014

bill-appleton-author-mobile-arch

According to Gartner, “traditional development practices will fail for mobile apps.” Here at DreamFactory, we couldn’t agree more. The transition from desktop web sites that use HTML to single page web apps that need RESTful services can be daunting. Companies must often develop both the front-end application as well as the back-end infrastructure for their mobile projects. And even then, there can be uncertainty about performance and scalability.

And so, I am happy to announce that the DreamFactory open source REST API platform can now be installed on Pivotal Web Services (PWS). This is a turnkey solution that provides a comprehensive set of back-end services for mobile deployments. Developers can use DreamFactory to build a project on their local machine and then push the application into PWS for reliable, scalable, and affordable hosting.

In many cases, modern developers want the back-end platform to “just work” so that they can focus on user experience and application design. DreamFactory running on PWS provides an ideal environment for such developers. They don’t have to worry about server-side software or hosting issues. To my knowledge, this is the first time that a mobile application platform like DreamFactory has been made available on a PaaS system like PWS, and we are excited to make the integration simple.

Related reading: Integrating a Remote Web Service

My favorite part of PWS is how easily they can scale your application. You just specify the total number of application instances and this controls the maximum number of REST API transactions per second that the platform can handle. The cost model is quite low and easy to predict at only 3 cents per GB/hour. As an application becomes more popular, you can rely on PWS to help you scale without breaking the bank.

This blog post provides all of the information you need for installing DreamFactory on PWS. We also include an example HTML5 application so that you can see data hosted on PWS from any mobile device. We have included a few short movies that show an overview of the installation process, and some other helpful links, below. This should be everything you need to build mobile applications on PWS, please contact us at [email protected] if you have any problems.

Gartner Press Release:

Gartner Says Traditional Development Practices Will Fail for Mobile Apps, August 14 2014 https://www.gartner.com/newsroom/id/2823619

Helpful Links:

Pivotal Web Services Website
Pivotal Web Services Documentation
DreamFactory Website
DreamFactory Forum
DreamFactory Documentation

Overview Movies:

Overview of DreamFactory on PWS
Installation Details For DreamFactory On PWS
Customizing the DreamFactory image for PWS

Setting Up DreamFactory

On PaaS systems like PWS there is no persistent storage on the server side. Because of this, your application must be bound to an external SQL database, and PWS provides a number of options for this. You also cannot edit web application files or server-side scripts in the cloud. In this case, you would just be editing the file in temporary local storage.
There are two ways to handle this issue. If you don’t need local web files or server-side scripting, then just grab the DreamFactory source code from GitHub and push that. You can run the DreamFactory Admin Console on PWS and configure your platform from there. Your modifications are saved in the SQL database.
Or you can run DreamFactory on the local desktop, and develop and debug your applications from there. DreamFactory has Bitnami installers for Linux, OS X, and Windows. When you push the desktop folder your local web application files and server-side scripts will be included in the PWS image. Both of these methods are covered in the instructions, below.

pws_image_dream_big

Push To Pivotal Web Services

There are some “one time” tasks setting up your development environment that need to happen before you can push to PWS. These are outlined in detail below, but here are the major items:

  • Get an account with Pivotal Web Services
  • Install the Cloud Foundry command line tools
  • Move a database configuration file in your DreamFactory directory
  • Edit the application manifest file in your DreamFactory directory
  • Push the DreamFactory image to PWS
  • Connect a MySQL database to the application

After this, you can develop applications locally and update any changes with the “cf push” command. This is super convenient. You can edit your application with desktop tools, and push the image to PWS with one command! Here are the detailed step-by-step instructions to set up your development environment and push DreamFactory to your PWS account.

pws_image_pivotal_big

Detailed Instructions

STEP ONE

Get a Pivotal Web Services Foundry account.
https://run.pivotal.io
Read the Pivotal documentation.
https://docs.run.pivotal.io/starting/
Install the Pivotal CLI tool on your local machine.
https://console.run.pivotal.io/tools

STEP TWO

Get the DreamFactory source code,
https://github.com/dreamfactorysoftware/dsp-core
Or the desktop installer.
https://bitnami.com/stack/dreamfactory/installer
Run the installer or unpack the source in a desktop folder.

STEP THREE

Locate the DreamFactory source code folder:
For the GitHub source code, this will be the “dsp-core-master” folder
For the desktop install, this will be the “…/apps/dreamfactory/htdocs” folder
Make the following changes:
1) Copy htdocs/config/manifests/manifest.pivotal.yml-dist to htdocs/manifest.yml
2) Edit manifest.yml and change [app-name] and [host-name] to your app name
3) Copy config/database.pivotal.config.php-dist to config/database.config.php

STEP FOUR

Navigate to the source code folder with the Command Prompt and type the following:
1) cf api api.run.pivotal.io
2) cf login
Followed by your Pivotal email and password
3) cf push

STEP FIVE

Log into your PWS account.
Create a new ClearDB service and bind it to your app using the Pivotal user interface.
Restart your application and run. In the future, you just have to do the login and push to update.

STEP SIX

We have a demo application that can be used to edit the SQL data in your PWS account.
Navigate to the Apps tab of the DreamFactory Admin Console.
Click the “Import” button at upper right, and enter the URL below.
https://raw.github.com/dreamfactorysoftware/angular-data-manager/master/datamanagerapp.dfpkg
Open this application from the Admin Console or a mobile device to create and edit data on PWS.