/openshift-strongloop-cartridge

My custom cartridge for OpenShift providing the lastest version of Strongloop & Node.js.

Primary LanguageCMIT LicenseMIT

strongloop openshift

StrongLoop Buildpack for OpenShift

StrongLoop provides:

  • LoopBack, an open-source Node.js framework that enables you to create dynamic end-to-end REST APIs with little or no coding. For more information on LoopBack, see http://loopback.io
  • StrongLoop Controller, a Node devops system. See StrongLoop Controller docs for more information.
  • StrongLoop Agent (StrongOps), an operational console for Node.js applications that provides deep performance monitoring including CPU profiling, event loop statistics, and more. See StrongLoop Agent docs for more information.

Follow the steps in Getting started to install Node and the StrongLoop command-line tool, then create a StrongLoop application on your local system using the slc loopback command.

Then follow the steps below to deploy the app to OpenShift.

Trying the StrongLoop sample application

Follow these steps to get started using StrongLoop on OpenShift:

  1. Login at at http://www.openshift.com/. Create an account if you don't already have one.

  2. Ensure you have the latest version of the client tools. As part of this process, you'll run the rhc setup command and choose a unique name (called a namespace) that becomes part of your public application URL.

  3. Create an application on OpenShift with the following command:

     $ rhc create-app yourapp https://raw.github.com/tsiry95/openshift-strongloop-cartridge/master/metadata/manifest.yml
    
  4. Replace "yourapp" with your application name. You'll see the message:

     Creating application 'yourapp' ... 
    

The first build will take a few minutes, so please be patient.

When it's done, you'll get a folder called yourapp (or whatever you chose for your app name) in your current path containing the LoopBack sample app . You'll see a friendly welcome:

Your application 'yourapp' is now available.

  URL:        http://yourapp-<namespace>.rhcloud.com/
  SSH to:     527...0069@yourapp-<namespace>.rhcloud.com
  Git remote: ssh://527...0069@yourapp-<namespace>.rhcloud.com/~/git/yourapp.git/
  Cloned to:  <local-path>/yourapp

Where:

  • <namespace> is your OpenShift namespace.
  • <local-path> is the path to your app's source git repository, cloned to your local system.

You can now try out the LoopBack sample application running on OpenShift:

  • View the LoopBack sample app at the indicated URL that looks like http://yourapp-.rhcloud.com/.
  • View the LoopBack API explorer at http://yourapp-.rhcloud.com/explorer/.
  • The default app with the buildpack is a basic loopback app without any user defined models or datasources. To add functionality to your app refer to Getting Started with LoopBack.

Deploying your own application to OpenShift

If you created your own LoopBack application, follow these steps to replace the default app and deploy your app on OpenShift.

  1. Add a start command to your package.json and commit it-

    "scripts": { "start": "node ." }

  2. Add your application to a Git repository.

     $ git init
     $ git add -A
     $ git commit -a -m "Initial Commit"
    
  3. Get the URL of the OpenShift app's remote Git repository by running:

    $rhc app show osapp | grep Git

Copy the Git URL from the output:

Git URL:    ssh://52a17af15004464d950003bd@openshiftapp-domain.rhcloud.com/~/git/openshiftapp.git/
  1. In your LoopBack app directory, enter this command, where <remote_git_url> is the Git URL from step 3.

    $ git remote add openshift <remote_git_url>

  2. Deploy as follows:

    $ git push --force openshift master

That's it! You can now check out your application at the app URL/domain you set for your OpenShift app.