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: is the location of your wiki's api.php. For example, MediaWiki's API endpoint is mediawiki.org/w/api.php. See The endpoint.

is the base URL of your wiki. For example, MediaWiki's base URL is mediawiki.org.

in the  and   entries must correspond to the URL and port of your Parsoid server. If your Parsoid and RESTBase servers are on the same machine, then  is a valid URL.

Run the server and Test
To run the RESTBase server use the same procedure to run the cxserver.

For testing execute: You should see the HTML content of the Main_Page.

In a browser you can also test by navigating to http://YOUR_RESTBASE_SERVER:7231/YOUR_WIKI_WEBSITE/v1/ and you should see a page titled Wikimedia REST API. On this page you can test all manner of RESTBase methods and variables.

For other testing refer to github.

If Restbase Port is blocked
If you do not see the page, your restbase server port may be blocked. Do the following:
 * If you get, your restbase server port is ok.
 * If you did not get, then do:
 * If you get  the restbase server is not bad, but you cannot access the port.

To bypass the block, you can set proxypass to your Apache httpd configuration. if you use apache, you can make a  file like this, and put on   of YOUR_RESTBASE_SERVER.

You should restart httpd (by  or some means). now In a browser you can navigate to http://YOUR_RESTBASE_SERVER/YOUR_WIKI_WEBSITE/v1/ and you should see a page titled Wikimedia REST API. And in this setting, you should add below to  for VisualEditor.

Starting RESTBase Server automatically
For installing the RESTBase server as a service with systemd, create this file in the   directory (  for CentOS 7 and   for openSUSE) and name it.

Replace  with the path to your restbase project directory.

To automatically start the RESTBase server at system startup, To control the RESTBase server,

If you ever change the  script, you need to reload it with,

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