Content translation/cxserver/Setup

Content Translation Server
If you want to do an anonymous checkout:

Or if you plan to hack CXServer, then please follow the Gerrit 'getting started' docs and use an authenticated checkout url instead, such as:

Nodejs
Install nodejs 0.10 or higher. When you are using Ubuntu and depending on OS version you will not end up with the most recent version of nodejs please read this first before you proceed:

On Ubuntu Server 12.04 LTS instead do (to get v0.10.x) :

On CentOS 7 instead do (for nodejs 6.x version):

For other systems, see:
 * http://nodejs.org/download/
 * https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

JS dependencies
Install the JS dependencies. Run this command in the cxserver directory:

Installation
To install language pair,

Where xxx and yyy are two different languages.

On CentOS 7 instead do:

Installation
From the restbase project directory, install the Node dependencies:

Configuration
Edit the config.yaml file in these parts:

Run the server and Test
To run RESTBase Server use the same procedure to run the cxserver. For testing execute: You should see the HTML content of the Main_Page. For other testing refer to github.

Starting RESTBase Server automatically
For installing RESTBase Server as service with systemd, create this file in the   directory (  for CentOS 7).

To control RESTBase Server,

If you change in service script, you need to reload script by,

Server Configuration
An example configuration file is given as config.dev.yaml and config.prod.yaml.

Apertium configuration section
The server expected on localhost:2737 is then Apertium-apy. (See http://wiki.apertium.org/wiki/Apy for instructions; you'll have to install Apertium and at least one language pair too). Adjust configuration according to your requirement and restart the server.

Using node
On CentOS 7:

As a cxserver command
Following step is to be performed only once. You might have to use 'sudo'.

Subsequently, just use following to start the server.

Then browse to http://localhost:8080/v1 You'll see the server playground page.

Running it in secure mode (https)
In the configuration file, provide the SSL certificate details and set value of 'secure' as true

Debugging
To run the ContentTranslation server:

It will open Chrome developer tools with the ContentTranslation source code. You can debug the code just like a web application. You can also edit the code and save from the debugger.

Starting cxserver automatically
There are many ways to start services automatically, consult your server's operating system documentation.

upstart
On Ubuntu and other operating systems using Upstart, one approach is

And, use following upstart script template:

To start cxserver,

To stop cxserver,

Debugging
Upstart can be debug using log messages at.

systemd
On recent versions of Debian, Fedora and other operating systems using systemd, use a  unit file similar to the following template (modify the file paths as appropriate) and place file at   directory.

To start cxserver,

To stop cxserver,

If you change in service script, you need to reload script by,

Debugging
Systemd scripts logs messages at. It can be customized using  in cxserver.service script.

Configuration
1. Configure varnish http accelerator port:

edit /etc/default/varnish

Example configuration to run varnish on port 8000

2. Configure the varnish default backend:

edit /etc/varnish/default.vcl

3. Restart the varnish:

Make sure you are running cxserver nodejs server on port 8080 - the backend configuration of varnish

127.0.0.1:8000 will be your server URL with varnish 127.0.0.1:8080 will be your server URL without varnish

4. Configure cxclient's wgContentTranslationServerURL to 127.0.0.1:8000

Extensions dependencies
Content translation extension requires following extensions as dependencies.


 * 1) BetaFeatures
 * 2) CLDR
 * 3) EventLogging
 * 4) UniversalLanguageSelector