MediaWiki Docker[part two]

This is part two of my Media Wiki documenation[0]. It has been a while since I’ve looked at this matter, but I planed it to progrss for this.

We stopped with a running docker container with postgresql as the backend databases. However, this change was done manual. Hence, restarting the container would causes us to lose it. We need to persist this change now.

This is done by modfing the base of media wiki to include the psql extension[1] for PHP. Because I can’t change the upstream iamage, i’m going to build it locally. For this we create a new Dockerfile. That Dockerfile takes the media wiki images as the base and runs the command we did run before manual. We keep it with a subfolder of the Docker-compose file.

FROM mediawiki

RUN apt update && apt install -y libpq-dev
RUN docker-php-ext-install pgsql
RUN docker-php-ext-enable pgsql

Afterwards, we can test this by build the image.

docker build -t mediawiki-postgres .

Once the build was successfully compledted I’m going to replace the beviously run instance of media wiki with the newly build one.

docker run --name some-mediawiki -p 8080:80 -d mediawiki-postgres

This will reset the installation routine. However, we do not care because we only want to see that we could install it with the postgres backend. Once the container is start we’re going to localhost:8080 and we can see that the postgres is present! Great.

The next step is to replace the old image within the docker-compose file. Also we’re going to define a a Context. This way we can build it if we want to update.

Update the image:

version: '3'
    image: mediawiki-postgres
    restart: always
      - 8080:80
      - db
    #  - /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

I should not forget to git init and commit at this stage. Now we erestart the container and copy the configuration again. Bam, the previosuve install is presented!

Next step is setting up the first deployment with nginx and let’s encrypt.

so far,