Page MenuHomePhabricator

mw docker mediawiki create fails
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Run mw docker mediawiki create

What happens?:

lectrician1@SethLaptop:~$ MW_PLATFORM=$(uname | tr '[:upper:]' '[:lower:]') bash -c 'curl -s "https://gitlab.wikimedia.org/api/v4/projects/16/packages/generic/mwcli/v0.20.0/mw_v0.20.0_${MW_PLATFORM}_amd64" -o mw && curl -s "https://gitlab.wikimedia.org/api/v4/projects/16/packages/generic/mwcli/v0.20.0/mw_v0.20.0_${MW_PLATFORM}_amd64.sha256" -o mw.sha256 && echo $(cat mw.sha256 | tr -d '\n') " mw" > mw.sha256 && shasum -a 256 -c mw.sha256 && rm -v mw.sha256'
mw: OK
removed 'mw.sha256'
lectrician1@SethLaptop:~$ sudo install mw /usr/local/bin/mw
[sudo] password for lectrician1:
lectrician1@SethLaptop:~$ mw update

You need to choose a development environment mode in order to continue:
 - 'docker' will provide advanced CLI tooling around a new mediawiki-docker-dev inspired development environment.

As the only environment available currently, it will be set as your default dev environment (alias 'dev')

We would like to collect anonymous usage statistics to help improve this CLI tool.
If you accept, these statistics will periodically be submitted to the Wikimedia event intake.
? Do you accept? Yes
New update found: 0.22.1
? Do you want to update? Yes
Updating binary 100% |██████████████████████████████████████████████████████████████| (28/100, 10 it/s)


Binary update failedopen /usr/local/bin/.mw.new: permission denied


lectrician1@SethLaptop:~$ sudo mw update

You need to choose a development environment mode in order to continue:
 - 'docker' will provide advanced CLI tooling around a new mediawiki-docker-dev inspired development environment.

As the only environment available currently, it will be set as your default dev environment (alias 'dev')

We would like to collect anonymous usage statistics to help improve this CLI tool.
If you accept, these statistics will periodically be submitted to the Wikimedia event intake.
? Do you accept? Yes
New update found: 0.22.1
? Do you want to update? Yes
Updating binary 100% |██████████████████████████████████████████████████████████████| (30/100, 10 it/s)


Successfully updated to version v0.22.1

## v0.22.1

CHANGELOG extracted from https://gitlab.wikimedia.org/repos/releng/cli/-/blob/main/CHANGELOG.md

• Fixed  mw docker update  which was panicing (T332336)


lectrician1@SethLaptop:~$ rm -v mw
removed 'mw'
lectrician1@SethLaptop:~$ mw docker mediawiki create
? What directory would you like to store MediaWiki source code in? ~/git/gerrit/mediawiki/core
MediaWiki or Vector is not present in the code directory
You can clone them manually or use `mw docker mediawiki get-code
lectrician1@SethLaptop:~$ mw docker mediawiki get-code
? MediaWiki code not detected in /home/lectrician1/git/gerrit/mediawiki/core. Do you want to clone it now? (Negative answers will abort this command) Yes
? Vector skin is not detected in /home/lectrician1/git/gerrit/mediawiki/core. Do you want to clone it now? Yes
If you want to clone more skins and extensions please use the --skin and --extension options...
? How do you want to interact with Gerrit for the cloned repositores? ssh
? What is your Gerrit username? lectrician1
Cloning repositories...
 - MediaWiki core
 - Skin: Vector
Cloning into '/home/lectrician1/git/gerrit/mediawiki/core'...
remote: Counting objects: 19004, done
remote: Finding sources: 100% (1079698/1079698)
remote: Getting sizes: 100% (37287/37287)
remote: Compressing objects: 100% (250308/250308)
remote: Total 1079698 (delta 911573), reused 1079668 (delta 911555)
Receiving objects: 100% (1079698/1079698), 507.93 MiB | 16.38 MiB/s, done.
Resolving deltas: 100% (911573/911573), done.
Updating files: 100% (8848/8848), done.
Cloning into '/home/lectrician1/git/gerrit/mediawiki/core/skins/Vector'...
remote: Counting objects: 5, done
remote: Total 28819 (delta 0), reused 28819 (delta 0)
Receiving objects: 100% (28819/28819), 7.86 MiB | 13.61 MiB/s, done.
Resolving deltas: 100% (22066/22066), done.
Repositories cloned.
lectrician1@SethLaptop:~$ mw docker mediawiki create
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
1 error(s) decoding:

* error decoding 'Ports': No port specified: :<empty>

What should have happened instead?:

It should have created the containers

Software version (skip for WMF-hosted wikis like Wikipedia):

mwcli: 0.22.1
Ubuntu: 22.04.1

Other information (browser name/version, screenshots, etc.):

This is on a freshly-installed OS.

Event Timeline

Can you run mw -v=2 docker mediawiki create to see what the additional output is please?

$ mw docker mediawiki create -v=2
TRACE mwcli: PersistentPreRun
TRACE embedsync.EnsureFilesOnDisk
TRACE embedsync.EnsureNoExtraFilesOnDisk
TRACE embedsync.EnsureFilesOnDisk
TRACE embedsync.EnsureNoExtraFilesOnDisk
TRACE /usr/bin/docker-compose --project-name mwcli-mwdd-default --project-directory /home/lectrician1/.config/mwcli/mwdd/default --file /home/lectrician1/.config/mwcli/mwdd/default/adminer.yml --file /home/lectrician1/.config/mwcli/mwdd/default/base.yml --file /home/lectrician1/.config/mwcli/mwdd/default/elasticsearch.yml --file /home/lectrician1/.config/mwcli/mwdd/default/eventlogging.yml --file /home/lectrician1/.config/mwcli/mwdd/default/graphite.yml --file /home/lectrician1/.config/mwcli/mwdd/default/keycloak.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mailhog.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mediawiki-fresh.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mediawiki-jobrunner.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mediawiki-quibble.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mediawiki.yml --file /home/lectrician1/.config/mwcli/mwdd/default/memcached.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mysql-replica.yml --file /home/lectrician1/.config/mwcli/mwdd/default/mysql.yml --file /home/lectrician1/.config/mwcli/mwdd/default/phpmyadmin.yml --file /home/lectrician1/.config/mwcli/mwdd/default/postgres.yml --file /home/lectrician1/.config/mwcli/mwdd/default/redis.yml --file /home/lectrician1/.config/mwcli/mwdd/default/shellbox-media.yml --file /home/lectrician1/.config/mwcli/mwdd/default/shellbox-php-rpc.yml --file /home/lectrician1/.config/mwcli/mwdd/default/shellbox-score.yml --file /home/lectrician1/.config/mwcli/mwdd/default/shellbox-syntaxhighlight.yml --file /home/lectrician1/.config/mwcli/mwdd/default/shellbox-timeline.yml up -d mediawiki mediawiki-web
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PORT" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
WARN[0000] The "NETWORK_SUBNET_PREFIX" variable is not set. Defaulting to a blank string.
1 error(s) decoding:

* error decoding 'Ports': No port specified: :<empty>

What is the contents of the .env file in /home/lectrician1/.config/mwcli/mwdd/default/?

And also what is the output of mw docker env list

What is the contents of the .env file in /home/lectrician1/.config/mwcli/mwdd/default/?

And also what is the output of mw docker env list

$ cat .config/mwcli/mwdd/default/.env
MEDIAWIKI_VOLUMES_CODE=/home/lectrician1/git/gerrit/mediawiki/core
MEDIAWIKI_VOLUMES_DOT_COMPOSER=/home/lectrician1/.composer
$ mw docker env list
MEDIAWIKI_VOLUMES_CODE=/home/lectrician1/git/gerrit/mediawiki/core
MEDIAWIKI_VOLUMES_DOT_COMPOSER=/home/lectrician1/.composer

I can confirm this happened to me as well on Ubuntu 22.04, mwcli v0.22.1:

$ mw dev mediawiki create
We would like to collect anonymous usage statistics to help improve this CLI tool.
If you accept, these statistics will periodically be submitted to the Wikimedia event intake.
? Do you accept? No
? What directory would you like to store MediaWiki source code in? mediawiki
MediaWiki or Vector is not present in the code directory
You can clone them manually or use `mw docker mediawiki get-code`

$ mw dev mediawiki get-code
...

$ mw dev mediawiki create
WARNING: The NETWORK_SUBNET_PREFIX variable is not set. Defaulting to a blank string.
WARNING: The PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file '/home/itamar/.config/mwcli/mwdd/default/base.yml' is invalid because:
networks.dps.ipam.config.subnet is invalid: should use the CIDR format
services.nginx-proxy.ports contains an invalid type, it should be a number, or an object

Setting the env vars manually helps, but is not ideal if you are trying to follow the workflow in https://www.mediawiki.org/wiki/Cli/guide/Docker-Development-Environment/First-Setup

Workaround:

$ mw docker env set NETWORK_SUBNET_PREFIX "10.0.0"
$ mw docker env set PORT "8080"