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

@1024pix/scalingo-review-app-manager

v2.1.3

Published

Utility tool that helps managing Scalingo review apps the economic way

Downloads

193

Readme

Logo Scalingo Review App Manager

Small and lightweight utility that automatically stop & restart your review apps on Scalingo each working day.

Presentation

Who

This library may interest you if you :

In particular, you will be concerned if you have enabled the option to "create review app for each new Pull Request".

Why

The firt goal of this library is to help you saving (a little bit of) money.

Another goal we have in mind is to reduce our consumption of useless IT resources.

We know that Scalingo must reserved physical servers in all cases and that the economy of resource consumption is insignificant at the scale ot the planet, but we believe that "a little bit" is even better than "not at all" 😉.

How

In order to use scalingo-review-app-manager :

  1. add the library as a dependency in a Scalingo Node.js project
  2. in your application code, declare a new ReviewAppManager
  3. add an instruction to start the EcoMode
  4. push & deploy your project on Scalingo

What

You can find a real production example here.

Pix Bot is a little web application hosted on Scalingo that help us – Pix – to automate internal processes and manage critical operations.

In particular, Pix Bot is responsible to manage all of our Review Apps (about 60 S-sized opened by day).

Thanks to scalingo-review-app-manager, we estimate that we save between 3500$ and 5000$ a year.

Basic Usage

1/ Install the dependency.

npm install scalingo-review-app-manager

2/ Declare a new ReviewAppManager and run the CRON-based "Eco Mode".

const ReviewAppManager = require('../index').ReviewAppManager;

const reviewAppManager = new ReviewAppManager('tk-us-DkjGg...', 'https://api.osc-fr1.scalingo.com');

reviewAppManager.startEcoMode().then(() => console.log('Eco Mode enabled.'));

Advanced usage

Custom stop & restart times

By default review apps will be shut down every week day at 7pm and will be restarted the day after (if it is a week day) at 8am.

You can customize the stop and restart times by passing stopCronTime and/or restartCronTime parameters (RegExp strings) to the ReviewAppManager constructor.

const options = {
  stopCronTime: '0 0 22 * * 1-5',
  restartCronTime: '0 0 6 * * 1-5'
};
(new ReviewAppManager(scalingoToken, scalingoApiUrl, options)).startEcoMode();

Ignoring some review apps

By default, all the review apps will be stopped and restarted according to stop & restart times.

You can ignore some review apps by passing ignoredReviewApps parameter (array of strings) to the ReviewAppManager constructor.

const options = {
  ignoredReviewApps: ['my-app-review-pr1', 'my-app-review-pr3']
};
(new ReviewAppManager(scalingoToken, scalingoApiUrl, options)).startEcoMode();

Scalingo pending operations limit management

The Scalingo API limits the numbers of applications scaling in the same time.

To deal with this limit, a mechanism of polling by application scaling is set up.

By default, the scaling status of each application is checked every 1000ms with a maximum of 10 attempts. These values can be parameterized in the options object of the ReviewAppManager constructor : pollTimeInterval (number, in ms) and pollMaxAttempts (number).

const options = {
  pollTimeInterval: 1000,
  pollMaxAttempts: 10
};
(new ReviewAppManager(scalingoToken, scalingoApiUrl, options)).startEcoMode();

Specifying cron jobs time zone

By default, the cron jobs are based on UTC server's local time zone.

You can set up a specific time zone with the timeZone option, cf. the list of available time zones.

const options = {
  timeZone: 'Europe/Paris',
};
(new ReviewAppManager(scalingoToken, scalingoApiUrl, options)).startEcoMode();

License

License: AGPL v3

This software is released under the AGPL-3.0 license & supports modern environments.

Misc

The logo was in free downloaded on pngdownload.id after a search on Google Images with "non-commercial reuse" filter.