Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
echo "--> Selecting Node version $NODE_VERSION"
. $HOME/.nvm/
echo "--> Installing libraries..."
npm install
echo "--> Exporting Foreman files..."
node_modules/.bin/nf export -o /etc/init
echo "--> Restarting..."
stop foreman
start foreman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment