Skip to content

Instantly share code, notes, and snippets.

@mschmulen
Last active December 22, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschmulen/b600e38eeb8f06dc8ce2 to your computer and use it in GitHub Desktop.
Save mschmulen/b600e38eeb8f06dc8ce2 to your computer and use it in GitHub Desktop.
Getting StrongLoop Node On CloudFoundry

Deploying your StrongLoop Node Application on CloudFoundry

How to get started with StrongLoop Node on CloudFoundry

1.Sign up for an account https://console.run.pivotal.io/register

2.Install and configure the the cf Command Line Interface

  • OS X includes Ruby v1.8.7, which cf does not support. On OS X you must upgrade Ruby to 1.9.3 or later to run cf.
  • check out RVM
gem install cf

Target cf at the Cloud Controller for run.pivotal.io: Set your target with:

cf target api.run.pivotal.io
cf login
<email>
<password>

Choose your space When you log in, cf will prompt you to choose a space. In v2 Cloud Foundry, a space is a container for an application and all its associated processes. By default, your account has three spaces:

1: development
2: production
3: staging
<Space>

3.Create and Prepare your StrongLoop Node application on your local machine

mkdir CloudFoundryApp; cd CloudFoundryApp
slc lb api-example
cd sls-sample-app
slc install

More information on Deploying Node.js Applications on CF

cf push [appname] --buildpack=[git url]

4.Push your StrongLoop Application to the cloud

cf push my-new-app

[Pivotal Marketplace] (https://console.run.pivotal.io/organizations/64b1aa4d-4098-4540-9b09-34f383125825/marketplace) [Getting Started Docs] (http://docs.cloudfoundry.com/docs/dotcom/getting-started.html) [Pivotal Marketplace] (https://console.run.pivotal.io/organizations/64b1aa4d-4098-4540-9b09-34f383125825/marketplace)

Installing Ruby Version Manager RVM

  1. rvm with
\curl -L https://get.rvm.io | bash -s stable
  1. install and set the latest
rvm install 1.9.3
rvm use 1.9.3

Stack Over Flow article on upgrading Ruby: http://stackoverflow.com/questions/4546573/how-to-upgrade-to-ruby-1-9-2

References

https://github.com/cloudfoundry-community/strongloop-suite-buildpack

Script

Most mobile developers want to focus on the front-end of their apps and not get caught up in having to figure out how to write a backend, connect it to data sources or worse how to manage and scale it. By deploying StrongLoop’s LoopBack mobile backend-as-a-service (mBaaS) on Cloud Foundry it’s possible to take advantage of an open, private mBaaS on an open and scalable platform-as-a-service.

What is Cloud Foundry? Unlike many cloud providers, Cloud Foundry is an open source PaaS, providing a choice of supported clouds, developer frameworks and application services. Cloud Foundry makes it faster and easier to build, test, deploy and scale mobile backends like StrongLoop’s LoopBack. It is an open source project and is available through a variety of private cloud distributions and public cloud instances.

Why run LoopBack on Cloud Foundry?

If you are a mobile developer looking to develop applications that need access to data that resides in the cloud and the datacenter, there’s quite a few advantages to running your own private mBaaS in the cloud:

LoopBack is open source and extensible at its core and with the over 41,000 available NPM community modules, the possibilities are almost limitless

LoopBack is built on Node.js, so if you know JavaScript you know LoopBack

Out-of-the-box, LoopBack connects to enterprise datasources like Oracle and MongoDB

LoopBack ships with an iOS SDK, so you won’t have to compromise on functionality or inherit a steep learning curve

Cloud Foundry lets you focus on your app not machines or middleware

Cloud Foundry manages the patching, load balancing and availability of your backend

If your app needs it (and let’s hope it does!), Cloud Foundry auto-scales on demand to make sure whether you are servicing one or tens of thousands of users - everyone is guaranteed to have a stellar user experience

$rvm use 1.9.3 $cf login $slc lb project myLoopBackApp $slc lb model product $slc lb model customer $slc lb model store $slc install $mv app.js server.js

$cf push myLoopBackApp --buildpack=git://github.com/strongloop/dist-paas-buildpack.git

----- Just StrongLoop ------ slc create web myStrongNodeApp -r cd myStrongNodeApp slc install strong-agent cf login mv app.js server.js cf push myNodeApp --buildpack=git://github.com/strongloop/dist-paas-buildpack.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment