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

nomad-helper

v3.6.1

Published

Helps with editing job files depending on available services

Downloads

87

Readme

Helps with editing job files depending on available services

Plays well with consul-helper

Requires at least Nomad version 0.5.4 to work

An example for Manticore:

//supply a host IP address in the options array
var nomader = require('nomad-helper');
var consuler = require('consul-helper')("192.168.1.144");

//this creates an sdl core job file suitable for manticore
var jobCore = nomader.createJob("core");
jobCore.addGroup("core");
jobCore.addTask("core", "core-master");
jobCore.setImage("core", "core-master", "crokita/discovery-core:master");
jobCore.addPort("core", "core-master", true, "hmi", 8087);
jobCore.addPort("core", "core-master", true, "tcp", 12345);
jobCore.addEnv("core", "core-master", "DOCKER_IP", "${NOMAD_IP_hmi}");
jobCore.addService("core", "core-master", "core-master");
jobCore.addTag("core", "core-master", "core-master", "${NOMAD_PORT_tcp}");
jobCore.setPortLabel("core", "core-master", "core-master", "hmi");

//set up a watch so we know when the core job is actually running
consuler.watchService("core-master", function (services) {
	//services updated. get information about core and hmi if possible
	for (let i in services) {
		console.log("Core " + i + " TCP Address: " + services[i].Address + ":" + services[i].Tags[0]);
	}

	//submit a corresponding hmi job file that connects with the core service
	if (services.length > 0) {
		var jobService = services[0];
		//this creates an sdl hmi job file suitable for manticore
		var hmiCore = nomader.createJob("hmi");
		hmiCore.addGroup("hmi");
		hmiCore.addTask("hmi", "hmi-master");
		hmiCore.setImage("hmi", "hmi-master", "crokita/discovery-sdl-hmi:master");
		hmiCore.addPort("hmi", "hmi-master", true, "user", 8080);
		hmiCore.addEnv("hmi", "hmi-master", "HMI_WEBSOCKET_ADDR", jobService.Address + ":" + jobService.Port);
		hmiCore.addService("hmi", "hmi-master", "${TASKGROUP}-hmi");
		hmiCore.setPortLabel("hmi", "hmi-master", "hmi-master", "user");
		hmiCore.submitJob("192.168.1.142:4646");
	}
});

//set up a watch so we know when the hmi job is actually running
consuler.watchService("hmi-master", function (services) {
	//services updated. get information about core and hmi if possible
	for (let i in services) {
		console.log("HMI " + i + " user Address: " + services[i].Address + ":" + services[i].Port);
	}
});

//submit the core job!
jobCore.submitJob("192.168.1.142:4646");