Socket
Socket
Sign inDemoInstall

@pubcore/docker-cluster-test

Package Overview
Dependencies
25
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @pubcore/docker-cluster-test

create clusters for testing purpose


Version published
Weekly downloads
1
Maintainers
3
Install size
575 kB
Created
Weekly downloads
 

Readme

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 (https://docs.docker.com/machine/install-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

Last updated on 02 Aug 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc