Skip to content

Instantly share code, notes, and snippets.

@onokatio
Last active January 7, 2018 13:17
Show Gist options
  • Save onokatio/0af244a85429b86908f38bdcedfbbc85 to your computer and use it in GitHub Desktop.
Save onokatio/0af244a85429b86908f38bdcedfbbc85 to your computer and use it in GitHub Desktop.
Mediawikiにビジュアルエディタを導入する ref: https://qiita.com/onokatio/items/5bbfb3ad268c803b2b63
allow:
- pattern: http://localhost/wiki/api.php
(略)
- pattern: http://localhost:8000
(略)
paths:
/{domain:localhost}:
action:
# XXX Check API URL!
apiUriTemplate: http://localhost/wiki/api.php
(略)
parsoid:
# XXX Check Parsoid URL! localhost is the default configuration
host: http://localhost:8000
$ cd extensions
$ wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_30-61f161a.tar.gz
$ tar xvf ./Visu..(略)..tar.gz
$ sudo systemctl status parsoid
● parsoid.service - Mediawiki Parsoid web service on node.js
Loaded: loaded (/etc/systemd/system/parsoid.service; disabled)
Active: active (running) since Sun 2018-01-07 15:49:07 JST; 52s ago
Docs: http://www.mediawiki.org/wiki/Parsoid
Main PID: 11048 (node)
CGroup: /system.slice/parsoid.service
└─11105 /usr/bin/nodejs /path/to/parsoid/node_modules/service-runner/service-runner.js
Jan 07 15:49:10 rpi3 node[11048]: {"name":"parsoid","hostname":"localhost","pid":11048,"level":30,"levelPath":"info/service-runner","msg":"master(11048) initializing 4 workers","time":"2018-01-07T06:49:10.607Z","v":0}
$ git clone https://github.com/wikimedia/restbase.git
$ npm install
$ cp config.example.yaml config.yaml
$ sudo systemctl daemon-reload
$ sudo systemctl start parsoid
$ sudo systemctl status parsoid
$ sudo systemctl enable parsoid #自動起動の設定
$ git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
$ cd parsoid
$ npm install
$ cp config.example.yaml config.yaml
$ sudo systemctl daemon-reload
$ sudo systemctl start parsoid
$ sudo systemctl status parsoid
$ sudo systemctl enable parsoid #自動起動の設定
wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVisualEditorAvailableNamespaces = [
NS_MAIN => true,
NS_USER => true,
102 => true,
"_merge_strategy" => "array_plus"
];
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => 'http://localhost:8000',
'domain' => 'localhost',
'prefix' => 'localhost'
);
PORT=8000
NODE_PATH=/path/to/parsoid/node_modules
[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=www-data
Group=www-data
WorkingDirectory=/path/to/parsoid
EnvironmentFile=-/path/to/parsoid/parsoid.env
ExecStart=/usr/bin/nodejs /path/to/parsoid/bin/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog
[Unit]
Description=Mediawiki RESTBase service
Documentation=https://www.mediawiki.org/wiki/RESTBase
Wants=local-fs.target network.target
After=local-fs.target network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/path/to/restbase/node_modules
ExecStart=/usr/bin/node /path/to/restbase/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment