-
-
Save mschmulen/8240089 to your computer and use it in GitHub Desktop.
#Heroku prereq http://heroku.com/ & http://toolbelt.heroku.com/
-
$heroku login
-
make your app
mkdir YourApp;
cd /yourApp;
git init;
git add .
git commit -m "first"
git remote add origin [email protected]:mschmulen/strongnode-simple-web.git
git push -u origin master
- configure for herok, add a Procfile
echo "web: slc run app.js" > Procfile
git add Procfile
git commit -m "added procfile" Procfile
- add the buildpack in your app
heroku apps:create --buildpack https://github.com/strongloop/dist-paas-buildpack.git
- push to heroku
git push heroku v1.2:master
heroku ps:scale web=1
- open browser to heroku app
heroku open
##notes ? Configure StrongOps
#heroku config:get STRONGLOOP_KEY
changed Line 26 of "modules/app/index.js" file in loopback sample: from var server = app.listen(config.port || 3000, function (err) { to var server = app.listen(process.env.PORT || config.port || 3000, function (err) { Then it works fine on cf now.
###Create your StrongLoop App on your local machine:
- Install the StrongLoop Command Line Interface (cli)
npm install -g strong-cli
Note: If you get permission errors, re-run commands with sudo - Verify your installation
slc version
- Install the sample LoopBack application
slc lp project myNodejitsuApp
and cd into the projectcd myNodejitsuApp
- Install and setup the StrongOps agent
slc strongops --register
- Provide your full name, email and password when prompted. You can create an account here strongloop.com/register/ if dont have one.
- Start your StrongLoop Node app by running it with
slc run .
- Explore your StrongLoop Node application from the browser. Open up localhost (0.0.0.0), specifying port 3000 [http://localhost:3000] (http://localhost:3000 ) .
- Access your StrongOps dashboard strongloop.com/ops/dashboard Note: You will not see any data until your application has been running for a few minutes.
Let’s stop the sample app and deploy it on Nodejitsu!
###Deploy it on Nodejitsu:
- Sign up for Nodejistu nodejitsu.com/signup/
- Install the jitsu command line tool (CLI)
npm install jitsu -g
- Execute the user confirmation command
jitsu users confirm [user-name] [a-bunch-of-numbers-and-letters]
using your username and code you got in your sign up email. - Follow the login prompts
info: Confirming user mattschmulen
info: Great success! mattschmulen is now confirmed.
info: User mattschmulen confirmed
info: Log in now?
prompt: (yes/no): (yes) yes
info: Attempting to log in as mattschmulen
prompt: password:
info: Authenticated as mattschmulen
info: Nodejitsu ok
- Deploy the StrongLoop sample application to Nodejitsu. Execute:
jitsu deploy
from Inside of the myNodejitsuApp directory - You’ll get prompted for a subdomain name, make it a good one!
prompt: Subdomain name: (mattschmulen-myNodejitsuApp)
prompt: engines.node: (0.10.x)
- Confirm your configuration
warn: About to write /Users/matt/scratch/myNodejitsuApp/package.json
data:
data: {
data: dependencies: { loopback: '~1.1.0' },
data: description: '',
data: engines: { node: '0.10.x' },
data: main: 'app.js',
data: name: 'myNodejitsuApp',
data: optionalDependencies: { strong-agent: '~0.2.15', strong-cluster-control: '~0.1.0' },
data: scripts: { start: 'node app.js' },
data: subdomain: 'mattschmulen-myNodejitsuApp',
data: version: '0.0.0'
data: }
data:
prompt: Is this ok?: (yes)
- At this point Nodejitsu will do a few checks, upload your app and then give you a URL and port assignment where you can view it.
info: Analyzing application dependencies in node app.js
info: Checking app availability myNodejitsuApp
info: Creating app myNodejitsuApp
info: Creating snapshot 0.0.0
info Uploading: [=============================] 100%
info: Updating app myNodejitsuApp
info: Activating snapshot 0.0.0 for myNodejitsuApp
info: Starting app myNodejitsuApp
info: App myNodejitsuApp is now started
info: http://mattschmulen-mynodejitsuapp.nodejitsu.com on Port 80
info: Nodejitsu ok
-
You should note that locally, the LoopBack sample application if configured by default on port 3000, while Nodejitsu deploys the app by default on 80. in my case the endpoint url is http://mattschmulen-mynodejitsuapp.nodejitsu.com
-
You should also be able to go back to your StrongOps dashboard strongloop.com/ops/dashboard and view your app on Nodejitsu being monitored.
###A Few additional tips:
- If you run into any issues, normally an application restart gets things back in order. To do this execute:
jitsu list
- Stop your app with
jitsu apps stop [name-of-app]
- Once you make local modifications you can redeploy your app via
jitsu apps deploy
- To see the status of your apps. Then restart the one you want by executing:
jitsu apps restart [name of app]
- Destroy your app with
jitsu apps destroy [name-of-app]
- You can take your app through its paces by running the load generator
slc run bin/create-load.js
instead ofslc run .
- You can debug your application by running
slc debug app.js
#Red Hat OpenShift prereq www.openshift.com & https://www.openshift.com/developers/rhc-client-tools-install requires Ruby (1.9 ) rvm use 1.9.3 $ gem install rhc
-
Create an account at openshift.com and make sure you have the latest version of the cli.
-
Create your LoopBack node application with StrongLoop Suite:
$ rhc create-app myLoopBackApp https://raw.github.com/strongloop/openshift-cartridge-strongloop/master/metadata/manifest.yml
$ rhc create-app myLoopBackApp https://raw.github.com/strongloop/openshift-cartridge-strongloop/master/metadata/manifest.yml mongodb-2.2
** currently the default configuration for the cartridge is for the a strongloop web app, to configure for loopback
- rename app.js to server.js
- configure the loopback server to use the
- slc install loopback-datasource-juggler
chage myloopbackApp/modules/app/index.js LINE 26 With the following (
var server = app.listen(process.env.OPENSHIFT_SLS_PORT || process.env.PORT || 3000, process.env.OPENSHIFT_SLS_IP || '0.0.0.0', function (err) {
Configure modules/db/index.js
/*!
- An in-memory DataSource for development. */ var loopback = require('loopback');
module.exports = loopback.createDataSource({ connector: require('loopback-connector-mongodb'), host: process.env.OPENSHIFT_MONGODB_DB_HOST database: "myloopbackapp", username: "admin", password: "JcjnbIkNJxaw", port: process.env.OPENSHIFT_MONGODB_DB_PORT });
/* module.exports = loopback.createDataSource({ connector: loopback.Memory }); */
Additionally the https://github.com/strongloop/openshift-cartridge-strongloop cartridge needs to be changed at
https://github.com/strongloop/openshift-cartridge-strongloop/blob/master/bin/control#L86
https://github.com/strongloop/openshift-cartridge-strongloop/blob/master/bin/control#L109 needs to be slc not
Additonally the https://github.com/strongloop/openshift-cartridge-strongloop/blob/master/bin/control#L117 hot deploy with supervisor , has performance issues. ??? if we really want to run supervior there is a tweek on the origin server that changed the poll time to make it more performant .
reference bugs bugzilla reference https://bugzilla.redhat.com/show_bug.cgi?id=1010464
https://bugzilla.redhat.com/show_bug.cgi?id=1010461
** Make sure and check out http://cartreflect-claytondev.rhcloud.com/ for reflect infor ... this is scaling ???
rsh ssh
echo
$slc install
When it's done, you'll get a folder 'yourapp' with sample app in your current path, and you should see a friendly welcome:
http://yourapp-$namespace.rhcloud.com
- Configure your LoopBack node server and add custom models
$ cd myLoopBackApp $ slc lb project loopBackProject $ cd loopBackProject $ slc install $ slc lb model product
- Verify your installation on your local dev machine. $slc run app.js
Open a browser to the LoopBack explorer http://localhost:3000/explorer
Using StrongLoop Suite on OpenShift
- Deploy to the Red Hat OpenShift PAAS
It's quite easy getting access to all StrongLoop CLI tools. Just ssh into the app you just created:
$rhc ssh yourapp
This will get you into your cloud app.
Explore the documentation and the
Quick Start sections for Loopback, StrongNode and StrongOps.
Start Server, receive Open Node MBaaS
Now that you're newly created StrongLoop server is up on the . Lets take a look at what you get.
Now that we have our machine provisioned and accessible from a public iP address, you can configure a native mobile application to user your custom LoopBack mobile API’s.
Some simple examples can be found at https://github.com/strongloop-community/loopback-examples-ios, the easiest to get started with is a simple native iOS UITableView https://github.com/strongloop-community/loopback-examples-ios/tree/master/ios-tableview-simple-example .
You can configure the table view to pull data from your newly created API by:
- clone the repo locally
$mkdir ~/iosClientSample ; cd ~/iosClientSample $git clone [email protected]:strongloop-community/loopback-examples-ios.git $ cd loopback-examples-ios
- open the UITableView sample in XCode project
$ open /ios-tableview-simple-example/tableview-example.xcodeproj
-
configure the adapter located in the AppDelegate.m to point to your hosted IP address instead of the local http://localhost:300 address
-
command + R will start the iPhone simulator and connect to your private mobile backend on OpenShift.
sample-examples-ios-all
Once the iPhone simulator is running you will be able Create, Read, Update and Delete model instances on on your OpenShift server. You can to verify your mobile actions with the Loopback API Explorer by opening up the browser at http://YOURAPP.rhcloud.com:3000/explorer and expand the 'products' GET and
LoopBack-Explorer-Products-Post
- configure rhc
rhc setup
- make your app
$ rhc create-app myLoopBackApp https://raw.github.com/strongloop/openshift-cartridge-strongloop/master/metadata/manifest.yml
When it's done, you'll get a folder 'yourapp' with sample app in your current path, and you should see a friendly welcome:
http://yourapp-$namespace.rhcloud.com
- Configure your LoopBack node server and add custom models
$ cd myLoopBackApp
$ slc lb project loopBackProject
$ cd loopBackProject
$ slc install
$ slc lb model product
- Verify your installation on your local dev machine. $slc run app.js
mkdir YourApp;
cd /yourApp;
git init;
git add .
git commit -m "first"
git remote add origin [email protected]:mschmulen/strongnode-simple-web.git
git push -u origin master
changed Line 26 of "modules/app/index.js" file in loopback sample: from var server = app.listen(config.port || 3000, function (err) { to var server = app.listen(process.env.PORT || config.port || 3000, function (err) { Then it works fine on cf