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 6.11.1 or higher. When you are using Ubuntu and depending on OS version you may not end up with the most recent version of nodejs please read this first before you proceed:

For other systems, see:
 * http://nodejs.org/download/
 * https://github.com/nodejs/node/wiki

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
See RESTBase/Installation.

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