haibu-ishiki
v0.2.2
Published
Node deployment server - wrapper for haibu, http-proxy and carapace with permissions and automatic node versions
Readme
Haibu Ishiki
Wrapper for Haibu, Http Proxy and Carapace.
What does it do?
It makes running a Node deployment server as painless as possible.
How does it work?
After starting Ishiki, an API will be made available. With this API, you can deploy applications and manage them. If your application requires a specific version of Node, it will be set up automatically for you. Each application will run on its own IP:port internally, while being proxied through the domains specified on your app on whatever public port you want your sites to run on (e.g. 80).
Disclaimer
Ishiki is provided as is and, as it stands, should not be used for production.
Install
npm install haibu-ishikiUsage:
node ./node_modules/haibu-ishiki/index.jsOr to install globally (preferred):
npm install haibu-ishiki -gUsage:
ishikiConfiguration
By default, Ishiki will run on the following settings:
{
"host": "127.0.0.1",
"port": "8080",
"public-port": "80",
"deploy-dir": "deployment",
"port-range": {
"min": "9080",
"max": "10080"
},
"haibu": {
"env": "development",
"advanced-replies": true,
"useraccounts": true,
"coffee": true,
"directories": {
"node-installs": "node-installs",
"packages": "packages",
"apps": "apps",
"tmp": "tmp"
}
}
}Copy config.sample.js to config.js and modify if you want your own settings.
hostis the host Ishiki and its API will run onportis the port Ishiki and its API will run onpublic-portis the port the apps will be made available on to the public (proxy port)deploy-diris where all the directories defined underhaibu.directoriesgo (defaults to<ishiki-dir>/deployment)port-rangeis the range of ports the apps will listen on internally before being proxiedhaibuis whatever settings are available to the haibu module
Ishiki provides its own API
Drones
/drones (GET)
Returns a list of all drones
/drones/:userid (GET)
Returns all drones for a given user
/drones/:userid/:appid (GET)
Returns drone info for given user/app
/drones/running (GET)
Returns all running drones
/drones/:userid/:appid/deploy (POST)
Deploys an app from a tarball for given user/app, with Curl from your app's directory:
tar -cz . | curl -XPOST -m 360 -sSNT- <ishiki-ip>:<ishiki-port>/drones/<user>/<app>/deploy/drones/:userid/:appid/start (POST)
Starts a previously stopped drone for given user/app
/drones/:userid/:appid/stop (POST)
Stops a running drone for given user/app
/drones/:userid/:appid/restart (POST)
Restarts a running drone for given user/app
Proxy
/proxies (GET)
Returns a list of all proxies and associated routes
/proxies/:port (GET)
Returns a list of all routes for proxy on given port
/proxies/:port (POST)
Starts a proxy on given port
/proxies/:port/set (POST)
Updates or creates an arbitrary route for proxy on given port with source domain
and target host and port provided in POST
/proxies/:port/delete_proxy (POST)
Stops and removes proxy and associated routes on given port
/proxies/:port/delete_route (POST)
If domain is provided in POST, corresponding route will be removed from proxy on given port.
If domain is not provided, then all routes matching the contents of POST for proxy on given port will be deleted.
In this case POST can have any of the following values for matching:
{
host: 1.2.3.4,
port: 1234,
user: 'myuser',
appid: 'myapp'
}/proxies/:port/:userid (GET)
Returns all routes for given user for proxy on given port
/proxies/:port/:userid/:appid (GET)
Returns all routes for given user/app for proxy on given port
/proxies/:port/:userid/delete (POST)
Deletes route for given user/app for proxy on given port
Things to check before deploying an app
Domains
In your app's package.json, make sure you have at least one of domain, domains, subdomain and subdomains.
These can be arrays or space-separated list of domains. These are used for proxy mapping. If not specified you can
always set a new proxy route manually using the API.
Port
When your app runs a server, make sure it listens on process.env.PORT. While it still works without, it ensures that
Ishiki will use one of the ports within the proxy port range defined in your configuration.
Dependencies
Requirements
- Node 0.8.x
- root access (or sufficient rights) to run
configure && make && make installto install Node versions
To Do
- automatically restart drones on server start
- add user authentication and permissions
- allow for persistent proxy routes
- user/app logs and log streaming
- tighten security for each user/drone
- create an easy-to-use client NPM module to work with Ishiki
- create a client interface for the browser
