Tuesday, April 1, 2014

Reactive Mongo pattern: Serialize Joda DateTime

I really like ReactiveMongo. That said there are not enough code examples out there. So I'm gong to try to help. Here is a simple snippet which will allow you to serialize Joda DateTime instances to MongoDB.

Grunt recipe: Deploy to remote server with SSH

I finally moved my AngularJS apps over to Grunt mostly by following a great blog post here:

Kickstart Your AngularJS Development with Yeoman, Grunt and Bower

I have several sites that I host on a DigitalOcean micro instance and I wanted to make it as easy as possible to deploy new code. First I just tried using GitHub to pull the code on my server and build it there. Unfortunately I ran into problems because my server didn't have enough memory. That's not really a great solution anyway. Instead I added a Grunt task which uses SSH to copy my dist folder to the new server and take care of the deploy steps. Here is what it looks like:

This makes use of the Grunt Shell plugin. I create a tarball of the dist directory to save space. I also modified my Grunt tasks to only package files from the bower-components directory that I needed which made the dist much smaller. I would recommend setting up public key authentication to the servers in question.