|Aurelien Labate 3e2ec7308b||9 months ago|
|php-docker||1 year ago|
|src||9 months ago|
|volumes||1 year ago|
|.env.example||1 year ago|
|.gitignore||1 year ago|
|.gitmodules||9 months ago|
|README.md||1 year ago|
|docker-compose.yml||11 months ago|
|nginx.conf.template||1 year ago|
Docker compose sources to start planete-casio's wiki and tools
The wiki is the only statefull tool of this setup. All the data will be stored in volumes that will be in the
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-en-images: Upload storages of the wiki. You have to restore this if you restore the db. It also contains some image caches.
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.
Then clone this repository onto the server, cd into it and pull submodules
# Put this somewhere only root can access, you weel need to keep this directory for production sudo su cd /srv/ git clone https://gitea.planet-casio.com/devs/tools-compose cd tools-compose # 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
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.
cp .env.example .env # Then edit .env
The following keys are required:
WIKI_BASE_URI: Wiki base uri with protocol, hostname and port. For instance
WIKI_FR_SECRET_KEY: Secret key of the wiki. Should be a 64-character random string.
WIKI_DB_ROOT_PASSWORD: Password of the
rootuser on the database that can, for instance, create other users on the DB.
WIKI_DB_WIKI_PASSWORD: Password of the
wikiuser on the database. This account is used by the application and can only edit the
HTTP_BIND: Port and address on which we will bind the http server
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_FR_UPGRADE_KEY: Upgrade password 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
DEBUG=1 in the
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 ̀
# We will first copy the dump into the container docker cp dump-wiki.sql tools-compose_mariadb-wiki_1:/ # Then start restore the file into the db docker exec -it tools-compose_mariadb-wiki_1 bash -c 'mysql -u root -p wiki < /dump-wiki.sql' # Give the WIKI_DB_ROOT_PASSWORD as password # If it worked, we can delete the file from the container docker exec -it tools-compose_mariadb-wiki_1 rm /dump-wiki.sql
Third, we also need to restore images from the current server
# In my case I will use direct rsync, but we don't care about the method, we only need to copy them # take /var/www/main/(fr|en)/images content and put it into ./volumes/wiki-(fr|en)-images rsync -vr old-pc-wiki.net.labate.me:/var/www/main/fr/images/ ./volumes/wiki-fr-images/ rsync -vr old-pc-wiki.net.labate.me:/var/www/main/en/images/ ./volumes/wiki-en-images/
Once everything has been copied, restart the
docker-compose up to fix permissions on images directories.
We can also ask MediaWiki to purge caches for all pages
docker exec -it tools-compose_phpfpm-wiki_1 php /www/wiki/fr/maintenance/purgeList.php --purge --all docker exec -it tools-compose_phpfpm-wiki_1 php /www/wiki/en/maintenance/purgeList.php --purge --all
If you want to start containers without beeing locked into the logs, start
docker-compose up --build -d
You can still go watch the logs by doing
docker-compose logs -f
TODO explain password set in mysql TODO Debug mode + Phpmyadmin TODO port exposition