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

jkmod

v0.2.0

Published

CLI for Apache mod_jk status worker (because antiquated tech is cool!)

Downloads

2

Readme

poɯʞɾ

CLI for Apache mod_jk status worker (because antiquated tech is cool!)

The Story

Boss (at 3pm): "Hey, we're gonna need a script to take JBoss nodes out of our Apache load balancer pools for our next rolling deployment."

me: "Cool, I'll write something up. When's the deployment scheduled?"

Boss: "In 3 hours."

me: "... Ok ..."

So before you go any further, here are some of the caveats of a module built by me in a couple of hours:

  • This is a hack. Use at your own risk.
  • ~~Apparently, it doesn't work on Windows without additional effort.~~ Now works on Windows without extra steps. You're welcome.
  • The code is really hairy.
  • The console output is mostly JSON.
  • It doesn't work without configuration.
  • It doesn't handle errors well (or at all, really).
  • It provides a very small subset of functionality based on the "jkstatus" or "jkmanager" web interface.

But, if you're in a pinch, it is functional and can get the job done.

Also, like most good hacks, it will probably become heavily used and relied on (at least at my job) for years to come.

Install

$ npm install -g jkmod

Configuration

Currently requires a jkmod.json file to be defined in the current working directory. The structure of the JSON config is:

{
  "your-environment-name-here": [
    { "host": "apache-host-1", "jkUrl": "http://apache-host-1/jkstatus/" },
    { "host": "apache-host-2", "jkUrl": "http://apache-host-1/jkstatus/" }
  ],
  "another-environment-name-here": [
    { "host": "apache-host-3", "jkUrl": "http://apache-host-3.yourdomain.com/jkstatus/" },
    { "host": "apache-host-4", "jkUrl": "http://apache-host-4.yourdomain.com/jkstatus/" }
  ]
}

The environment names will be used on the command line, so make them short, meaningful, and command-line-friendly. The jkUrl values are the most important, and they should work in your browser (without any authentication, for now). Note that the trailing slash may be important, depending on your Apache config.

Here's an example:

{
  "dev": [
    { "host": "friendlydev1", "jkUrl": "http://friendlydev1.intra.net:81/jkstatus/" },
    { "host": "cuddlydev2", "jkUrl": "http://cuddlydev2.intra.net:81/jkstatus/" }
  ],
  "prd": [
    { "host": "scaryprd1", "jkUrl": "http://scaryprd1.jkmod.com/jkstatus/" },
    { "host": "meanprd2", "jkUrl": "http://meanprd2.jkmod.com/jkstatus/" },
    { "host": "willhurtyouprd3", "jkUrl": "http://willhurtyouprd3.jkmod.com/jkstatus/" },
    { "host": "dontmessthisupprd4", "jkUrl": "http://dontmessthisupprd4.jkmod.com/jkstatus/" }
  ]
}

Usage

Query a set of hosts defined for the given environment and output the status of each configured Tomcat node/worker. The <env> value you specify must be defined in your jkmod.json file in the current working directory.

$ jkmod list <env>

Update the activation status for given Tomcat node/worker in the given environment. The <env> value you specify must be defined in your jkmod.json file in the current working directory. The <tomcatHost> value should come from the output of jkmod list <env>. The <status> value should be one of:

  • ACT for active (the node/worker will receive traffic from the Apache load balancer pool)
  • DIS for disabled (the node/worker will only receive sticky traffic from existing sessions - meant to bleed traffic off of this worker)
  • STP for stopped (the node/worker will stop receiving any traffic)
$ jkmod edit <env> <tomcatHost> <status>

For questions about the load balancer member status, see the mod_jk documentation.

Everything else

If you need more functionality, consider using the jk status worker Ant tasks instead.

Or just upgrade to mod_cluster. 😉