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

docker-sidecar

v1.3.0

Published

Watch a consul kv dir for changes to retrieve a list of images and tags and pull them into docker when kv prefix changes.

Downloads

15

Readme

NPM

npm version

SYNOPSIS

Sidecar watches a list of images from consul kv via a key prefix. The value for each key under the prefix should be a string e.g., "image:tag" and sidecar will pull those images automatically into docker.

USAGE

  • Install: npm i -g docker-sidecar
  • Run: sidecar --consul http://127.0.0.1:8500 --dir 'test/images'
  • Also useable as a library via npm i docker-sidecar or as a Docker image.

bootstrap

  • In addition to pulling the current image list from the consul key-values, you can also specify the --bootstrap option and pass a path to a file with images to download at startup.
    • For example sidecar --consul http://127.0.0.1:8500 --dir 'test/images' --bootstrap /path/to/bootstrap.json
    • See the bootstrap example json file

auth tokens

If using a private registry or a private docker image, sidecar uses the standard ~/.docker/config.json location for auth credentials.

For consul auth, you can use the env variable sidecar_auths__consul__token=token.

EXAMPLE

ScreenShot

Included is a docker-compose.yml to serve as a starting point for a set of services. This includes consul, registrator, and the sidecar service all setup for you automatically via compose.

The example runs sidecar with the option --dir test/images which means it will watch the consul kv key prefix for changes.

Simply add a new consul key e.g., test/images/foo with value busybox:latest and hit update in consul (located @ HOST_IP or docker-machine ip default) and that image will be pulled into the configured docker.

start up our sidecar service

$ docker-compose -p sidecar build
$ docker-compose -p sidecar up

make sure we've got the latest busybox/ubuntu in docker/swarm :

$ curl -X PUT -d 'busybox:latest' http://$HOST_IP:8500/v1/kv/test/images/busybox
$ curl -X PUT -d 'ubuntu:latest' http://$HOST_IP:8500/v1/kv/test/images/ubuntu

refresh the busybox image again (imagine a webhook writing these eventually):

$ curl -X PUT -d 'busybox:latest' http://$HOST_IP:8500/v1/kv/test/images/busybox