Topic on Extension talk:VisualEditor

Bluehacker007 (talkcontribs)

I need help getting my Restbase server set up correctly. Basically I would like to run MW, Parsoid and and a Restbase server all from the same Amazon AWS EC2 instance which is running Ubuntu 14.04 but I'm getting stuck when I try to get a working Restbase server running.

MW works just fine, and I've installed VisualEditor and Parsoid and both are working as well - if I do curl http://localhost:8142 I get the Parsoid welcome page and I don't have any trouble editing existing pages with the VisualEditor which tells me that there is no issue with Parsoid. In my localsettings.php I have these lines to get Parsoid working:

$wgVirtualRestConfig['modules']['parsoid'] = array('url' => 'localhost:8142','domain' => 'localhost');

$wgSessionsInObjectCache = true;

$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;

After I had all of that working I tried to set up a Restbase server which is where I encountered a ton of trouble. I tried following the directions here: Content translation/cxserver/Setup. (I didn't install cxserver, I just want the restbase server) Here's what I did:

  1. git clone https://github.com/wikimedia/restbase.git from my user home directory
  2. npm install from within the cloned restbase folder
  3. cp config.example.yaml config.yaml from the same folder
  4. apt-get install libsqlite3-dev as instructed in the config.yaml
  5. Edited the config.yaml to look like this (note that I used localhost everywhere because everything should be running from the same EC2 instance):
 - name: restbase
   module: hyperswitch
   conf: 
     port: 7231
     salt: secret
     default_page_size: 125
     user_agent: RESTBase
     ui_name: RESTBase
     ui_url: https://www.mediawiki.org/wiki/RESTBase
     ui_title: RESTBase docs
     spec:
       x-request-filters:
         - path: lib/security_response_header_filter.js
       x-sub-request-filters:
         - type: default
           name: http
           options:
           allow:
             - pattern: http://localhost/api.php
               forward_headers: true
             - pattern: http://localhost:8142
               forward_headers: true
             - pattern: /^https?:\/\//
       paths:
         /{domain:localhost}:
           x-modules:
             - path: projects/example.yaml
               options:
                 action:
                   # XXX Check API URL!
                   apiUriTemplate: http://localhost/api.php
                   # XXX Check the base RESTBase URI
                   baseUriTemplate: "{{'http://{domain}:7231/{domain}/v1'}}"
                 parsoid:
                   # XXX Check Parsoid URL!
                   host: http://localhost:8142
                 table:
                   backend: sqlite
                   dbname: db.sqlite3
                   pool_idle_timeout: 20000
                   retry_delay: 250
                   retry_limit: 10
                   show_sql: false
                 citoid:
                   host: http://citoid-beta.wmflabs.org
                 mathoid:
                   host: http://mathoid-tester.wmflabs.org
                 mobileapps:
                   host: http://appservice.wmflabs.org
                 purged_cache_control: s-maxage=0, max-age=86400
                 purged_cache_control_client_cache: s-maxage=0, max-age=300

Then I did 'node server' from within the restbase folder to get a restbase server running - it seems to work with a server listening on port 7231. But this is where things don't work as expected.

  1. If I do curl http://localhost/Main_Page I get the html code for my main page on the wiki (so far so good)
  2. If I do curl http://localhost:8142/ I get the html code for the Parsoid welcome page (also good)
  3. If I do curl http://localhost:7231/localhost/v1/ I get: {"items":["page","transform"]} (not sure if this is the correct output but this must mean a Restbase server is running and listening on port 7231 right?)
  4. And if I do curl http://localhost:7231/localhost/v1/page/html/Main_Page I get: {"type":"https://mediawiki.org/wiki/HyperSwitch/errors/server_error","title":"Site info fetch failed.","method":"get","detail":"SiteInfo is unavailable for localhost","uri":"/localhost/v1/page/html/Main_Page"} (this is definitely not right)

When I do number 4 above I should get the html from my main page but it is not working. I'm not sure what I'm doing wrong here - can anyone help?

Seb35 (talkcontribs)

After 3-4 hours, I successfully made RESTBase working myself. I obtain the same results for 1-3, with the additional step

3bis. If you do curl -v -H 'Accept: text/html' 'http://localhost:7231/localhost/v1/' you get the HTML documentation for RESTBase (more easily readable in a browser).

For 4., you should obtain a HTML5+RDFa version of "Main_Page":

  • Did you add in your LocalSettings.php the following parameters?
$wgVirtualRestConfig['modules']['restbase'] = [
  'url' => 'http://localhost:7231',
  'domain' => 'localhost',
  'parsoidCompat' => false
];
$wgVisualEditorFullRestbaseURL = 'http://localhost:7231/localhost/';
  • Also, there is a task about private wikis phab:T88016, possibly RESTBase don’t work in this configuration (I didn’t read in details this task, only saw there was a proposed patch submitted then reverted and another abandoned).
Reply to "MW 1.28.2/Restbase"