0.1.22 • Published 7 years ago

port-docker v0.1.22

Weekly downloads
3
License
MIT
Repository
github
Last release
7 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

7 years ago

0.1.21

7 years ago

0.1.20

7 years ago

0.1.19

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

8 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago