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

dood-utils

v0.1.1

Published

Utils to support Node running in a Docker-out-of-Docker (DooD) container.

Downloads

4

Readme

Docker-Node-DooD

A NodeJS Docker-out-of-Docker helper. The DooD aspect was taken pretty much directly from http://container-solutions.com/running-docker-in-jenkins-in-docker/.

Useful for when you need a Docker container or containers to interact with Docker, including the creation of other Docker containers.

Usage

Creating Docker containers

The bash script build.sh is used to create a base application image, and one or more applications as passed on the command line. The applications can either already exist within a ./applications directory, or can be GitHub repositories (using the form of organisation/repo or user/repo), or a mixture of both.

E.g.:

./build.sh fastbeanau/my-app-persistence-layer fastbeanau/my-app-api-layer fastbeanau/my-app-ui-layer 

But, that is a rather contrived example, as there is probably little reason for the UI layer to need access to Docker, and neither the persistence layer would likely require Docker access nor NodeJS, and thus both of those would be unsuitable for this.

Applications making use of this image are expected to include something similar to the following in their Dockerfile:

FROM node-dood-base

COPY  . /application/

RUN cd /application \
    && npm install --production

Node Utilities

A Node script containing a helper method is also included in this repository (and published to NPM as dood-utils).

npm install --save dood-utils

Within your scripts:

const dood = require('dood-utils');
const myLocalPort = 8888;

dood.getHostPortMappings((err, ports) => {
  console.log(`Server listening on local port ${ports[myLocalPort+'/tcp'][0].HostPort}`);
});

Notes

  • Any ports exposed by the container will be randomly mapped and exposed on the Docker host. This mapping will change on container start & restart, you may wish to consider using a discovery/registry service if this is an issue. The NPM package dood-utils has a method to provide the current port mappings to the container.

  • Specific configuration settings for individual container(s) (once created) can be set by using the docker update command, e.g.

docker update --restart=unless-stopped my-app-persistence-layer
docker update --restart=on-failure:10 my-app-api-layer my-app-ui-layer