MBaaS experience without the lock-in or cost

StrongLoop distro has been supported on the Amazon Marketplace since the July 1.1 release; so it’s no surprise that the new StrongLoop Suite (StrongNode, StrongOps and LoopBack) is ready to be used out of the box on Amazon Marketplace.

The additions to the StrongLoop AMI means that you can use the StrongLoop Suite server image not only as a starting point for deploying your node Applications, but also gives mobile developers a ‘parse’ Mobile backend as a service without having to write Node.js code or manage your infrastructure. The LoopBack mobile API tier provided in the StrongLoop Suite makes it easy for you to create a private mobile backend using open source node technology.

Mobile developers can dynamically manage ‘mobile object’ schemas directly from the LoopBack SDK as they are building their mobile app.

 

Standing up your Own Private Mobile Stack in 5 minutes on Amazon

The process to stand up your StrongLoop Suite application on EC2 is nearly identical to 1.1 StrongLoop outlined in this article: Getting Started with the Amazon Web Services StrongLoop Node AMI.

I will give a brief walkthrough of how to instance your StrongLoop Suite Amazon EC2 AMI, and then I will get into how to use the new features, specifically the native mobile SDK.

 

Instantiating and configuring your StrongLoop Suite:

  1. Browse to the StrongLoop Node AMI on the Amazon Marketplace [https://aws.amazon.com/amis/strongloop

](https://aws.amazon.com/amis/strongloop)

  1. Login to the AWS console with your Amazon credentials.
  2. Select the Launch AMI button

 

ami-install

  1. Select the Region and provisioning.

4. Verify the server is instantiated.

Once you SSH (login) to your newly created Amazon EC2 instance you can configure strong-agent for the StrongOps Console.

 

Configuring StrongOps

Configuring StrongOps is now as simple as setting your Agent ID and application name in the first line of the app.js file. StrongLoop Suite applications come preconfigured with strong-agent so you only need to set the ID and application name.

require('strong-agent').profile({ [USER_ID], [APPLICATION_NAME] });

You can find information about advance options such as blocking threshold in the StrongOps documentation page.

 

Standing up your custom LoopBack Mobile backend

The easiest way to ‘walk’ through the developing apps using LoopBack is to download the simple guide application. This Native iOS application will walk you through the basics of Creating Reading Updating and Deleting mobile model objects from your mobile Application.

First clone the project from the github repository http://github.com/strongloop-community/loopback-mobile-getting-started and cd into the folder /loopback-mobile-getting-started to get started.

$ git clone git@github.com:strongloop-community/loopback-mobile-getting-started.git
$ cd loopback-mobile-getting-started

A pre-configured LoopBack server is bundled in the repo so if you want to develop on your local machine you can simple run the loopback node app at /loopback-nodejs-server by running: $slc run app.js and then open your browser to http://localhost:3000 showing a splash screen or open the API explorer at http://localhost:3000/explorer/ .

 

Screen Shot -Explorer

Since we want to build a custom mBaaS on Amazon EC2 we will just use the mobile iOS XCode project to build our iPhone client app and we will create a new LoopBack MBaaS instance on our newly created Amazon EC2 instance.

 

Creating a custom LoopBack mBaaS instance on EC2

First remote ssh to your newly created EC2 instance.

Using the LoopBack CLI, you can create and configure your LoopBack node server on your Amazon EC2 instance:

$ slc lb project myLoopBackApp
$ cd myLoopBackApp
$ slc install
$ slc lb model product
$ slc lb model car

Then start the loopback server on your amazon instance with:

$slc run app.js

 

Integrate a Native iOS application with your custom LoopBack Amazon Mobile Backend instance

Since you have the ‘loopback-mobile-getting-started’ github repo on your local machine you can simply open the LoopBack iOS guide app located at /loopback-ios-app/loopback-ios-multi-model.xcodeproj with XCode.

Once the XCode Project is open you will need to modify your Adaptor endpoint to point to your Amazon EC2 Instance. Modify the:

_adapter = [LBRESTAdapter adapterWithURL:[NSURL URLWithString:@"http://localhost:3000"]];'

in the AppDelegate.m.  Change the ‘localhost’ address to point to your Amazon EC2 address.

Hit command R in XCode and walk through the walk the guide application instructions.

app-ios-gettingstarted-welcomeapp-ios-gettingstarted-1app-ios-gettingstarted-2app-ios-gettingstarted-3

 

If you would like to find some more examples on how to integrate native iOS applications with LoopBack make sure and check out the http://github.com/strongloop-community/loopback-examples-ios, where you will find a UITableView, MapView and custom method call samples.

Screen Shot -app-ios-mapview

Now that you have your StrongLoop Suite (StrongNode, StrongOps and LoopBack) up and configured you can start building out your mobile client application. You can identify ‘hot spots’ and latency with StrongOps or look for stress inside your node.js server application code. You can customize your services and data by extending the open source Node LoopBack API tier with custom code or NPM modules from the community.

If you are using Amazon’s Elastic Beanstalk, make sure and checkout the post on setting up and monitoring node.js apps on elastic beanstalk with StrongOps.

What’s next?

  • What’s in the upcoming Node v0.12 release? Six new features, plus new and breaking APIs.
  • Ready to develop APIs in Node.js and get them connected to your data? Check out the Node.js LoopBack framework. We’ve made it easy to get started either locally or on your favorite cloud, with a simple npm install.
  • Need training and certification for Node? Learn more about both the private and open options StrongLoop offers.