VisualEditor/Installation on a shared host

From mediawiki.org

VisualEditor requires a Parsoid service, which in turn requires Node.js. Most shared-hosting companies don't provide this. If you cannot move your wiki to a dedicated hosting solution such as a VPS, then a workaround is to install Parsoid on a cloud platform which supports Node.js, such as Heroku.com.

Part 1: Heroku.com[edit]

  1. Sign up with Heroku.com
  2. Create a new app
  3. Go to your app settings
  4. Scroll to the Buildpack section
  5. Add a new buildpack
  6. Select Node.js

Part 2: Your local computer[edit]

  1. Install the Heroku Command Line Interface and log in
  2. Clone Parsoid with git clone https://gerrit.wikimedia.org/r/mediawiki/services/parsoid
  3. Enter the Parsoid directory you just created, for example with cd parsoid
  4. Edit the hidden file .gitignore and remove the lines config.yaml and composer.lock
  5. Create your config file by copying config.example.yaml and renaming it to config.yaml
  6. Edit the config.yaml file you just created by changing the example URI for the URL of your API, for example uri: 'http://www.mywiki.com/w/api.php'
  7. If your wiki uses https, then uncomment the line strictSSL: false
  8. If the domain: 'localhost' line is uncommented, comment it (helps to avoid the "Invalid domain" error)
  9. Save the changes
  10. Add the Heroku remote to your git repo with heroku git:remote -a APPNAME
  11. Stage the edited config files for committing with git add .
  12. Commit your changes with git commit -am "Initial commit"
  13. Push and deploy your changes with git push heroku master
  14. Visit https://APPNAME.herokuapp.com to verify that your Parsoid service works

Part 3: Your wiki[edit]

  1. Download VisualEditor (don't forget to run git submodule update --init as explained in the link)
  2. Add to your LocalSettings.php:
    wfLoadExtension( 'VisualEditor' );
    $wgVisualEditorEnableWikitext = true;
    $wgDefaultUserOptions['visualeditor-newwikitext'] = 1;
    $wgDefaultUserOptions['visualeditor-enable'] = 1;
    $wgDefaultUserOptions['visualeditor-editor'] = 'visualeditor';
    $wgVirtualRestConfig['modules']['parsoid'] = [
    	'forwardCookies' => true,
    	'url' => 'https://APPNAME.herokuapp.com'
    ];
    
  3. Done! Visit your wiki, edit any page and save the changes to test it out!

See also[edit]

External resources[edit]