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

openshift-uptimer

v1.0.10

Published

NPM module to prevent your OpenShift Node.js cartridge from being in IDLE status, in Express.

Downloads

5

Readme

OpenShift Uptimer NPM module

Why do you need this module?

OpenShift comes out with a free plan of 24-hours inactivity for IDLE applications. That means if your Node.js application is not visited in 24 hours range (through HTTP requests), the whole application gets down until you restart it with rhc app-restart yourapp or revisiting it manually.

In Node.js applications without a HTTP interface, for example an application running multiple Telegram bots, even if the application is being actually used --- the 24 hours uptime timer is not refreshed so your application will go down and you'll have to restart it manually.

Here's what this module is for: to have an easy workaround for this issue by keeping your application always in running state.

However, for production environment, consider to upgrade to a better OpenShift plan that guarantees infinite uptime.

How it works under the hoods

This module creates very easily an HTTP route with Express inside an OpenShift Node.js cartridge environment by automatically setting up IP and address as well.

You can also pass your own instance of express in order to avoid route collisions and multiple express running together on same port.

The default route is yourwebsite.com/uptime_route. You can use a webservice such as UptimeRobot (http://uptimerobot.com) to automatically make HTTP requests to your website and track uptime. Those requests can be made from 5 to 60 minutes.

How to install it

npm install --save openshift-uptimer This will also install Express dependency.

I didn't use Express in my application. How can I use this module?

VERY simple:

// JUST ONE LINE!
require('openshift-uptimer').auto_configure();  // Done!

If you like some customization or more control:

var openshift = require('openshift-uptimer');
openshift.log(true); // Enable logging
openshift.auto_configure(); // Done!

A new route will be created at yourwebsite.com/uptime_route with just very few lines and it will automatically adapt to your OpenShift installation. Awesome, isn't it?

I DID use Express in my application and I want to use the same Express instance. How can I do it?

This way:

var openshift = require('openshift-uptimer');
openshift.set_express(your_express_instance);
openshift.set_uptime_route('/uptime_route');

It is the same result as doing:

your_express_instance.get('/uptime_route', function(req,res)){
    res.send('Uptime OK!');
});

How to use webservices as UptimeRobot

  • Go to https://uptimerobot.com and register
  • After confirming email, go to My Settings
  • Press "Add new monitor"
  • Choose HTTP
  • Insert in the URL field: yourwebsite.com/uptime_route
  • Set your uptime checker timer (from 5 to 60 minutes)

Enjoy!

License

MIT

Author

Fabio Crispino aka Finalgalaxy