Getting started for a hackathon with Bluemix
This weekend I planned to show up at the Swiss Re Hackathon. I hope to learn something new and god willing create something interesting!
I've loved the traditional IBM Watson stuff and have tried to play around with it quite a bit. I still think it has a long way to go and the application isn't yet upto the point of accuracy needed to make something really useful! (I hope I am wrong!).
However, IBM recently made quite a few acquisitions of quality products and rolled them up into the Watson Umbrella! I felt the new gamut of apps available to be comprehensive and mature enough to play with them again! This hackathon presents an opportunity to try that out along with meeting some great people!
The IBM team put together some very useful presentations and a great introductory video talk!
Getting Started
Now, let us look at creating a sample app using Cloud Foundry! Installation is straight forward. Download the installer from the releases page and you are all set!
I plan to use Meteor, so everything hereon will be Meteor focussed!
Let's first create a sample app:
Create the sample app
meteor create --example todos
Connect to Bluemix
cf api https://api.ng.bluemix.net
Login to Bluemix
Replace with the user credentials
cf login -u santosh@mypad.in -o santosh@mypad.in -s dev
Push the app without starting
cf push meteor-todos -b https://github.com/cloudfoundry-community/cf-meteor-buildpack.git --no-start
I ran into this nasty error!
A bit of research, showed me the way out! See Tip #3 in this post!
I needed to a .cfignore
file in the root directory of the application. Add the below line to the file and you should be ready to go!
.meteor/local/
.cfignore
is similar to .gitignore
. The cf
tool ignores the folders or files!.
This is actually very important! Look at the file sizes uploaded before and after! The entire local build directory does not need to be uploaded!
Before .cfignore
After .cfignore
Note the difference! The upload needed reduced from 13.3M to 521.9K!
Create the MongoDB instance
Now, we need to create the MongoDB instance the app can bind to!
cf create-service mongodb 100 todos-mongodb
Now, we need to attach the service
cf bind-service meteor-todos todos-mongodb
Start the Meteor application
cf start meteor-todos
That's it! The meteor app was up and running at http://meteor-todos.mybluemix.net
Questions / Research Queue
- Can I dynamically scale Bluemix to use Memory upto a certain point? (i.e. instead of having a reserved allocation of memory)
- Scaling applications in IBM Bluemix
- Auto-Scaling in IBM Bluemix - YouTube
- Dynamic Cloud - Enterprise Integration in IBM BlueMix - YouTube
- Handle the Unexpected with Bluemix Auto-Scaling - Bluemix Blog
Resources
- cloudfoundry-community/cf-meteor-buildpack: Cloud Foundry Meteor Buildpack
- Buildpacks · cloudfoundry-community/cf-docs-contrib Wiki
- Deploying Meteor Apps to Cloud Foundry – Managing Software Debt
- (Video) - Deploying your Meteor app to Cloud Foundry and Bluemix -- JeffSloyer.io
- Tips for running Meteor.js on Bluemix - Bluemix Blog
- Use Bluemix For Nasa Space Apps Challenge
- Similar services:
- indico | powerful developer-friendly machine learning