Hoodie App Tracker is now deployable to IBM Bluemix
Adding deployment options to the Hoodie’s sample app
Hoodie is a fast, simple and self-hosted backend as a service for your (web) apps. In short, Hoodie makes building Offline First apps a breeze. Plus, the Hoodie team is committed to doing wonderful work making the open source community a better place, so you can feel great about working with them.
Even better, earlier this year Hoodie announced that they have done some work to become compatible with IBM Cloudant®, which was obviously music to my ears as a Developer Advocate on IBM’s Watson Data Platform. Since Hoodie scratched our back, I thought it only fair to scratch theirs too, by doing the work to make it possible to deploy Hoodie to IBM Bluemix®. So I submitted a pull request to Hoodie’s simple sample app, App Tracker.
Aside: similar to Cloudant’s relationship with the Apache CouchDB™ community, commercial support for Hoodie is available through Neighbourhoodie Software,an IBM Business Partner.
Prepare to Bluemix
Now, to make your web app deployable to Bluemix, there are a few steps you’ll need to take to get your app compatible. To do this work for Hoodie’s App Tracker, I relied on this handy post by Bradley Holt: A Twelve-Factor App Checklist for Deploying to IBM Bluemix. Not all the steps in his checklist applied to this particular scenario, so I’d like to walk you through what I did to get a simple Hoodie app deployable to Bluemix.
All the work is already done, but if you’re curious how it could apply to your own Node.js project, I’ll describe the steps I took here. I distilled Bradley’s checklist items, which required me to make changes to Hoodie’s App Tracker and make it deployable to Bluemix:
- I had to create a
.cfignore
file so that Bluemix would know which files should not be shipped to Bluemix on deployment. Typically, this matches what lives in your.gitignore
file, but at a minimum you will want yournode_modules
directory andnpm-debug.log
files, as well as any other dependencies that get built with your app listed in your.cfignore
file. - The
.cfignore
file is something you can sometimes get away without including when deploying to Bluemix. However there are two big reasons to include it here. First, you’d be deploying several files that should really just stay in your local development environment. Second, and probably the biggest reason, is that Bluemix won’t install your npm modules and instead will just ship whatever happens to be in thenode_modules
directory in your local development environment. - To fulfill a Bluemix requirement for this application, I needed to add a
Procfile
. You wouldn’t normally need aProcfile
for a simple application, as without it Bluemix will automatically create one for you. However, for this application it needs to populate the value for thehoodie_dbUrl
environment variable to populate the CouchDB URL, so making it ahead of time was important. - Lastly, Bluemix has a fancy one-click button that you can utilize on your projects to make it easy-peasy to deploy. To be able to enable this button, your project must include the
manifest.yml
file. To get around using the manifest file (which contains a non-unique name), the manual Bluemix deployment instructions require two additional steps:
- Provide a unique application name as a parameter for
cf push
- Manually bind the
hoodie-app-tracker-cloudant-service
service
Lemon Squeezy
Now you can easily deploy Hoodie’s App Tracker example to Bluemix, manually or automatically using the Deploy to Bluemix button. It took a little finagling to figure out the correct port info for the Procfile
, and you can see what I did by reviewing the final commit. If you’d like to deploy your own version of App Tracker, Hoodie describes all your options for deployment, including the Bluemix instructions.
The commit above was, in fact, my first major open source contribution. I must say that Hoodie was a wonderful project to work with. If you are curious about getting involved with an open source project, I would highly recommend you start with Hoodie because they are professional, welcoming, and oh so friendly!
Stay tuned as I’ll be writing more about my experience contributing #myfirstpr to Hoodie.
If you enjoyed this article, please ♡ it to recommend it to other Medium readers.