Skip to content

Instantly share code, notes, and snippets.

@grownseed
Last active December 10, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grownseed/4507657 to your computer and use it in GitHub Desktop.
Save grownseed/4507657 to your computer and use it in GitHub Desktop.
Installing Haibu for Node.js deployment

Haibu Install (CentOS)

Install Node/NPM

su - 
yum install openssl-devel gcc-c++
cd /usr/local/src
wget http://nodejs.org/dist/v0.8.17/node-v0.8.17.tar.gz
tar zxvf node-v0.8.17.tar.gz
cd node-v0.8.17
./configure && make && make install

Install Haibu

npm install haibu -g

Haibu config

Create /usr/local/lib/node_modules/haibu/config/config.json with the following contents:

{
  "log": {
    "logAll": true,
    "namespaces": {
      "drone": "user",
      "git": "haibu",
      "npm": "haibu",
      "plugin": "haibu",
      "repo": "haibu",
      "spawn": "haibu",
      "tar": "haibu",
      "user": "user",
      "error": "errors"
    },
    "console": {
      "silent": true
    }
  },
  "directories": {
    "node-installs": "/usr/local/bin/node-installs",
    "carapace-installs": "/usr/local/bin/carapace-installs"
  }
}

Support for different Node versions

Create install directories:

cd /usr/local/bin/
mkdir node-installs
mkdir carapace-installs

For each Node version required:

cd /usr/local/bin/node-installs
curl http://nodejs.org/dist/v<node-version>/node-v<node-version>.tar.gz | tar --strip-components=1 -xzf - -C <node-version>
cd <node-version>
./configure --prefix=/usr/local/bin/node-installs/<node-version> && make && make install

And for Carapace:

cd /usr/local/bin/carapace-installs/haibu-carapace
mkdir <approximate-node-version>
cd <approximate-node-version>
npm install haibu-carapace@<approximate-node-version>

Deploy an application

Make sure it's stopped:

curl -H "Content-Type: application/json" -d '{"stop":{"name":"<application>"}}' -XPOST -sSN localhost:9002/drones/<application>/stop

Deploy contents of current directory:

tar -cz . | curl -XPOST -sSNT- localhost:9002/deploy/<user>/<application>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment