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

redis-docker-taskrunner

v0.2.1

Published

Simple task runner that runs pending tasks in Redis when Docker container starts

Downloads

4

Readme

Redis Docker Task Runner

This app is designed to be run via a Kubernetes CronJob but could be run independently, or as a standalone Docker app. It connects to defined Redis database, and checks for pending tasks on defined channel, and performing defined task.

By default, this will re-publish the task to a Redis PubSub channel, but can be extended to do anything desired.

Requirements

You need Redis to be running.

Usage

Kubernetes (CronJob)

This is the quick and dirty test, but you'll likely want to clone and change manifest and ENV variables.

kubectl apply -f https://raw.githubusercontent.com/mikesparr/redis-docker-taskrunner/master/deploy/cronjob.yml

Publishing jobs

See the tests for data format to publish to Redis. However a convenience npm module exists called redis-task-scheduler that you can use. Simply npm install redis-task-scheduler (or yarn add redis-task-scheduler) and follow it's instructions. Both these components were designed to work as optional handler for Delayed actions in npm module redis-workflow. The default action for tasks is to republish the context object to Redis PubSub when scheduled time arrives for workflow to process it.

Customizing

This app can be run locally, on any server (likely Linux environment using cron but also Windows with scheduler). It is designed to run in Kubernetes using CronJob, but you could deploy it anywhere and create your own cron to */1 * * * * /usr/local/bin/node /path/to/app/index.js for example.

Clone repo and install dependencies locally

git clone [email protected]:mikesparr/redis-docker-taskrunner.git
cd redis-docker-taskrunner
npm install

Edit files to your liking

  1. Create a .env file and customize:
# default env vars for scheduler app
export SCHEDULER_NAME="Default"
export SCHEDULER_CHANNEL="scheduler"
export SCHEDULER_DB_HOST="localhost"
export SCHEDULER_DB_PORT="6379"
#export SCHEDULER_DB_NAME=
#export SCHEDULER_DB_PASS=
  1. Create your own Docker image and publish to container registry
docker build -t yourrepo/redis-docker-taskrunner:latest .
docker push yourrepo/redis-docker-taskrunner:latest # assume you logged into your account
  1. Edit the params in /deploy/cronjob.yml for your Kubernetes environment
  • edit the image to point to yourrepo/redis-docker-taskrunner:latest
  • edit the env params to point to your instance of Redis
  1. Deploy cronjob to Kubernetes
kubectl delete -f deploy/cronjob.yml # if you had prior version running
kubectl apply -f deploy/cronjob.yml

Testing

git clone [email protected]:mikesparr/redis-docker-taskrunner.git
cd redis-docker-taskrunner
npm install
npm test
npm run coverage # optional

Contributing

I haven't thought that far ahead yet. I needed this for a project I'm working on.

License

MIT