Cli/guide/Docker-Development-Environment/First-Setup

mwcli contains a MediaWiki-Docker-Dev like developer environment.

If you haven't used this development environment before, then this is the guide for you!

If you already have a LocalSettings.php file from a previous developer environment and want to copy settings across please read this guide

If you don't have docker and docker-compose installed, you should install those. And if you are on Linux, you'll need some additional security configuration to be able to run docker without sudo. As of docker 19.3, this is not required, see askubuntu thread [0] for details (and follow the linux postinstall [1] instructions).

[0] askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo

[1] docs.docker.com/engine/install/linux-postinstall/

You may also need to export a couple of environment variables:

MediaWiki services
Let's begin with a basic MediaWiki installation and then create the necessary services.

You will be guided through a setup wizard that covers:


 * The port the development environment should run on.
 * The location to store the MediaWiki code (new or existing directory).
 * Cloning the MediaWiki code (if missing).
 * Cloning the Vector skin (if missing).
 * Options for cloning the code (Github or Gerrit; shallow or regular; over ssh or http).

After you make these choices, the setup wizard will clone the necessary code.

Here's a replay of the wizard:

If you run into a  error, make sure that you are in the   group using. Then run the  command again.

Once the install is complete, you should be able to see a few running services by executing this command:

You should see output that looks something like this:

Database
mwcli can use a variety of databases, but for the purposes of this setup guide, we will focus on MySQL.

You can start a MySQL service for MediaWiki by executing the following command:

As before, using, you should see some new services running:

You'll see that the mysql-replica service has exited, which is just as expected.

MediaWiki installation
The development environment automatically sets various MediaWiki settings, such as database details.

In a fresh install, the setup wizard handles this during installation.

If you have an existing LocalSettings.php, please read this guide.

Install MediaWiki with a MySQL backend using the following command:

This will:


 * Prompt to create a LocalSettings.php file (if needed)
 * Run a Composer install if needed
 * Run MediaWiki's  script to create database tables
 * Run MediaWiki's  to perform any needed updates

When the installer is finished, you will see output that guides you to the login page of your new wiki. Done in 1.7 s.

Installation successful 🎉 User: admin Pass: mwddpassword Link: http://default.mediawiki.mwdd.localhost:8080

If you want to access the wiki from your command line you may need to add it to your hosts file. You can do this with the `hosts add` command that is part of this development environment. You can now log in to your new instance of MediaWiki.