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:
- git clone https://github.com/wikimedia/restbase.git from my user home directory
- npm install from within the cloned restbase folder
- cp config.example.yaml config.yaml from the same folder
- apt-get install libsqlite3-dev as instructed in the config.yaml
- 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.
- If I do curl http://localhost/Main_Page I get the html code for my main page on the wiki (so far so good)
- If I do curl http://localhost:8142/ I get the html code for the Parsoid welcome page (also good)
- 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?)
- 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?