The DreamFactory open source REST API platform can now be installed on Pivotal Web Services (PWS) as an application. DreamFactory enables developers to 1) build the front-end application on their local machines and then 2) push the required mobile back-end infrastructure services on Pivotal Web Services for reliable, scalable, and affordable PaaS hosting.
We choose PWS, as this integration results in the ideal experience for our customers. Not only can our customers now benefit from a set of RESTful data-services powered by DreamFactory, but also the simplicity in operations and deployment of PWS.
As with all apps, it is very easy to scale DreamFactory apps on Pivotal Web Services.
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. If you have any feedback or ideas on how we can improve this product or our integration with Pivotal, please send us an email to email@example.com
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.
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. You can edit your application with desktop tools, and push the image to PWS with one command!
Get a Pivotal Web Services account.
Read the Pivotal documentation.
Install the Pivotal CLI tool on your local machine.
Get the DreamFactory source code,
Or the desktop installer.
Run the installer or unpack the source in a desktop folder.
Locate the root folder for the DreamFactory source code:
For the GitHub repository, this will just be the “dsp-core-master” folder
For the desktop install, this will be the “…/apps/dreamfactory/htdocs” folder
Make the following changes:
1) Copy config/databases/database.pivotal.config.php-dist to config/databases/database.config.php
2) Copy config/manifests/manifest.pivotal.yml-dist to manifest.yml in the root folder
3) Edit manifest.yml and change [app-name] and [host-name] to your app name
Navigate to the source code folder with the Command Prompt and type the following:
1) cf api api.run.pivotal.io
This will point the CloudFoundry command-line interface to the PWS APIs. Note: that you can also install DreamFactory to your own hosted version of CloudFoundry, by simply pointing to your instance’s API end-point
2) cf login
This will ask you for credentials to login to PWS.
3) cf push
This will push all the code based in this directory, build and deploy it to PWS.
Note: in this stage your app will be deployed to PWS, but it won’t yet function as we need to add a database binding (which we’ll do in the next step)
DreamFactory needs a database to store user, role, and service information.
Next we are going to set up the ClearDB MySQL database for this purpose.
Log into your PWS account.
Create a new ClearDB service and bind it to your app using the PWS user interface.
Restart your application by clicking in the green circle next to your application name.
In the future, you just have to do the login and push to update your application.
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.
A new application named “Data Manager” will appear in the list to the left.
Open this application from the Admin Console or a mobile device to create and edit data on PWS.
By installing DreamFactory on PWS, can get the benefit of easier access to their data and the scalability and operational benefits of PWS. We are excited to see what applications you will build with this powerful combination.
About the AuthorFollow on Twitter More Content by Eli Aleyner