207Mediawiki - amagerard/Docker GitHub Wiki

Docker/Home

Ubuntu/Casaos.

1-Casaos 2- Portainer 3- Drupal 4- Joomla 5-Wordpress
6-Xwiki 7- Mediawiki 8- Httpd
Docker Zimaos

7. Mediawiki.

MediaWiki is a wiki engine for the web.

This procedure is based on this example.

Ubuntu ip : 192.168.60.8/24
Casaos version: v0.4.15
Your username: teacher
Your home directory:/home/teacher

7.1 Create Network and Volumes with Portainer.

Open Portainer for create network and volumes.
http://192.168.60.8:9000

Click on Environments Local.

7.1.1 Each Mediawiki instance has its container.

  • cnt_mki_wb_number.
  • cnt_mki_db_number.
    Containers will be created from Casaos graphical interface.

7.1.2 Each Mediawiki instance has its network.

  • net_mki_number.
    Create net_mki_1.
Select Networks.  
Add network.  
Name : net_mki_1  
Add Driver options:  
Name : com.docker.network.bridge.name   value : net_mki_1  
Create the network.  

Name: com.docker.network.bridge.name value : net_mki_1 is not specified, docker will give it a name as br-XXXX.

7.1.3 Each Mediawiki instance has its volume.

  • vol_mki_wb_number.
  • vol_mki_db_number.
    Create these volumes.
Select Volumes.  
Add volume.  
Name: vol_mki_wb_1  
Create the volume.  
Add the volume.  
Name: vol_mki_db_1  
Create the volume.  

7.2 Install Mediawiki with a yaml script.

Copy this script in notepad, kate, gedit or another text editor
and save with a name that has a yaml extension.

# 2025, January  
# replace number  by 1 or 2 or ... until 9  
# example n = 1  
# port published wb = 8081  
# port published db = 33771  
# ip = 192.168.60.8  
# your username is teacher  
# you must create network net_mki_1    from portainer before installing mediawiki.  
# you must create volume vol_mki_wb_1  from portainer before installing mediawiki.  
# you must create volume vol_mki_db_1  from portainer before installing mediawiki.  
# you must upload  the newly created LocalSettings.php file under /DATA/Documents/docker/files/mediawiki_1 before the second installing of mediawiki.  
#  
## you cannot  delete  /DATA/Documents/docker/files/mediawiki_1/LocalSettings.php  
#  
# Be careful with the tab, the indentation is 4 characters.  
#  
name: mediawiki_1  ## change  n of mediawiki_n  
services:  
    mediawiki:  
        cpu_shares: 90  
        command: []  
        container_name: cnt_mki_wb_1  ## change  n  of cnt_mki_wb_n  
        depends_on:  
            mediawikidb:  
                condition: service_started  
                restart: true  
                required: true  
        deploy:  
            resources:  
                limits:  
                    memory: 2048M  
        environment: []  
        hostname: cnt_mki_wb_1  ## change n to cnt_mki_wb_n  
        image: mediawiki:latest  
        links:  
            - mediawikidb:mariadb  
        ports:  
            - target: 80  
              published: '8081'  ## change  n of 808n  
              protocol: tcp  
        restart: always  
        volumes:  
            - /var/lib/docker/volumes/vol_mki_wb_1/_data:/var/www/html/images # create volume from portainer and change  n of vol_mki_wb_n  
            # 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  
            #- /DATA/Documents/docker/files/mediawiki_1/LocalSettings.php:/var/www/html/LocalSettings.php # upload newly created LocalSettings.php in the folder/DATA/Documents/docker/files/mediawiki_1/ and remove the "#"  
        devices: []  
        cap_add: []  
        network_mode: net_mki_1 # create network  from portainer and change  n of net_mki_n  
        privileged: false  
    mediawikidb:  
        cpu_shares: 90  
        container_name: cnt_mki_db_1  # change  n  of cnt_mki_db_n  
        command: []  
        deploy:  
            resources:  
                limits:  
                    memory: 2048M  
        environment:  
            - MYSQL_DATABASE=my_wiki  
            - MYSQL_USER=wikiuser  
            - MYSQL_PASSWORD=password  # as you want  
            - MYSQL_RANDOM_ROOT_PASSWORD=yes  
        hostname: cnt_mki_db_1 ## change  n of cnt_mki_db_n  
        image: mariadb:latest  
        ports:  
            - target: 3306  
              published: '33771'  ## change  n to  3377n  
              protocol: tcp  
        restart: always  
        volumes:  
            - /var/lib/docker/volumes/vol_mki_db_1/_data:/var/lib/mysql  ## create volume from portainer and change  n of vol_mki_db_n  
        devices: []  
        cap_add: []  
        network_mode: net_mki_1  # create network  from portainer and change  n of net_mki_1  
        privileged: false  
  
x-casaos:  
    author: self  
    category: self  
    hostname: 192.168.60.8  ## change IP  
    icon: https://upload.wikimedia.org/wikipedia/commons/3/3d/Mediawiki-logo.png  # check if existe  
    index: /  
    is_uncontrolled: false  
    port_map: '8081' ## change  n of  808n  
    scheme: http  
    store_app_id: mediawiki_1  ## change  n of  mediawiki_n  
    title:  
        custom: mediawiki_1 ## change  n  of mediawiki_n  

Information.
If you want to change your Mediawiki instance in 2,
Edit this file and replace _1 by _2.
Then replace the port 8081 by 8082
and 33771 by 33772.
You will need to create a mediawiki_2 folder under /DATA/Documents/docker/files/
because the LocalSettings file will be different.

7.3 First Installation for initial setup.

Installing Mediawiki is done in 2 steps:

  • 1- After initial setup, download LocalSettings.php to the directory as /DATA/Documents/docker/files/mediawiki_1.
  • 2- Add a Volume in Mediawiki icon settings:
    Host:/DATA/Documents/docker/files/mediawiki_1/LocalSettings.php
    Container: /var/www/html/LocalSettings.php

7.3.1 Step 1. First Install.

Open casaos.
http://192.168.60.8

Click on the "+" which is located in the middle right of the browser web page.
install a customized app.
Click on right top who name "import".
Import.
Click on Drag your Docker Compose here or click to upload.
Search your script yaml .
Submit.
OK and OK.
Install.

7.3.2 Step 1. First access Mediawiki.

Open Mediawiki.
http://192.168.60.8:8081.

First page :setup the wiki first.
Language:
Your Language :en - English.
Wiki language :en - English
Continue.
All is OK : Continue.
Connect to database:
Database type:MariasDB.
Database host:cnt_mki_db_1.
Identify this wiki:
Database name:my_wiki.
User account for installation:
Database username:wikiuser.
Database password:password.
Continue.
Database settings:
Use the same account as for installation.
Continue.
Name:
Name of wiki:mybeautifulweb.
Administrator account:
Your username: adminwiki.
Password (10 characters) :as you want.
Email address:as you want;
I'm bored already, just install the wiki.
Install
Continue for Begin the installation.
Install database.
Database was successfully setup.
Continue.
The installer has generated a LocalSettings.php file.
Your LocalSettings.php file is located in your browser's downloads folder.

7.4 LocalSettings.php.

Before downloading LocalSettings in /DATA/Documents/docker/files/mediawiki_1,
add the extensions to the end of the LocalSettings.php file.

# Add  extensions  
wfLoadExtensions( [ 'Cite', 'CiteThisPage', 'ParserFunctions', 'ConfirmEdit', 'InputBox', 'Gadgets', 'ImageMap', 'Nuke' , 'ParserFunctions','PdfHandler', 'SpamBlacklist', 'Poem', 'TitleBlacklist'] );  
  
## Editor VisualEditor  
wfLoadExtension( 'VisualEditor' );  
  
## WikiEditor  
wfLoadExtension( 'WikiEditor' );  
$wgHiddenPrefs[] = 'usebetatoolbar';  
$wgDefaultUserOptions['showtoolbar'] = true;  
$wgDefaultUserOptions['usebetatoolbar'] = 1;  
  
## SyntaxHighlight  
wfLoadExtension( 'SyntaxHighlight_GeSHi' );  

Also change UTC.
How find your Time Zone.
Open a terminal console.
timedatectl list-timezones
Example: "Australia/Sydney".

# Time zone  
#$wgLocaltimezone = "UTC";  
$wgLocaltimezone = "Autralia/Sydney";  

And allow uploads.

$wgEnableUploads = true;  

7.5 Upload LocalSettings.php.

Open Casaos.
http://192.168.60.8.

Click on File icon.
Then in Documents.
Right Click and choose New folder.
Name: docker
Not shared - Submit.
Then in docker folder.
Right Click and choose New folder.
Name: files.
Not shared - Submit.
Then in files folder.
Right Click and choose New folder.
Name: mediawiki_1.
Not shared - Submit.
Right Click and choose Uploads LocalSettings.php file.

You can modify LocalSettings.php but not delete it.

7.6 Step 2. Second install mediawiki.

Open Casaos.
http://192.168.60.8.
Click on Settings from mediawiki_1 icon.
Find Volumes parameters.
Click on Add.
Host:/DATA/Documents/docker/files/mediawiki_1/LocalSettings.php
Container: /var/www/html/LocalSettings.php
Click on Save.

7.7 Attach volumes with containers.

On portainer, by default the volumes are marked Unused.

Open Portainer.
http://192.168.60.8:9000

Click on Environments Local.

Select Container cnt_mki_wb_1.
Stop cnt_mki_wb_1.
Click on cnt_mki_wb_1.
Click Duplicate/Edit.
Advanced container settings.
Click on Volumes.
Volumes mapping.
Choose container /var/www/html/images.
Click on Volume.
Select a Volume.
Choose vol_mki_wb_1 - local.
Click on Deploy the container.
Click on Replace.

Select containers cnt_mki_db_1.
Stop cnt_mki_db_1.
Click on cnt_mki_db_1.
Click Duplicate/Edit.
Advanced container settings.
Click on Volumes.
Volumes mapping.
Choose container /var/lib/mysql.
Click on Volume.
Select a Volume.
Choose vol_mki_db_1 - local.
Click on Deploy the container.
Click on Replace.

7.8 Open Mediawiki.

http://192.168.60.8:8081

Log in adminwiki.

Mediawiki is ready.