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

mw-ocg-service

v1.0.0

Published

Render service (Offline Content Generator) for the MediaWiki extension Collection

Downloads

5

Readme

OfflineContentGenerator

dependency status dev dependency status

Render service (Offline Content Generator) for MediaWiki.

Ties together the MediaWiki Collection extension with the mw-ocg-bundler and mw-ocg-latexer/mw-ocg-texter/etc backends.

Running a development server

See wiki for instructions on how to configure a local Collection extension to point to this server. But you can run a local instance with

apt-get install redis-server # runs a local redis service on port 6379
cd <repodir> ; npm install
./mw-ocg-service.js # starts a front end ocg service on port 17080

You also need to checkout and install mw-ocg-bundler and one or more backends (mw-ocg-latexer, mw-ocg-texter, etc). Although you can specify any path to these in you like, the default configuration expects them to be at the same directory level as mw-ocg-bundler, eg:

$OCG/mw-ocg-service (this package)
$OCG/mw-ocg-bundler
$OCG/mw-ocg-latexer
$OCG/mw-ocg-texter

If you have installed VisualEditor, no additional configuration will be necessary: OCG will use the VisualEditor configuration to find an appropriate Parsoid service and prefix.

In the absence of VisualEditor, you will still need to install Parsoid, and then configure OCG to use it. You will launch mw-ocg-service as ./mw-ocg-service.js -c localsettings.js and create a localsettings.js file containing:

// for mw-ocg-service
module.exports = function(config) {
  // change the port here if you are running parsoid on a different port
  config.backend.bundler.parsoid_api = "http://localhost:8000";
  // the prefix here should match $wgDBname in your LocalSettings.php
  config.backend.bundler.parsoid_prefix = "localhost";
}

Parsoid would in turn be configured with its own localsettings.js containing:

// for Parsoid
exports.setup = function( parsoidConfig ) {
  // first argument here should match $wgDBname in your LocalSettings.php
  parsoidConfig.setInterwiki( 'localhost', 'http://localhost/path/to/your/mediawiki/api.php' );
  // optional:
  parsoidConfig.serverPort = 8000;
};

Installing a production server on Ubuntu

Ensure that you have a redis server installed somewhere.

cd <repodir> ; npm install
ln -s <repodir>/mw-collection-ocg.conf /etc/init
initctl reload-configuration
service mw-collection-ocg start

Create /etc/mw-collection-ocg.js to configure the render service. See the default configuration for more details.

Binary node modules

The following node binary module is required:

  • sqlite3 (for bundler and latex_renderer)

In addition, better performance is obtained if the following binary module is installed:

  • hiredis (for this service)

Be aware of these when deploying to a new node version or machine architecture. You may need to npm rebuild <package name>.

Logging

This software uses the bunyan logging framework. By default the framework only logs to the system console. To add additional log transports and make it useful, in the config file add lines like:

var bsyslog = require('bunyan-syslog');
config.logging = {
  streams: [{
    stream: process.stdout
  }, {
    level: 'debug',
    type: 'raw',
    stream: bsyslog.createBunyanStream({
      type: 'sys',
      facility: bsyslog.local0,
      name: 'mw-ocg-service'
    })
  }, {
    type: 'raw',
    stream: require('gelf-stream').forBunyan( '..host..', PORT)
  }],
  serializers: ... /* optional */
}

Maintenance

The health check command=health will return the number of objects currently in the job queue. If the job queue is too long, the operator can either wait for the queue to clear, or log into the redis server with the rediscli and run DEL with the keyname given by JobQueue.name in the returned health hash, equivilant to the value of config.redis.job_queue_name

License

(c) 2014 by Brad Jorsch, C. Scott Ananian, Matthew Walker, Max Seminik

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html