*`mariadb-wiki` : This is the raw storage of the db. Don't delete this. Avoid copying this between mysql versions, use SQL dumps instead.
*`wiki-fr-images` and `wiki-en-images` : Upload storages of the wiki. You have to restore this if you restore the db. It also contains some image caches.
*`wiki-fr-cache` and `wiki-en-caches` : This is a cache used by the wiki to avoid recomputing all pages for all users. You can safely delete this volume.
First, install the last version of [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) on the server.
# Enable git credential cache because there is multiple submodules that need your password multiple times
git config --global credential.helper cache
# Now init an pull submodules
git submodule init
git submodule update
```
### Configuration
The docker-compose configuration is stored into a `.env` file at the root of the repository. You need to copy the `.env.example` file into `.env` and fill it with a valid configuration.
*`WIKI_BASE_URI`: Wiki base uri with protocol, hostname and port. For instance `https://wiki.planet-casio.com` or `http://wiki.local:8080`
*`WIKI_EN_SECRET_KEY` and `WIKI_FR_SECRET_KEY`: [Secret key](https://www.mediawiki.org/wiki/Manual:$wgSecretKey) of the wiki. Should be a 64-character random string.
*`WIKI_DB_ROOT_PASSWORD`: Password of the `root` user on the database that can, for instance, create other users on the DB.
*`WIKI_DB_WIKI_PASSWORD`: Password of the `wiki` user on the database. This account is used by the application and can only edit the `wiki` database.
*`HTTP_BIND`: Port and address on which we will bind the http server
* This docker compose doesn't support https, so we will generally expose it only to localhost on a given port to have another local server http using it on the host. For instance on port `8000`: `127.0.0.1:8000`.
* If you want to test the server remotely without having another http server, you can expose it directly to the outside world by giving only a port number : `8000`.
*`WIKI_HOSTNAME`: Hostname(s) on which the wiki will be hosted. You can use multiple hostnames by splitting them with spaces.
*`TOOLS_HOSTNAME`: Hostname(s) on which the tools will be hosted. You can use multiple hostnames by splitting them with spaces.
The following keys are optionnal:
*`WIKI_EN_UPGRADE_KEY` and `WIKI_FR_UPGRADE_KEY`: [Upgrade password](https://www.mediawiki.org/wiki/Manual:$wgUpgradeKey) of the wiki. Should be a random non-guessable password. Should be left empty when upgrade is not in progress.
*`WIKI_DEBUG`: Enable the debug mode of the wiki if set to 1. To disable debug mode, leave it empty. When enabled it activates:
We will now use the `docker-compose` utility. To make it work you have to `cd` at the root of this repository.
```
docker-compose up --build
# Always keep the --build part, it will avoid you cache trouble if you play with the configuration of docker-compose
```
You should see everything starting, if something wrong in logs, just to a `Ctrl+C`, fix it and try again. You might also need to clean the `volues` directory which contains the persistent data of containers (wiki database and uploads) to reset everything.
MariaDB take generraly a few seconds to really get started (because it has to start a temp server first to initialize the db), so wait for the following lines to know when it is ready.
```
mariadb-wiki_1 | 2020-01-02 23:15:08+00:00 [Note] [Entrypoint]: Starting temporary server
...
mariadb-wiki_1 | 2020-01-02 23:15:09 0 [Note] mysqld: ready for connections.
...
mariadb-wiki_1 | 2020-01-02 23:16:21+00:00 [Note] [Entrypoint]: Temporary server stopped
...
mariadb-wiki_1 | 2020-01-02 23:16:21+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
...
mariadb-wiki_1 | 2020-01-02 23:16:21 0 [Note] mysqld: ready for connections.
Once the database started, the tools should work as expected. However you should get the following error on the wiki
```
MediaWiki internal error.
```
This is generally because the wiki database has not been filled with a structure. If you want to get more details, you can restart the `docker-compose` with `DEBUG=1` in the `.env` file.
### Init the wiki
To init the wiki you will need a mysql dump of the current wiki. We don't have one without personnal data, but if really needed this might be created and upload to this repo.
First, dump the current database with somehting like this
```
# This should ask you the password of the use `wiki` and create the dump
mysqldump -h old-pc-sql.net.labate.me -u wiki -p wiki > dump-wiki.sql
# This might take some time..
```
Second, restore it to the container. Note that the `wikì` database should already be created so you have to ̀`use` it.