This afternoon I published a guest blog post on the Cloud Foundry website, promoting to use of Feedhenry's new integration with public Cloud Foundry. I re-produce a slightly edited version here. I'll follow up with more details of how to update the server-side of the app that has been created with the instructions below, using git commits.
Mobile application developers can now build and deploy applications on Cloud Foundry using the FeedHenry developer platform.
In the following blog we will demonstrate how to use the FeedHenry Command Line tool to clone a sample/template app, (from GitHub), stage the server-side code to CloudFoundry.com (Node.js and Redis), and build a HTML5 & JS app for an Android device. See http://mobilecf.feedhenry.com for detailed instructions. Also check out the FeedHenry App Studio to preview the app that you create here.
The FeedHenry CLI tool, fhc, uses node.js on your local machine. To setup node.js use the node installer located at http://nodejs.org/#download
Use the Node Package Manager (npm) to install or update the FeedHenry CLI tool (fhc).
$ sudo npm install –g fh-fhc
(the optional prefix “sudo” gives permission to install system-wide in a Unix style environment).
To test fhc is installed correctly and see the version you have installed, use:
$ fhc -v
fhc has some built-in documentation; use fhc help for general help, or fhc help [command] for help on a specific command.
To get started with the CLI tool you need to login to the FeedHenry platform using your CloudFoundry.com credentials. This will automatically create a FeedHenry account at mobilecf.feedhenry.com.
$ fhc target https://mobilecf.feedhenry.com
$ fhc login <your CloudFoundry.com email> <your CloudFoundry.com password>
In the next 3 simple steps, we will illustrate how to create a HTML5/JS app with an instant backend in cloudfoundry.com
To edit/modify the template app, login to github, and fork the app to your personal account.
Get the read-only git identifier for your cloned app.
Now create an app in the FeedHenry platform linked to your fork of the template app in github.
$ fhc apps create App-Anatomy git://github.com/<YOUR-ID>/App-Anatomy.git
If using a secured repository, please check out the documentation docs.feedhenry.com for generating and uploading public/private keys.
Staging to Cloud Foundry requires the use of the unique app identifier <APP-ID> that can be acquired by listing the active FeedHenry apps.
$ fhc apps
The staging can be done to the debug environment or the live environment. The former hosts the server-side for “debug” apps, and the latter for “release” apps. Separating these allows developers to exercise functionality separately in testing before deploying to production.
$ fhc stage <APP-ID> --devel
$ fhc stage <APP-ID> --live
To ensure that the app has indeed staged correctly use the Cloud Foundry CLI tool (vmc).
$ vmc target api.cloudfoundry.com
$ vmc login
$ vmc apps
$ vmc logs <my Cloud Foundry app-id>
We have just staged the cloud code from our forked app. Each app contains three directories: client, cloud, and shared. The client directory is for the client-side HTML5/JS app, the cloud directory is for the server-side Node.js code (this is what has been staged). The shared directory is in both. Check out the documentation for more information on using the shared directory.
To generate an Android debug build of the app:
$ fhc build app=<APP-ID> config=debug destination=android version=2.2 download=true
The appropriate files are gathered, bundled and dispatched to the FeedHenry build farm. The resulting binary file, for Android, an .apk file, is returned and can then be downloaded to your desktop. You can preview the app using the FeedHenry studio at mobilecf.feedhenry.com.
Load the app onto the phone by using email or Dropbox.
That’s it – you have built and staged an app in 3 easy steps.
Note: Editing the code in the git repository can make changes to the server-side and the client-side functionality. Those changes can be uploaded to FeedHenry via a git pull request. The updated server-side code can be re-staged, and the updated client-side code can be used to build a new version of the app. To find out more about this template app, App-Anatomy, see FH App-Anatomy in the References.
To get started go to http://mobilecf.feedhenry.com
Join the FeedHenry and the Cloud Foundry guys for a Cloud Foundry mobile meetup, March 25th, San Francisco.
Signup for Cloud Foundry today, and start building your own mobile app!Tweet Posted by mofoghlu at March 6, 2012 3:44 PM | TrackBack