Docker Community Forums

Share and learn in the Docker community.

Visual Editor and MediaWiki - Couldn't connect to server


VisualEditor 1.23

Mediawiki 1.23

Parsoid 0.10.0

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.


version: '3'
    build: .
    image: amediawiki32ve
    container_name: mediawiki_wiki
    restart: always
      - 8024:80
      - database
      - parsoid
      - /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
    image: mariadb
    restart: always
      # @see
      MYSQL_DATABASE: my_wiki
      MYSQL_USER: pscn
      MYSQL_PASSWORD: example1
      - 4675:3306
    image: thenets/parsoid:0.10.0
      - 8035:8000
    restart: always
      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 &&\
    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:

{"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 <> for notice of API deprecations and breaking changes."}}




(Tekki) #2

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?

(Tekki) #4

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.


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.

(Tekki) #6

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.


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

And done.
The addresses were guilty.