Why I Have Started To Embrace The Command Line

Last night my tweet inspired a debate on Twitter about the use of the command line.  Oddly enough I was in a meeting with a customer yesterday and due to some problem I encountered during my demo I had to open the command line.  Once I did this he immediately asked me “Do I need to use the command line?”.  (As a side note the person who asked this question was not a developer or system admin.)   In addition a few weeks ago at MWLUG, Nathan Freeman, who I have the utmost respect for as a person and a developer, stopped me in the middle of my presentation and told me he was completely lost because I was using the Git CLI.  So with so much talk about my use of the command line I figured I would explain why I use it.

It was not long ago that I was not a fan of the command line.  Being a Java developer I lived in Eclipse.  Eclipse did everything for me, it generated code for me, it had type ahead, it would build my code, and I could even run and debug my code….everything I needed in one place.  I knew that I could do all of this outside of Eclipse using various text editors and command line tools, but why would I?  Then one day at work we decided to use an Apache project for one of the projects we were working on.  When I looked at the project documentation they stated they were using Maven to manage the project.  Doing some Googling I found instructions on how to install Maven and realized it was a command line tool, my first thought was “YUK”!  Being an Eclipse lover I immediately Googled to see if there was a plugin for Eclipse and there was, the plugin was called M2Eclipse.  Hallelujah, I could continue to live in Eclipse.  Eventually though I ran into a problem with the Apache project where the Eclipse Maven tools were failing to build the Apache project and I had to use the command line tools.  I bit the bullet and installed the Maven CLI so I could continue to do my work.

Not to long after that I started to use Git.  Again the Git CLI seemed hard for me, I wanted something for Eclipse.  There is a nice Git plugin for Eclipse (or even better something like SourceTree) so again I was able to avoid the command line.  However I noticed something else the more I looked at GitHub projects.  They all said “To get the code run $ git clone https://github.com/myrepo.”  None of them referenced using an IDE to clone the git repo.  I also noticed some projects taking things one step further tell you to run “git clone https://github.com/myrepo” and then run something like “mvn -P run” and that would clone, build, test and deploy code on an embedded web server (not all projects have this functionality).  This is when things started to click for me.  Think about if you wanted to do the same thing with something like Eclipse.  You would have to start Eclipse, clone the git repo, setup a debug configuration to run my maven build, setup a Tomcat server in Eclipse, add the war the maven build produced to your Tomcat configuration, and then start Tomcat from Eclipse.  You could run “mvn -P run” from within Eclipse as well and use the embedded web server from within Eclipse eliminating the need to setup and configure Tomcat but I would argue that you are now eliminating the need for using Eclipse, but it is certainly a valid argument.  If all you want to do is run the application, why go through all the work of using an IDE when you can have the app up and running using the command line by the time your IDE starts?  I have embraced this pattern in my own projects, so much so that I have created projects that can be cloned, built, tested, and deployed to the cloud with 2 commands from the command line.

I can understand those who view the command line as a step backward in simplicity.  You have to remember commands, you can easily screw things up when typing them, installation of command line tools can be a pain, I understand all of this and have been bitten by them many times.  However, the productivity gains you can get are tremendous.  I am not saying the command line is the only option, in fact I don’t exclusively use the command line, there are many times where I still go back into Eclipse.  Recently though I have integrated the command line into my developer toolbox and I have found that it has made me more productive than I was before.  If you are not a command line user today I hope you consider using some command line tools in the future and don’t try and avoid them.  If you spend some time upfront learning the tool I am sure you will find it only makes you a better developer.

Using Your Domino Data In Apps Deployed To Bluemix

Over the past few weeks I have done presentations on Bluemix at two ICS user groups, MWLUG and ICONUK.  I did pretty much the same presentation at both mainly focused on introducing developers to Bluemix.  Obviously, since these user groups are focused mainly around ICS, there is interest in how Domino and XPages fits into the Bluemix story.  Well as of right now you cannot deploy your XPages apps to Bluemix.  However, Kramer Reeves announced at MWLUG that ICS is investigating how to make this dream come true.  As we all know an investigation is no guarantee, so what is a Domino developer to do in the mean time?  While you can’t deploy your XPage applications, there is no reason why you can’t use the data stored in your NSFs.  You just need to use another runtime, such as Java, Node.js, Ruby, PHP, or any other runtime Bluemix supports, to build the front end and business logic of your application.

So how do you do it?  Well you start by familiarizing yourself with Domino Access Services.  Domino Access Services (DAS) essentially allows you to access and manipulate the data within your NSFs over HTTP using REST.  The good thing about DAS is that you can get this functionality without having to write any code.  You essentially enable DAS on your Domino server and then enable it on the NSFs you want to access over HTTP.  This is all spelled out in the documentation that can be found here.  Once you have DAS enabled any application that has an internet connection can access and manipulate the data within your NSF, this includes mobile apps, web apps, or any app deployed to Bluemix as long as the Domino server is accessible to the public internet.  All you need to do is make HTTP requests.

However there are many situations where your Domino server many not be accessible to the public internet, what do you do then?  Your first instinct might be to try to setup a VPN connection.  Well that is not possible with Bluemix because Bluemix is a PaaS.  You can’t even SSH into the machine your app is running on in Bluemix never mind setup a VPN connection.  The good news is that there is a service in Bluemix called Cloud Integration that you can use to connect to pretty much any server that might be running on a private network or be behind a firewall.  I wrote a separate blog post on using this service, you can read more about it here.  By using the Cloud Integration service in Bluemix you can then use the REST APIs on your Domino server from your Bluemix application even if those REST APIs are not exposed to the public internet!  Pretty cool stuff.

To demonstrate this I have created a short video showing you how.

 

 

 

 

 

 

 

 

 

In addition my session from MWLUG was recorded, so you can watch that as well.

 

 

 

 

 

 

 

 

Finally you can find my slides from MWLUG on SlideShare.

Deploying Your Hybrid Cloud Apps Has Never Been Easier With Bluemix

Public clouds are great.  They offer great elasticity and cost savings, and in the case of a PaaS like Bluemix, allows us (developers) to forget about maintaining any infrastructure and focus in on our code.  However we all realize that public cloud can’t be used for everything.  There are some applications and services that must remain in our own data centers on private networks.  The reasons why vary, maybe it is too much work to move the resource to the cloud, or maybe the data in the resource is too sensitive to risk exposing outside of your firewall.  Whatever the reason may be, you are bound to come across a scenario where you need to access private resources in your public cloud applications.  What are your options?  One option is to try to setup some type of VPN and create a secure connection between the public cloud and your private network.  This is probably the route to take if you are using an IaaS provider like SoftLayer to run your application.  With a PaaS this is not possible, you don’t have access to the machine your application is running on or the network it is using, so if you choose Bluemix to deploy your application what are your options?

Luckily Bluemix has a solution for this problem and it is called Cloud Integration.  The Cloud Integration service uses something called secure connectors to talk securely to your applications running behind the firewall.  These secure connectors run behind your firewall and establish a tunnel to the Cloud Integrations service (or Cast Iron Live).  The key here is that it is the secure connector is establishing the connection to the Cloud Integration service in Bluemix and not the other way around (this works on the premise that your servers running behind the firewall can talk to servers running in the cloud while servers in the cloud cannot talk to servers running behind your firewall.)  Once the Cloud Integration service knows about your server via the secure connector and a tunnel is established, your Bluemix app can use the Cloud Integration service to access data from your server behind the firewall.  Out of the box the Cloud Integration service has secure connectors for DB2, Oracle, and SAP, however you can use Cast Iron Live to connect to a wide range of services on a private network.

I make it sound very simple above, and it is, but your need to understand how everything works to make it click :)  Below is a number of videos walking through how you can use the Cloud Integration service to expose REST APIs behind your firewall to an app running in Bluemix.  I chose REST APIs because it is something almost every developer is familiar with and has not ties to a specific language or stack.  Anyone can write REST APIs in their favorite language to expose the data the need to their cloud based applications.

Creating A Secure Connector

Creating Your Orchestrations

Using Your Cloud Integration APIs In A Bluemix App

 

Bluemix Session At MWLUG

mwlug2014_banner

 

Tomorrow I will be heading out to Grand Rapid MI to attend and speak at MWLUG (Midwest Lotus User Group).  If you are attending and would like to learn more about Bluemix, IBM’s new platform for deploying applications to the cloud, be sure to stop by my session at 11AM on Thursday.

Achieving Developer Nirvana With Codename BlueMix
BlueMix is a platform for composing and running virtually any application in the cloud without having to worry about the hardware, software, and networking needed to do so. This means that developers can be left to do what they do best….CODE! By eliminating the need to deal with the infrastructure typically required to deploy an app to the cloud, and providing a catalog packed with services from IBM and its partners, BlueMix allows developers to get their apps in the hands of their users with the lightening speed, quality and innovation their users demand. It doesn’t matter if your next app is targeting web, mobile, or the internet of things, you too can achieve developer nirvana with BlueMix, and it all starts by attending this session!

Unlike most of the other sessions at the conference, mine is not directly related to IBM Collaboration Solutions, however I do have a nice surprise to tie things back to the ICS community.  There is no reason why you can’t deploy applications to Bluemix that use products from ICS ;)  I am not going to give you the details here, you have to come to my session to find out!!!

Webinar: Building Highly Scalable Applications With Bluemix

The elasticity of the cloud is a huge selling point for most developers when considering where to deploy their applications.  The ability to add and remove instances of your application based on the load against it saves you a lot of time and money.  However you can’t just deploy any application to the cloud and expect it will behave properly when scaled horizontally.  In fact, if you didn’t think about scalability when building your application chances are your application will break when scaled.

Luckily if you keep scalability in mind when building your application there are a number of patterns you can use to make sure your application will scale flawlessly in the cloud.  On August 19th I will be hosting a webinar going over many of these patterns and how you can use them when building your next cloud application.  You can register for the webinar here, and join your fellow developers on August 19th to learn how to build applications that scale.

Build a REST API For Your IoT Data Using MongoDB, Node-RED, and Bluemix

In my previous post I talked about how to use the IBM IoT Cloud and Bluemix to build apps based on data coming from an TI Sensor Tag.  One of the apps I showed was Node-RED, however it was very basic in that it only printed the data to a debug node.  In this video I show you how you can store that data in a MongoDB and create a REST API for the data all in Node-RED without writing any code!  Enjoy!

Bluemix ToDo App Updates

The ToDo apps for Bluemix was one of the first sample projects I published after becoming a developer advocate for Bluemix.  Even though the apps are simple, I still think they are some of the most meaningful samples we have.  Today I have made them even better ;)  Since Bluemix went GA we introduced the MongoLab service and an enhanced Cloudant service.  I have decided to change the ToDo apps so they take advantage of both of these new services.

Why change something that is already good?  The old community Mongo service was unreliable, it sometime lost connections with the app, and it was so popular that it was often running out of space to create new DBs.  The old Cloudant service was essentially a user-provided service.  This meant you had to go out to Cloudant signup for an account, create a database, and get an API Key and Token before you could even deploy a ToDo app that used Cloudant.  This was a huge pain.

With the new MongoLab service you get a reliable, production quality Mongo DB :)  Plus you also have the benefit of using the MongoLab console to see the contents of your DBs.

The new Cloudant service now automatically generates an API Key and Token for you when you create the service.  No more having to leave Bluemix to signup for Cloudant and all the ugly stuff :)

I have updated the Bluemix ToDo apps (all languages) to use both of these new services.  Hopefully this makes something that was already good even better, enjoy!