Giter Site home page Giter Site logo

stolsma / haibu-carapace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodejitsu/haibu-carapace

1.0 1.0 0.0 229 KB

The application host used by the haibu node.js application deployment / management server.

Home Page: http://github.com/nodejitsu/haibu-carapace

License: MIT License

C++ 1.17% Shell 0.38% JavaScript 98.45%

haibu-carapace's Introduction

Haibu-Carapace

Haibu Drone's Little Shell

What is Carapace

Carapace is an process wrapper for Node.js applications that is part of the Haibu Network. Carapace also provides a Hook.IO based plugin system to simplify deployment and development of applications.

What can I do with Carapace?

By utilizing Carapace you can help automate deployments of applications into a custom environment. Combining Carapace with the Forever Daemon can allow you run the application in the environment indefinitely.

Installation

Installing npm (node package manager)

curl http://npmjs.org/install.sh | sh

Installing carapace

[sudo] npm install carapace

Example(s)

Chroot Jailed web-server (using the script)

# run the included shell script in a terminal
sudo ./examples/jailedserver
# then on another terminal poke the server using `curl` and `watch`
watch 'curl http://localhost:1337'

Chroot Jailed Web-server (as a require)

code is available in ./examples/jailer.js and must be ran with superuser privileges

var carapace = require('../lib/carapace');

var script = 'server.js',
    hookOpts = {
      'debug' : false,
      'hook-port' :  5061
    },
    scriptPort = 31337;

carapace.listen( hookOpts,function () {
  carapace.on('carapace::plugin::error', function (info) {
    console.log('Error loading plugin: ' + info.plugin);
    console.log(info.error.message);
    console.dir(info.error.stack.split('\n'))
  });

  carapace.use([
    carapace.plugins.heartbeat, 
    carapace.plugins.chroot, 
    carapace.plugins.chdir
  ], function () {
    carapace.chroot('./examples/chroot-jail', console.log.bind(null, 'hello'));
    carapace.chdir('.');
    carapace.run(script, ['--port', scriptPort], function afterRun() {
      carapace.heartbeat(function () {
        console.log('bump'.red);
      },1000);
      console.log(script.yellow + ' running on port '.grey + scriptPort.toString().green);
    });
  });  
});
# Run the above code in a terminal with
sudo node ./examples/jailer.js
# Poke the server in another terminal with
watch 'curl http://localhost:31337'

Carapace CLI Options

carapace [hook-options] --plugin [plugin] --[plugin] [options] application [options]

Carapace's Plugin Manager Options

--hook-port [port] --hook-host [hostname]

Carapace's Plugin Manager's Listening port/hostname

Plugins

--plugin [plugin]

Plugin to use with the carapace instance

Plugin Options

--[plugin] [options]

Option to be passed to the [plugin]

Application & Application's Options

[application] [application's CLI options]

Any options that isn't consumed by the Carapace will automatically be passed to the application

Default Plugins

List of known plugins, and options (if any) used by them

  • chroot - directory to rebind as root directory '/'
  • chdir - directory to change into
  • heartbeat - time in micro-seconds between 'carapace::heartbeat' events

Run Tests

All of the carapace tests are written in vows

  $ npm test

haibu-carapace's People

Contributors

bmeck avatar indexzero avatar jamesonjlee avatar marak avatar stolsma avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.