0.1.22 • Published 8 years ago

port-docker v0.1.22

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Welcome to Port! {#welcome}

Port is a docker managment module writen in node.


NOTE:

  • Port is still in alpha state

Install

To install Port you can use npm

NPM

$ npm install  port-docker

Usage

You can require the module in your program.

var Port = require('port-docker');

Initialize

var port = new Port({
	name : 'demo',
	environment : 'dev',
	maxMemory : 2222222,
	multiTenant : true,
	docker : {
		socket : '/var/run/docker.sock'
		//host : '192.168.1.111',
		//port : 5001,
	}
});

#Methods for Port

##port.run()

Starts the module listing to docker

port.run()

##port.start(options,callback)

Options

  • logs.web.host Required. Host for the logs web server.
  • logs.web.port Required. Port for the logs web server.
  • logs.udp.host Required. Host for the logs udp server.
  • logs.udp.port Required. Port for the logs udp server.
  • logSession Required. Logs session to send log server to.
  • source Required. Source is used for logging.
  • name Required. Name of the new container.
  • index Required. Index of the container used for scalling.
  • uid Required. UUID for this container.
  • limits.memory Optional. Container memory limits. Value in MB.
  • limits.cpuShares Optional. Relative weight of CPU usage to other container.
  • limits.cpuset Optional. What cores to use with this container.
  • image Required. Docker image to use.
  • cmd Optional. Commands to run the container with.
  • exposedPorts Optional. Array of ports to expose. ['6379/tcp', '6379/udp'].

Starts a new container

var stress = {
	logs : {
		"web" : {
			"port" : 5000,
			"host" : "127.0.0.1"
		},
		"udp" : {
			"port" : 5000,
			"host" : "127.0.0.1"
		}
	},
	logSession : 'log.session',
	source : 'app',
	name : 'stress',
	index : 1,
	uid : 'uuid',
	username : 'username',
	limits : {
		memory : 75,
		cpuShares : 128,
		cpuset : "0,1,2,3"
	},
	image : 'progrium/stress',
	cmd : ['--cpu', '2', '--vm', '1', '--vm-bytes', '40M', '-q'],
	exposedPorts : []
};

port.start(redis, function(err, container) {
    //
});

##port.stop(id,callback)

Stop a container with the containers id.

port.stop(container.id, function(){
    //
})

Events

####'run' Once the module is running

port.once('run', function() {
	console.log('run');
});

####'container error'

port.on('container error', function(error) {
	console.log('error', error);
});
0.1.22

8 years ago

0.1.21

8 years ago

0.1.20

8 years ago

0.1.19

8 years ago

0.1.17

8 years ago

0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

9 years ago

0.1.13

9 years ago

0.1.12

9 years ago

0.1.11

9 years ago

0.1.10

9 years ago

0.1.9

9 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago