Offline content generator/Installation/en

'''These instructions are out of date. The most recent installation instructions can be found at OCG and in the README of the OCG service itself.'''

OCG is a tool collection under construction providing offline content rendering. It can be used in conjunction with the Collection Extension to provide book rendereing.

Installation
Usually public rendering servers may be used. Their address can be provided to the Collection Extension, which will use that. But sometimes it is necessary to install the rendering stack on own machines. In this case all systems were running Debian 7 (Wheezy). The installation on Ubuntu might be similar or even easier.

Prerequisites
OCG is developed in javascript running on an nodejs rendering server. For rendering the wikitext parser service Parsoid is used, while jobs are managed via redis. Creating the PDFs is done using XeTeX, provided via the texlive distribution.

(See  and   for the most up-to-date package list.)
 * Everyting for PDF-Rendering

Unfortunately the package provided by wheezy does not include npm therefore we have to compile node ourselves.
 * nodejs

Here we can use Debian's package:
 * Redis server

Parsoid is developed by the Wikimedia Foundation and available via git:
 * Parsoid

There is also some configuration necessary. Therefore copy the provided example config and modify it:

The syntax of the configuration file is javascript. Wikis are defined as:

With this also multiple wikis can be defined.

OCG Service
OCG is also developed by the Wikimedia Foundation. Therefore the download is recommended via git: This contains prebuilt binary modules and is not the recommended way to download or install OCG.
 * Download

The configuration file is best placed under : Because this project is still under development, some configuration parameters may change very quick.
 * Configuration

Wiki
As a frontend the Collection extension is used
 * Configuration

Starting
Redis is already started, a restart is only necessary, when some configuration is changed. But parsoid and ocg-collection need to be started.

After starting  should output someting including those lines: Proto Recv-Q Send-Q Local Address          Foreign Address         State tcp       0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN tcp       0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN tcp       0      0 0.0.0.0:17080           0.0.0.0:*               LISTEN

Troubleshooting
When a rendering job wasn't successful and it is restarted, it will fail again because some temporary files are still there on the rendering server's filesystem. In this case, those files must be deleted from.