npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

miracle.core.drivers

v3.5.16

Published

miracle Driver Strategies

Downloads

5

Readme

miracle.core.drivers

Build Status Coverage Status Known Vulnerabilities

Miracle Core Drivers is a repository that serves as a driver to both "Docker Swarm" and "Kubernetes" clustering

and scheduling tools. The driver contains several APIs responsible for the management of the cluster, nodes,

services, and tasks. Examples of such APIs include, but are not limited to, service deployment node/service/task

deployment/deletion/update/inspection, in addition to maintenance operations, and logging.


Installation

$ npm install miracle.core.drivers

Usage

Each strategy function takes an options object and callback function as input. The options object is composed of the following:

{
	"strategy": "kubernetes", //swarm or kubernetes
	"driver": "kubernetes.local", //strategy + target (local or remote)
	"env": "dev", //environment from where the deployer config was retrieved
	"deployerConfig": { //object that contains the specific configuration per driver
      //sample kubernetes deployer config
		"nginxDeployType": "NodePort",
		"namespace": {
			"default": "miracle",
			"perService": false
		},
		"auth": {
			"token": "123321"
		}
	},
	"mi": {
		"registry": {} //miracle registry object, no longer mandatory
	},
	"model": {}, //data model layer, no longer mandatory
	"params": {} //user input specific per function
}

Service Features

The Miracle Core Drivers contains several APIs to manage the Kubernetes cluster and/or Docker swarm:

  • Node management APIs: Add/Update/Remove/Inspect.
  • Service management APIs: Add/Update/Remove/Inspect/Redeploy.
  • Task management APIs: Add/Update/Remove/Inspect/.
  • Maintenance APIs.
  • Logging APIs.

Architecture

The "index.js" file serves as an entry point. Once it receives a request, the file redirects the request into the designated strategy.

Each strategy, located in the /strategies directory, serves as an entry point, of every requesting targeting one of its APIs.

The APIs of each strategy are divided into two files, located in the /strategyFunctions directory. One file contains all the APIs

concerned with node management. The other file contains all the remaining APIs.

Control Flow

The repository was designed in a way to maximize the scalability of the code, while minimizing the coding efforts.

Below is an explanation of the control flow, all the way from the entry point, into the designated API.

Once a request arrives, the "index.js" file captures the request, checks if the targeted strategy exists.

If it exists, it checks if the requested API exists. Once the validation is complete, the request is redirected

to the requested strategy file, which in turn redirects the request to the file containing the destined API.

Warning

  • If running the test cases, make sure you have kubectl installed locally.
  • If running the test cases on OS X, after starting minikube, start a kubectl proxy instance on port 8080 and export MIRACLE_TEST_KUBE_PORT environment variable.
export MIRACLE_TEST_KUBE_PORT=8080
kubectl proxy -p 8080
  • Running the test cases will delete all previous docker services and containers.