Page MenuHomePhabricator

Allow running more than one instance of MediaWiki-Docker
Closed, ResolvedPublic

Description

If you clone core in one directory & run docker-compose up -d, then clone core in another directory and attempt to start the docker-compose stack there, the second will fail because the ports mapping is hardcoded to 8080:8080. You can override port mappings via docker-compose.override.yml but not in a way that replaces the port mapping defined in docker-compose.yml; instead the override port mapping is concatenated to the original one (docs). So docker-compose up will still fail due to a conflict with 8080.

With our current configuration there doesn't seem like a great solution to this other than telling users to run docker-compose stop in one directory before bringing up the stack in another directory.

If we go with T246586: Consider recommending using .env file for MediaWiki-Docker, then one solution would be to change:

version: '3.7'
services:
  mediawiki:
    ports:
      - "8080:8080"

to

version: '3.7'
services:
  mediawiki:
    ports:
      - "${MW_PORT}:8080"

Then we could provide a .env.sample or instructions for users to add MW_PORT=8080 in their .env file (or the wrapper script could do it: T246111) and users would be able to cleanly override the port mappings for each MediaWiki installation.

Event Timeline

Change 576959 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/core@master] [docker] Use a .env file for setting the port and user

https://gerrit.wikimedia.org/r/576959

Change 576959 merged by jenkins-bot:
[mediawiki/core@master] [docker] Use a .env file for setting the port and user

https://gerrit.wikimedia.org/r/576959

kostajh claimed this task.