Visual Editor and MediaWiki - Couldn't connect to server

VisualEditor 1.23

Mediawiki 1.23

Parsoid 0.10.0

Error:
apierror-visualeditor-docserver-http-error: (curl error: 7) Couldn't connect to server

The regular editor works. The database works.

What is wrong? Whatever I do, it does not help me. I try manual install to Arch - always the same error.

docker-compose.yml:

version: '3'
services:
  mediawiki:
    build: .
    image: amediawiki32ve
    container_name: mediawiki_wiki
    restart: always
    ports:
      - 8024:80
    links:
      - database
      - parsoid
    volumes:
      - /var/www/html/images
      # After initial setup, download LocalSettings.php to the same directory as
      # this yaml and uncomment the following line and use compose to restart
      # the mediawiki service
      - ./LocalSettings.php:/var/www/html/LocalSettings.php
  database:
    image: mariadb
    restart: always
    environment:
      # @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.php
      MYSQL_DATABASE: my_wiki
      MYSQL_USER: pscn
      MYSQL_PASSWORD: example1
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    ports:
      - 4675:3306
  parsoid:
    image: thenets/parsoid:0.10.0
    ports:
      - 8035:8000
    restart: always
    environment:
      PARSOID_DOMAIN_localhost: localhost:8024/api.php

Dockerfile to build:

FROM mediawiki:1.32

RUN cd /var/www/html/extensions &&\
    git clone -b REL1_32 https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git &&\
    cd VisualEditor &&\
    git submodule update --init

LocalSettings.php (together with automatically generated settings):

$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['parsoid'] = array(
    'url' => 'localhost:8035',
    'domain' => 'localhost'
);

When click Edit:
http://localhost:8024/api.php?action=visualeditor&format=json&paction=parse&page=Strona_główna&uselang=pl&oldid=3

{"error":{"code":"apierror-visualeditor-docserver-http-error","info":"(curl error: 7) Couldn't connect to server","*":"See http://localhost:8024/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}}

And:
http://localhost:8024/load.php?debug=false&lang=pl&modules=diffMatchPatch,papaparse,rangefix,spark-md5,treeDiffer,unicodejs|ext.visualEditor.articleTarget,base,core,data,desktopArticleTarget,desktopTarget,diffing,icons,language,mediawiki,moduleIcons,mwalienextension,mwcore,mwextensionmessages,mwextensions,mwformatting,mwgallery,mwimage,mwlanguage,mwlink,mwmeta,mwsave,mwsignature,mwtransclusion,welcome|ext.visualEditor.core.desktop|ext.visualEditor.mwextensions.desktop|ext.visualEditor.mwimage.core|jquery.uls.data|mediawiki.action.view.redirectPage|mediawiki.diff.styles|mediawiki.language.names|mediawiki.page.gallery.styles|mediawiki.skinning.content.parsoid|mediawiki.widgets|mediawiki.widgets.MediaSearch,UserInputWidget|oojs-ui.styles.icons-layout,icons-user,icons-wikimedia&skin=vector&version=0ixr96x

And:
http://localhost:8024/api.php

{"options":"success"}

For you, Docker exposes mediawiki at localhost:8024, the database at localhost:4675 and parsoid at localhost:8035. The containers know nothing about that (it’s the idea of containers to be isolated). They find each other at mediawiki, database and parsoid. So for example MariaDB is addressed as database:3306, or just database because 3306 is the default port.

I changed localhost:8035 to parsoid:8000 and now I get a 500 error when click Edit.
It means that it has connected, but something inside is wrong?

I do not know what to replace localhost:8024/api.php
I tried different options and nothing changes.

What else can I do?

Yes, it means you can connect.

If you understand the previous change you should know that at localhost:8024 parsoid finds nothing. How about mediawiki/...? Now take care, the Mediawiki API endpoint is found at /w/api.php, not /api.php.
And something else: You will need persistent data for MariaDB. Read “Where to store data” in the image description for more information.

1 Like

In this case, it is in localhost:8024/api.php.
From the system level, the API page opens at this address.
From the mediawiki container, the address curl localhost:80/api.php returns the API page.

From he parsoid container it should be mediawiki:80/api.php.
I try to inside the container parsoid wget mediawiki:80/api.php, returns:
100% | ******************************* | 39459 0:00:00 ETA
And echo $(wget mediawiki:80/api.php -q -O -) returns the API page.

But it does not give me anything as I set it up. Still error 500. Maybe the problem is somewhere else?

Thanks. I just managed to set volumes in the meantime.

I fear I’m not the one who can help you with details about the config of the parsoid container. Quite sure there is a log that tells you exactly what is wrong.

Set:
In LocalSettings.php:
'url' => 'parsoid:8000',
In docker-compose.yml:
PARSOID_DOMAIN_localhost: http://mediawiki:80/api.php

And done.
The addresses were guilty.