Mediawiki: v1.32.1
NodeJS: v10.15.3
Distribution: Debian GNU/Linux 9.8 (stretch)
Parsoid + VisualEditor + Lockdown (with SSL):
1) sudo apt install xs-utils
2) sudo wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz -O /usr/local/src/nodejs-10.15.3.tar.xz
3) sudo tar xf /usr/local/src/nodejs-10.15.3.tar.xz -C /usr/local/ --stript-components 1
4) sudo npm install -g parsoid
5) sudo vim /usr/local/lib/node_modules/parsoid/config.yaml
------ START config.yaml -------
services:
- module: lib/index.js
entrypoint: apiServiceWorker
conf:
mwApis:
- uri: 'http://{{ fqdn }}/{{ mw_wiki_dir_name }}/api.php'
# - uri: 'https://{{ fqdn }}/{{ mw_wiki_dir_name }}/api.php' # If you redirect all HTTP traffic to HTTPS
# - uri: 'http://{{ other_fqdn }}/{{ mw_wiki_dir_name }}/api.php'
------ END config.yaml -------
6) sudo vim /etc/systemd/system/parsoid.service
----- START parsoid.service -----
[Unit]
Description=Mediawiki Parsoid web service on node.js
Documentation=http://www.mediawiki.org/wiki/Parsoid
Wants=local-fs.target network.target
After=local-fs.target network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/usr/local/lib/node_modules/parsoid
ExecStart=/usr/local/bin/node /usr/local/lib/node_modules/parsoid/bin/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog
----- END parsoid.service -----
7) sudo service parsoid start (this load parsoid on port 8000)
8) sudo systemctl enable parsoid
9) sudo apt install stunnel
10) sudo vim /etc/stunnel/parsoid.conf
----- START parsoid.conf -----
cert = /etc/ssl/certs/{{ fqdn }}.crt
key = /etc/ssl/private/{{ fqdn }}.key
CAfile = /etc/ssl/certs/ca-certificates.crt
[parsoid]
accept = 8143
connect = 8000
----- END parsoid.conf -----
11) sudo vim /etc/default/stunnel4
----- START stunnel4 -----
...
# Change to one to enable stunnel automatic startup
ENABLED=1
...
----- END stunnel4 -----
12) sudo service stunnel4 restart (now you can reach parsoid on 8143)
13) sudo vim .../w/LocalSettings.php
----- START LocalSettings.php -----
...
// NEW Namespaces
define("NS_NEW_1", 3000);
define("NS_NEW_1_TALK", 3001);
$wgExtraNamespaces[NS_NEW_1] = "NEW1";
$wgExtraNamespaces[NS_NEW_1_TALK] = "NEW1_talk"; # Note underscores in the namespace name.
$wgNamespaceProtection[NS_NEW_1] = array( 'edit-new1' ); # "edit-new1" required to edit NEW1:pages
$wgNamespaceProtection[NS_NEW_1_TALK] = array( 'edit-new1-talk' ); # "edit-new1-talk" required to edit NEW1_talk:pages
$wgNamespacesWithSubpages[NS_NEW_1] = true; # subpages enabled for the NEW1 namespace
$wgGroupPermissions['new1']['edit-new1'] = true; # permission "edit-new1" granted to users in the "new1" group
$wgGroupPermissions['new1']['edit-new1-talk'] = true; # permission "edit-new1-talk" granted to users in the "new1" group
$wgContentNamespaces[] = NS_NEW_1; #prevent inclusion of pages from that namespace
$wgNonincludableNamespaces[] = NS_NEW_1;
$wgNonincludableNamespaces[] = NS_NEW_1_TALK;
wfLoadExtension( 'Lockdown' );
#restrict all permissions on pages with namespace "NEW" to users belonging to 'new1' group
$wgNamespacePermissionLockdown[NS_NEW_1]['*'] = array('new1');
$wgNamespacePermissionLockdown[NS_NEW_1_TALK]['*'] = array('new1');
wfLoadExtension( 'VisualEditor' );
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['parsoid'] = array(
// URL to the Parsoid instance
// Use port 8142 if you use the Debian package
'url' => 'https://{{ fqdn }}:8143',
'forwardCookies' => true,
);
$wgVisualEditorAvailableNamespaces = [
NS_MAIN => true,
NS_USER => true,
NS_HELP => true,
NS_NEW_1 => true,
];
...
----- END LocalSettings.php -----
Parsoid + VisualEditor (without SSL):
1) sudo apt install xs-utils
2) sudo wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz -O /usr/local/src/nodejs-10.15.3.tar.xz
3) sudo tar xf /usr/local/src/nodejs-10.15.3.tar.xz -C /usr/local/ --stript-components 1
4) sudo npm install -g parsoid
5) sudo vim /usr/local/lib/node_modules/parsoid/config.yaml
------ START config.yaml -------
services:
- module: lib/index.js
entrypoint: apiServiceWorker
conf:
mwApis:
- uri: 'http://{{ fqdn }}/{{ mw_wiki_dir_name }}/api.php'
# - uri: 'https://{{ fqdn }}/{{ mw_wiki_dir_name }}/api.php' # If you redirect all HTTP traffic to HTTPS
# - uri: 'http://{{ other_fqdn }}/{{ mw_wiki_dir_name }}/api.php'
------ END config.yaml -------
6) sudo vim /etc/systemd/system/parsoid.service
----- START parsoid.service -----
[Unit]
Description=Mediawiki Parsoid web service on node.js
Documentation=http://www.mediawiki.org/wiki/Parsoid
Wants=local-fs.target network.target
After=local-fs.target network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/usr/local/lib/node_modules/parsoid
ExecStart=/usr/local/bin/node /usr/local/lib/node_modules/parsoid/bin/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog
----- END parsoid.service -----
7) sudo service parsoid start (this load parsoid on port 8000)
8) sudo systemctl enable parsoid
9) sudo apt install stunnel
10) sudo vim .../w/LocalSettings.php
----- START LocalSettings.php -----
...
// NEW Namespaces
define("NS_NEW_1", 3000);
define("NS_NEW_1_TALK", 3001);
$wgExtraNamespaces[NS_NEW_1] = "NEW1";
$wgExtraNamespaces[NS_NEW_1_TALK] = "NEW1_talk"; # Note underscores in the namespace name.
$wgNamespaceProtection[NS_NEW_1] = array( 'edit-new1' ); # "edit-new1" required to edit NEW1:pages
$wgNamespaceProtection[NS_NEW_1_TALK] = array( 'edit-new1-talk' ); # "edit-new1-talk" required to edit NEW1_talk:pages
$wgNamespacesWithSubpages[NS_NEW_1] = true; # subpages enabled for the NEW1 namespace
$wgGroupPermissions['new1']['edit-new1'] = true; # permission "edit-new1" granted to users in the "new1" group
$wgGroupPermissions['new1']['edit-new1-talk'] = true; # permission "edit-new1-talk" granted to users in the "new1" group
$wgContentNamespaces[] = NS_NEW_1; #prevent inclusion of pages from that namespace
$wgNonincludableNamespaces[] = NS_NEW_1;
$wgNonincludableNamespaces[] = NS_NEW_1_TALK;
wfLoadExtension( 'Lockdown' );
#restrict all permissions on pages with namespace "NEW" to users belonging to 'new1' group
$wgNamespacePermissionLockdown[NS_NEW_1]['*'] = array('new1');
$wgNamespacePermissionLockdown[NS_NEW_1_TALK]['*'] = array('new1');
wfLoadExtension( 'VisualEditor' );
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['parsoid'] = array(
// URL to the Parsoid instance
// Use port 8142 if you use the Debian package
'url' => 'http://127.0.0.1:8000',
'forwardCookies' => true,
);
$wgVisualEditorAvailableNamespaces = [
NS_MAIN => true,
NS_USER => true,
NS_HELP => true,
NS_NEW_1 => true,
];