Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pubcore/docker-cluster-test

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pubcore/docker-cluster-test

create clusters for testing purpose

  • 0.2.2
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

package to create a (local) docker swarm cluster for testing

This package can be used for scripts (js) to create a docker swarm cluster as a foundation for testing of services dealing with distributed data. Testing the behaviour of distributed-data-services, for instance, if a node goes down, leads to the motivation for this package: create a test-cluster, deploy a service, create some test-load and in parallel shoot down a node.

Prerequisites
  • Mac, Linux, Windows 7 and 8
  • docker, docker-machine
  • virtualbox
  • nodejs
Example
'use strict'
const {installCluster, purgeCluster, isReady, getVmIp
	} = require('@pubcore/docker-cluster-test'),
	{deploy} = require('@pubcore/node-docker-build')

//this will lead to 2 virtual machines with name vm1 and vm2
vmSet = {name:'vm', count:2}

//shortcut for  createVms(vmSet), startVms(vmSet) and createSwarm(vmSet)
installCluster(vmSet)

//helper function to deploy an example service (via ssh to the test-cluster)
deploy({
	moduleName:resolve(__dirname, '../localhost/config'),
	logPath:resolve(__dirname)
})

//if test-service is ready on vm2, do some-thing, here - for instance - cleanup
isReady({host:getVmIp(vmSet), port:8080}).then(() => {

	//purge stuff, shortcut for stopVms(vmSet) and deleteVms(vmSet)
	purgeCluster(vmSet)
},
References

docker swarm tutorial.

FAQs

Package last updated on 28 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc