Continuous Integration in the Cloud: Comparing Travis, Circle and Codeship

Continuous Integration (CI) is an essential part to any modern development process. Gone are the days of monolithic releases with massive changes, today it’s all about releasing fast and often. Most teams have come to rely on some sort of automated CI system. In this article we are going to talk about some of the benefits of CI and how it fits into small, medium and large projects followed by a quick overview of three different hosted CI services and how they apply to projects of various sizes.

Continuous Integration

Wikipedia defines Continuous Integration as

… the practice, in software engineering, of merging all developer working copies with a shared mainline several times a day.

Continuous Integration is very frequently accompanied by Continuous Delivery/Deployment (CD) and very often when people talk about CI they refer to both.

CI relies on two main principles:

  1. Changes are merged to main source branch as often reasonably possible. The tasks are explicitly split up in such a way so that to avoid creating gigantic change sets.
  2. Each change is fully tested. Automated testing is the cornerstone of CI. In a team environment, and even on a personal project, it’s nearly impossible to insure that latest changes don’t break existing code without tests. Every time a change set is merged to master, CI runs entire suite to guarantee nothing was impacted negatively.

Open Source Projects

If you have an open source project, whenever it’s a tiny NPM module or a large application, if it’s publicly hosted on GitHub or BitBucket and has automated tests, you can take advantage of CI right away. You will immediately see some benefits:

  1. Each time you push new changes, CI will pull your latests code, build, configure and run your tests in a clean environment. This means that if you forgot to commit a required library for example and the tests pass locally, they will fail on CI letting you know about the omission.
  2. At a minimum you could show your users on the README page that you have a passing build. At best, if you have hooked up a Code Coverage tool you could show how much of the code is exercised by the automated test.

The configuration for CI in such projects is generally boils down to installing dependencies and running the tests. Any self-respecting hosted CI provider can handle this type of projects and given that majority of open source libraries are maintained by a sole developer, the builds for such projects don’t need to be happening very often nor they are very complicated.

In an effort to support and give back to open source, some CI providers offer free plans for open source projects. So if you have been working on one and don’t yet have CI hooked up, I recommend doing that right after finishing the article. You might have seen these build passing badges around GitHub. After setting up your project with a CI provider, you can then add a badge to the README file via shields.io to proudly show of your passing build.

Read more

How to Deploy a Node.js REST API Server on Red Hat’s OpenShift

The world is moving toward the cloud—both public and private clouds—and infrastructure demands are giving rise to a new generation of integration platform-as-a-service (iPaaS) API servers which specifically handle this use case with the added dimension of cloud versus your own datacenter. Node.js is powering these new iPaaS products because it’s dynamic, highly scriptable, and high-performance. Node hits the sweet spot because it enables developers to glue together disparate pieces of legacy infrastructure and quickly surface an API for next-generation web and mobile applications. Ultimately, it promises to address the emerging requirements for the internet of things (IoT).

What is OpenShift?

Openshift

OpenShift is one of the most popular PaaS (Platform as a Service) provider used by developers worldwide. OpenShift supports Node.js and StrongLoop API server platforms with default built in cartridges.

StrongLoop API Server highlights

For organizations looking to leverage OpenShift for their omni-channel API / ESB initiatives, StrongLoop’s API Server offers many advantages:

  • On-premise – take control of your BaaS  and run it in your datacenter or on your own cloud infrastructure
  • Powered by LoopBack – the leading, open source API framework project built 100% in Node.js
  • Built in mBaaS with Push , Geopoint , Social Login, Storage, etc
  • Offline sync – isomorphic JavaScript front to back with conflict resolution and a variety of sync algorithms supported
  • Replication – client to server, server to client, app to app and database to database
  • Connectors to interface and autodiscover new and existing datasources including RDBMS, NoSQL and proprietary backends
  • Controller to automate DevOps tasks like clustering, debugging, log management, build and deploy
  • Monitoring to provide deep application performance visibility and deep profiling in production

Here’s how to get started with Openshift and StrongLoop in four simple steps…

Read more

Installing Node.js Monitoring and an API Server on Elastic Beanstalk

In this quick write up we are going to show you how to get LoopBack, an open source API server and StrongOps, a Node performance monitoring and cluster manager, up and running on Amazon’s Elastic Beanstalk.

What is Elastic Beanstalk?

With AWS Elastic Beanstalk, you can quickly deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs those applications. AWS Elastic Beanstalk reduces management complexity without restricting choice or control. You simply upload your application, and AWS Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.

If you are new to Amazon Web Services, you can sign up here and check out their free tier.

Ok, let’s get started…
Read more

Install Node.js monitoring and a mobile backend on Nodejitsu

In this quick write up we are going to show you how to get  LoopBack (open source mobile backend) and StrongOps (Node performance monitoring and cluster manager) up and running on Nodejitsu.

What is Nodejitsu?

Nodejitsu is a simple and reliable hosting platform for Node.js apps. The platform has a few great things going for it:

If you want to watch a quick 2 minute video to see how StrongLoop is installed via npm, check this out:

Assumption: You already have Node running locally

If you don’t already have Node installed, you can download the latest version from nodejs.org for your particular platform.

Step 1:  Install the StrongLoop Command Line Interface (cli) locally

$ npm install -g strong-cli

Note: If you get permission errors, re-run commands with sudo

Step 2: Verify your installation

$ slc version

Step 3: Install the sample LoopBack application

$ slc example
$ cd sls-sample-app

Step 4: Install and setup the StrongOps agent

$ slc strongops --register

Step 5: Provide your full name, email and password when prompted.

 

Step 6: Create a StrongLoop account to access your StrongOps dashboard

Go to https://strongloop.com/register/

Note: Use the “email” you provided in Step #5 as your “email” plus use the same ”password”.

Step 7: Your dashboard is ready here:

http://strongloop.com/ops/dashboard

Note: You will not see any data until your application has been running for a few minutes. So, please make sure to execute the next step.

 

heap_memory

 

 

Step 8: Explore the sample application by running it and then visiting the URL below:

$ slc run .

To view the LoopBack sample application go to the browser and open up localhost (0.0.0.0), specifying port 3000 like so:

http://localhost:3000

Now, let’s stop the sample app and deploy it on Nodejitsu!

 

LoopBack API Explorer

Step 9: Sign up for Nodejistu

 

https://www.nodejitsu.com/signup/

 

Step 10: Install the jitsu command line tool (CLI)

$ [sudo] npm install jitsu -g

Step 11: Execute the user confirmation command and code you got in your sign up email.

 

It should look something like…

$ jitsu users confirm [user name] [a bunch of numbers and letters]

Step 12: Login

 

You’ll be prompted for your password to login.

 

Step 13: Deploy the StrongLoop sample application to Nodejitsu

 

Inside of the sls-sample-app directory execute:

$ jitsu deploy

You’ll get prompted for a subdomain name, make it a good one!

 

Next, you’ll get prompted for a Node engine. I picked what was offered, 0.10.x and confirmed the selection.

 

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.

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.

You should also be able to go back to your StrongOps dashboard and view your app on Nodejitsu being monitored.

If you run into any issues, normally an application restart gets things back in order. To do this, execute:

 

$ jitsu list

…to see the status of your apps. Then restart the one you want by executing:

 

$ jitsu apps restart [name of app]

 

To stop your app, execute:

 

$ jitsu apps stop [name of app]

 

Redeploy an app (executed from with your apps folder) with:

 

$ jitsu apps deploy

 

And finally, if you’ve made total scrambled eggs of things, you can destry an app with:

 

$ jitsu apps destroy [name of app]

Questions?

You can get Nodejitsu specific questions answered here. StrongLoop questions you can get answered in a variety of ways including StackOverflow and Google Groups. Here’s how to interact.

 

Install Node.js, LoopBack and StrongOps on Digital Ocean

In this quick write up we are going to show you how to get Node.js, LoopBack (open source mobile backend) and StrongOps (Node performance monitoring) up and running on Digital Ocean.

What’s Digital Ocean?

The tagline “Digital Ocean provides blazing fast SSD cloud servers at only $5/month” does not do cloud provider Digital Ocean justice.

In addition to the performance of the server instance (a droplet in Digital Ocean lingo), Digital Ocean has become a favorite of developers for the following reasons:

  • low cost performance
  • Droplets standup fast, very fast ( 59 seconds fast )
  • Static external IP address for every droplet
  • Droplet’s disk, RAM, and IP address are all reserved while the droplet is off
  • Snapshot feature allows you to save the droplet after you have destroyed the instance.
  • Preserving costs and making for a fast standup of your configuration for developer Sandbox preserving costs)
  • You will be able to create a new droplet from the snapshot image anytime to bring it back online.

For the purposes of these installation instructions we’ll be installing on a 512 MB RAM, Ubuntu 12.04 ”Droplet”. However, because all StrongLoop components are all installed via npm, if you already have Node installed you are good to go, regardless of the OS.

If you want to watch a quick video on how it all goes down in about 2 minutes, check out this video:

Step 1: Sign up for Digital Ocean if you haven’t already

 

Step 2: Install the latest version of Node

There’s a couple of different ways to install Node.js, but here’s one that is pretty straight-forward and will get you up and running quickly. Some alternatives are discussed here.

Log into your Droplet and run:

$ sudo apt-get update
$ sudo apt-get install python-software-properties python g++ make
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs

Step 3: Check your version of Node

$ node -v
v0.10.24

Step 4:  Install the StrongLoop Command Line Interface (cli)

$ npm install -g strong-cli

Note: If you get permission errors, re-run commands with sudo

Step 5: Verify your installation

$ slc version

Step 6: Install the sample LoopBack application

$ slc example
$ cd sls-sample-app

Step 7: Install and setup the StrongOps agent

$ slc strongops --register

Step 8: Provide your full name, email and password when prompted.

 

Step 9: Create a StrongLoop account to access your StrongOps dashboard

Go to https://strongloop.com/register/

Note: Use the “email” you provided in Step #5 as your “email” plus use the same ”password”.

Step 10: Your dashboard is ready here:

http://strongloop.com/ops/dashboard

Note: You will not see any data until your application has been running for a few minutes. So, please make sure to execute the next step.

 

heap_memory

 

 

Step 11: Explore the sample application by running it, starting a small load generator and then visiting the URL below:

$ slc run .
$ slc run bin/create-load.js

To view the LoopBack sample application go to the external facing IP that Digital Ocean assigned to your Droplet plus specifying post 3000 like so:

http://[Your Droplet’s IP]:3000

LoopBack API Explorer

Questions?

You can get them answered by the development team in a variety of ways including StackOverflow and Google Groups. Here’s how to interact.