Tuesday, April 1, 2014

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.


  1. The present pattern of Mobile websites require some refined web structures to meet the aggressive needs of clients. The web structures which have hearty highlights and functionalities can bolster the intricate situations have gained the first class positions in "web developers in uk" classification.

  2. When running a business, you need to think about how to appropriately advance it. In the event that individuals aren't mindful of your items or administrations, at that point they can't get them. On the off chance that you need to separate yourself from your opposition, attempt video developers in uk.