I try to setup a Mediawiki with Visual Editor, Parsoid and RESTBase.
I have been able to setup the wiki with only Visual Editor and Parsoid, but when I try to get RESTBase to work, I get a lot of problems.
Sometime I'm able to view the wiki, sometime I get HTTP ERROR 500
. When I get the 500 error, I see this in the apache2 log:
PHP Fatal error: Uncaught InvalidArgumentException: Database must be null or a non-empty string. in /var/www/html/includes/libs/rdbms/database/DatabaseDomain.php:46
Stack trace:
#0 /var/www/html/includes/db/MWLBFactory.php(55): Wikimedia\\Rdbms\\DatabaseDomain->__construct(false, NULL, 'mw_')
#1 /var/www/html/includes/ServiceWiring.php(60): MWLBFactory::applyDefaultConfig(Array, Object(GlobalVarConfig), Object(ConfiguredReadOnlyMode))
#2 [internal function]: MediaWiki\\Services\\ServiceContainer->{closure}(Object(MediaWiki\\MediaWikiServices))
#3 /var/www/html/includes/services/ServiceContainer.php(360): call_user_func_array(Object(Closure), Array)
#4 /var/www/html/includes/services/ServiceContainer.php(344): MediaWiki\\Services\\ServiceContainer->createService('DBLoadBalancerF...')
#5 /var/www/html/includes/MediaWikiServices.php(513): MediaWiki\\Services\\ServiceContainer->getService('DBLoadBalancerF...')
#6 /var/www/html/includes/exception/MWExceptionHandler.php(100): MediaWiki\\MediaWikiServices->getDBLoadBalancerFactory()
#7 /var/w in /var/www/html/includes/libs/rdbms/database/DatabaseDomain.php on line 46
When i not get any 500 error, and can use the site as expected. But, when I try to edit a page with Visual Editor and try to save, I get a HTTP 404 apierror-visualeditor-docserver-http
Edit: See my code at https://github.com/magol/sag-wiki/tree/master/sag-wiki
Settings for Virtual Editor
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => getenv( 'MEDIAWIKI_PARSOID_URL' ),
'domain' => 'localhost',
'prefix' => 'localhost'
);
$wgVirtualRestConfig['modules']['restbase'] = array(
'url' => getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_v1',
'domain' => 'localhost', # matches the "domain" used above
'forwardCookies' => true,
'parsoidCompat' => false
);
$wgVisualEditorRestbaseURL = getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_v1/page/html/';
$wgVisualEditorFullRestbaseURL = getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_';
Settings for RESTbase
services:
- name: restbase
module: hyperswitch
conf:
port: {env(RESTBASE_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
- path: lib/normalize_headers_filter.js
x-sub-request-filters:
- type: default
name: http
options:
allow:
- pattern: '{env(MEDIAWIKI_API_URL,http://localhost/w/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: '{env(MEDIAWIKI_API_URL,http://localhost/w/api.php)}'
# XXX Check the base RESTBase URI
baseUriTemplate: "{{'http://{domain}:7231/{domain}/v1'}}"
parsoid:
# XXX Check Parsoid URL!
host: '{env(PARSOID_HOST_PORT,http://localhost:8142)}'
table:
backend: sqlite
dbname: /data/restbase_tables.sqlite3
pool_idle_timeout: 20000
retry_delay: 250
retry_limit: 10
show_sql: false
mathoid:
host: '{env(MATHOID_HOST_PORT,http://localhost:10044)}'
mobileapps:
host: '{env(MOBILEAPPS_URI,https://appservice.wmflabs.org)}'
citoid:
host: '{env(CITOID_URI,http://localhost:1970)}'
purged_cache_control: s-maxage=0, max-age=86400
purged_cache_control_client_cache: s-maxage=0, max-age=300
# Finally, a standard service-runner config.
info:
name: restbase
logging:
name: restbase
level: '{env(RESTBASE_LOGGING_LEVEL,info)}'
num_workers: 1
Settings for Parsoid
num_workers: '0'
worker_heartbeat_timeout: 300000
logging:
level: info
services:
- module: lib/index.js
entrypoint: apiServiceWorker
conf:
serverPort: 8142
mwApis:
-
uri: 'http://web/w/api.php'
domain: 'localhost'