Page MenuHomePhabricator

Make Content Translation extension work on mediawiki-docker
Closed, ResolvedPublic

Description

As a tester, I would like to use the new mediawiki-docker environment to test and write tests from the content translation extension. This is the setup for the local installation using XAMP, I used vagrant locally as well for some time, but I moved to XAMP due to simplicity.

@Nikerabbit @santhosh @abi_ @KartikMistry any more info you think that should be provided to Brennen, please add it to the task description. From my experience, the main difference is the database configuration, by default the docker environment uses sqlite and content translation uses sqlserver, correct me if I'm wrong.

Event Timeline

@Jpita I added a note here about using MySQL (https://www.mediawiki.org/wiki/MediaWiki-Docker#Use_MySQL_instead_of_SQLite). There is a tutorials/guides section here https://www.mediawiki.org/wiki/MediaWiki-Docker if you want to create a page for ContentTranslation :)

KartikMistry renamed this task from Make content translation extension work on mediawiki-docker to Make Content Translation extension work on mediawiki-docker.Aug 13 2020, 11:36 AM
KartikMistry updated the task description. (Show Details)
santhosh added a subscriber: brennen.

I am working on this. With https://www.mediawiki.org/wiki/Docker it is not much difficult to get Content Translation up and runnig with its database, cxserver instance. I will document it in detail at https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/ContentTranslation

Followed all steps and MW CX setup is fine with this.

I am working on this. With https://www.mediawiki.org/wiki/Docker it is not much difficult to get Content Translation up and runnig with its database, cxserver instance. I will document it in detail at https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/ContentTranslation

I'm following this tutorial steps and I've encountered this error when I try to run any docker command

➜  mediawiki-docker git:(master) ✗ docker-compose up -d

ERROR: The Compose file './docker-compose.override.yml' is invalid because:
services.cxserver.ports contains an invalid type, it should be a number, or an object

@Jpita can you copy the contents of your .env and docker-compose.override.yml file please?

It seems that somewhere CXSERVER_PORT is being set as a string, instead of as a number (e.g. "8090" instead of 8090).

@Jpita can you copy the contents of your .env and docker-compose.override.yml file please?

It seems that somewhere CXSERVER_PORT is being set as a string, instead of as a number (e.g. "8090" instead of 8090).

I copied the contents from here https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/ContentTranslation

Sorry @kostajh , it was a copy paste issue, I pasted the .env content twice to the file :facepalm:

OK, so after following the steps CORRECTLY (:facepalm:) this time, these are the issues I'm facing:

  • localhost:8080 redirects to http://localhost:8080//wiki/Main_Page (note the double slash after the port)
  • it doesn't seem like the skins are loading even after adding the skins to the LocalSettings.php file
  • cxserver is not running in localhost:8090, even if I try to start it manually from the docker dashboard (inside the docker desktop app) it immediately shuts down

@Jpita in your terminal, if you go to the mediawiki directory and run docker-compose logs cxserver, what do you see? I'm guessing the image failed to build. We should possibly add a prebuilt image to the releng/dev-images repo so that developers who are not working on cxserver itself don't have to build the image. You might also find some useful error logs in mediawiki/cache/mw-error.log

@Jpita in your terminal, if you go to the mediawiki directory and run docker-compose logs cxserver, what do you see? I'm guessing the image failed to build. We should possibly add a prebuilt image to the releng/dev-images repo so that developers who are not working on cxserver itself don't have to build the image. You might also find some useful error logs in mediawiki/cache/mw-error.log

The docker commands ran successfully , I don't see any errors the terminal.

This is the output of docker-compose logs cxserver:

➜  mediawiki git:(master) docker-compose logs cxserver
Attaching to mediawiki_cxserver_1
cxserver_1             |
cxserver_1             | > cxserver@1.2.0 start /opt/cxserver
cxserver_1             | > service-runner
cxserver_1             |
cxserver_1             | Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'
cxserver_1             | npm ERR! code ELIFECYCLE
cxserver_1             | npm ERR! errno 1
cxserver_1             | npm ERR! cxserver@1.2.0 start: `service-runner`
cxserver_1             | npm ERR! Exit status 1
cxserver_1             | npm ERR!
cxserver_1             | npm ERR! Failed at the cxserver@1.2.0 start script.
cxserver_1             | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cxserver_1             |
cxserver_1             | npm ERR! A complete log of this run can be found in:
cxserver_1             | npm ERR!     /root/.npm/_logs/2020-09-08T10_24_24_403Z-debug.log
cxserver_1             |
cxserver_1             | > cxserver@1.2.0 start /opt/cxserver
cxserver_1             | > service-runner
cxserver_1             |
cxserver_1             | Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'
cxserver_1             | npm ERR! code ELIFECYCLE
cxserver_1             | npm ERR! errno 1
cxserver_1             | npm ERR! cxserver@1.2.0 start: `service-runner`
cxserver_1             | npm ERR! Exit status 1
cxserver_1             | npm ERR!
cxserver_1             | npm ERR! Failed at the cxserver@1.2.0 start script.
cxserver_1             | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cxserver_1             |
cxserver_1             | npm ERR! A complete log of this run can be found in:
cxserver_1             | npm ERR!     /root/.npm/_logs/2020-09-08T10_48_02_098Z-debug.log
cxserver_1             |
cxserver_1             | > cxserver@1.2.0 start /opt/cxserver
cxserver_1             | > service-runner
cxserver_1             |
cxserver_1             | Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'
cxserver_1             | npm ERR! code ELIFECYCLE
cxserver_1             | npm ERR! errno 1
cxserver_1             | npm ERR! cxserver@1.2.0 start: `service-runner`
cxserver_1             | npm ERR! Exit status 1
cxserver_1             | npm ERR!
cxserver_1             | npm ERR! Failed at the cxserver@1.2.0 start script.
cxserver_1             | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cxserver_1             |
cxserver_1             | npm ERR! A complete log of this run can be found in:
cxserver_1             | npm ERR!     /root/.npm/_logs/2020-09-08T10_48_08_588Z-debug.log
cxserver_1             |
cxserver_1             | > cxserver@1.2.0 start /opt/cxserver
cxserver_1             | > service-runner
cxserver_1             |
cxserver_1             | Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'
cxserver_1             | npm ERR! code ELIFECYCLE
cxserver_1             | npm ERR! errno 1
cxserver_1             | npm ERR! cxserver@1.2.0 start: `service-runner`
cxserver_1             | npm ERR! Exit status 1
cxserver_1             | npm ERR!
cxserver_1             | npm ERR! Failed at the cxserver@1.2.0 start script.
cxserver_1             | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cxserver_1             |
cxserver_1             | npm ERR! A complete log of this run can be found in:
cxserver_1             | npm ERR!     /root/.npm/_logs/2020-09-08T10_49_27_575Z-debug.log
cxserver_1             |
cxserver_1             | > cxserver@1.2.0 start /opt/cxserver
cxserver_1             | > service-runner
cxserver_1             |
cxserver_1             | Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'
cxserver_1             | npm ERR! code ELIFECYCLE
cxserver_1             | npm ERR! errno 1
cxserver_1             | npm ERR! cxserver@1.2.0 start: `service-runner`
cxserver_1             | npm ERR! Exit status 1
cxserver_1             | npm ERR!
cxserver_1             | npm ERR! Failed at the cxserver@1.2.0 start script.
cxserver_1             | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
cxserver_1             |
cxserver_1             | npm ERR! A complete log of this run can be found in:
cxserver_1             | npm ERR!     /root/.npm/_logs/2020-09-08T10_49_53_371Z-debug.log
➜  mediawiki git:(master)

and this is the files inside mediawiki/cache

➜  mediawiki git:(master) ls cache
composer         mw-debug-cli.log mw-debug-www.log

@Jpita maybe try running docker-compose run cxserver npm install, then docker-compose up -d and see what happens.

@Jpita maybe try running docker-compose run cxserver npm install, then docker-compose up -d and see what happens.

after that I see this on the logs of cxserver docker image:

 > cxserver@1.2.0 dev /opt/cxserver

> nodemon --signal SIGHUP --legacy-watch --inspect=0.0.0.0 ./server.js -n 0


[nodemon] 2.0.4

[nodemon] to restart at any time, enter `rs`

[nodemon] watching path(s): *.*

[nodemon] watching extensions: js,mjs,json

[nodemon] starting `node --inspect=0.0.0.0 ./server.js -n 0`

Debugger listening on ws://0.0.0.0:9229/649ae25d-2550-49c7-86a1-75c4e136f9e4

For help, see: https://nodejs.org/en/docs/inspector

Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'

[nodemon] app crashed - waiting for file changes before starting...

and this is the output of docker ps

as soon as I do docker-composer up on cxserver my system is at 50% CPU and doesn't go down.

from mediawiki-jobrunner1 docker image I have this:

 JobQueueConnectionError from line 768 of /var/www/html/includes/jobqueue/JobQueueDB.php: DBConnectionError:Cannot access the database: Unknown error (mariadb-main)

#0 /var/www/html/includes/jobqueue/JobQueueDB.php(617): JobQueueDB->getReplicaDB()

#1 /var/www/html/includes/jobqueue/JobQueue.php(697): JobQueueDB->doGetSiblingQueuesWithJobs(Array)

#2 /var/www/html/includes/jobqueue/JobQueueGroup.php(371): JobQueue->getSiblingQueuesWithJobs(Array)

#3 /var/www/html/includes/jobqueue/JobQueueGroup.php(253): JobQueueGroup->getQueuesWithJobs()

#4 /var/www/html/includes/jobqueue/JobRunner.php(227): JobQueueGroup->pop(1, 1, Array)

#5 /var/www/html/maintenance/runJobs.php(92): JobRunner->run(Array)

#6 /var/www/html/maintenance/doMaintenance.php(107): RunJobs->execute()

#7 /var/www/html/maintenance/runJobs.php(129): require_once('/var/www/html/m...')

and this

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

No LocalSettings.php - trying again in 10 seconds.

there's also this from the stretch-php72-fpm-apache2-xdebug:0.5.0 image (I'm mixing names of images and types of images, sorry :( )

mediawiki_1 | mv: cannot remove '/docker/PlatformSettings.php': Permission denied

mediawiki_1 | [08-Sep-2020 10:24:22] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root

mediawiki_1 | [08-Sep-2020 10:24:22] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root

mediawiki_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message

mediawiki_1 | mv: cannot remove '/docker/PlatformSettings.php': Permission denied

mediawiki_1 | [08-Sep-2020 14:57:14] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root

mediawiki_1 | [08-Sep-2020 14:57:14] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root

mediawiki_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.3. Set the 'ServerName' directive globally to suppress this message

mediawiki_cxserver_1 exited with code 1

if there's a better way to get the info to you please let me know.
running docker-compose up on the mediawiki folder starts the cxserver image but immediately stops, I need to go to the cxserver folder and do docker-compose up there.

Error while reading config file: Error: ENOENT: no such file or directory, open '/opt/cxserver/config.yaml'

This error is because of missing config.yml for cxserver. It was missing in instructions. I just added it https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/ContentTranslation#Prepare_cxserver

that fixed it, I can now have all images up and running.
now I'm able to reach 0.0.0.0:8090.
on 0.0.0.0:8080 I still get this

.
note the url, there's a double / , not sure that's the cause.
we're getting close though!

I tried everything that is on the tutorial and still can't make it work.
the skin is not loading and when I try to login I get this

I tried everything that is on the tutorial and still can't make it work.
the skin is not loading and when I try to login I get this

@Jpita the instructions were outdated, I've updated them. In your LocalSettings.php file, what does the line towards the top for $wgScriptPath show? It should be $wgScriptPath = "/w". If it isn't, please change it to that and try loading localhost:8080 in your browser again.

YES!!!
IT WORKS!!!
VICTORY!!! https://media.tenor.com/images/6b452d8b4e75114ea57e4d9a8f3c7dee/tenor.gif

Thank you @kostajh!

@santhosh this process is loading SX instead of CX, that's expected?

Yes, that is expected, but can be controlled using configurations as per https://www.mediawiki.org/wiki/Content_translation/CX3

I can't go through any translations because of this error with SX (it shows a loading gif on the edit translation screen)


and this with CX (it shows a blank page when I try to start a new translation)

It seems git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor is wrong and it should be git clone --recursive "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor. Can you remove extensions/VisualEditor and try again with the new command?

It seems git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor is wrong and it should be git clone --recursive "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor. Can you remove extensions/VisualEditor and try again with the new command?

that works perfectly, thanks!
I'll update the wiki page.