MWStake MediaWiki Manager: Difference between revisions

From MWStake
Jump to navigation Jump to search
No edit summary
No edit summary
 
(99 intermediate revisions by the same user not shown)
Line 1: Line 1:
''Manage (settings), upgrades, extensions, snapshots and content through an independent UI/API''
'''[https://mwstake.org/mwstake/wiki/Special:AllPages?from=MWStake&to=&namespace=0 SUBPAGES]'''


<gallery mode="slideshow">
'''[https://github.com/dataspects/mediawiki-manager/search?q=CreateCampEMWCon2021 GitHub Repo Tag "CreateCampEMWCon2021"]'''
File:mediawiki-manager-Service-Architecture.png|MWM Service Architecture
Code Base at              https://github.com/dataspects/mediawiki-manager
File:Mediawiki-manager-InteractionLogics.png|MWM Interaction Logics
Development Discussion at https://riot.im/app/#/room/#mwdeployment:matrix.org
File:Mediawiki-manager-UI.png|MWM UI
File:Mediawiki-manager-ExtensionsStore.png|MWM Extensions Store
</gallery>


== Development Broadcasting ==
== Project Reasoning and Potential Goals ==


There are videos about MWStake MWM at [https://www.youtube.com/channel/UCoP-EgZJPhB0UE4WaKCHR1w dataspects' YouTube channel].
Facilitate managing all aspects and use cases regarding the operation of MediaWiki instance(s)


* [https://www.youtube.com/watch?v=MTYq2a2Xsls First glimpse at the idea of an MWStake MediaWiki Manager]
# Across set up modes and operating systems
# Targeting all user groups accordingly
# Conveying best practices
# Component monitoring and certification services
# Not integrated, but besides MediaWiki instance(s)
# Install/configure/upgrade system(s)
# Install/enable/disable/upgrade/configure extensions
#* MediaWiki Stakeholders Group Certified Extensions Service
# Backup/restore/clone/compare/consolidate system(s) (snapshots)
# Inject/extract/facet/edit/consolidate/import/export/remove apps/structures/ontologies
#* MediaWiki Stakeholders Group Certified Apps Service
# Script/automate/schedule tasks
# Package/move/archive/migrate system(s)
# ORTHOGONAL MODULARITY


== Target User Groups ==
__TOC__


=== UGCL: Users willing/able to use the command line ===
== Backlog ==


=== UGUI: Users NOT willing/able to use the command line ===
* Permissions (owner, group, rwx, executing user, etc.)
* Apache (SSL, configuration)
* Certified extensions and apps catalog (selection, fields, mechanisms, policies, stewardship)
* SSO
* Search


== Use Cases ==
== MWM Implementation Aspects ==


=== Install MW System Instance ===
'''How and Why?'''


=== Manage MW System Settings ===
* Dissect system&hellip;
* &hellip;into as few as possible but into as many as necessary interfacing components&hellip;
* &hellip;in order to fulfill all intended use cases&hellip;
* &hellip;in accordance with corresponding users' capabilities and needs.


# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/systemSettings.json systemSettings.json]
=== Abstraction Layers ===


=== Manage MW Extensions (install/enable/disable/upgrade) ===
CLI <-- API <-- UI


# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/extensions.json extensions.json]
# UI is GUI for API
# API wraps CLI
# [https://github.com/dataspects/mediawiki-manager/tree/main/cli CLI means bash scripts covering all use cases]


==== MediaWiki Stakeholders Group Certified Extensions Service =====
=== [https://podman.io/ Podman]-managed [https://github.com/dataspects/mediawiki-manager/blob/main/mediawiki-manager.tpl MWM Kubernetes deploy manifest] ("Containers") ===
# Pod "mwm"
# [https://github.com/dataspects/dataspectsSystemBuilder/tree/master/docker-images/mediawiki Container "mediawiki"] + [https://github.com/dataspects/mediawiki-manager/blob/main/mediawiki-manager.tpl user volumes] and [https://github.com/dataspects/mediawiki-manager/tree/main/envs config envs]
# Container "mariadb" + config envs


* Some background:
==== Config envs ====
** [[Action:7]]
Pending: [http://docs.podman.io/en/latest/markdown/podman-secret.1.html podman secret]
** [[Talk:MWStake_incorporation/Board_meeting]]
{|
* Format right now: https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/extensions.json
|<syntaxhighlight lang=bash>
* Management, roles, responsibilities, privileges, processes, QA?
# my-new-system.env
* Hosting?
export WG_DB_PASSWORD=8n65f%6n5
</syntaxhighlight>
|&rArr; envsubst &rArr;
|<syntaxhighlight lang=bash>
# mediawiki-manager.yml
...
containers:
  - image: docker.io/dataspects/mediawiki:1.35.0-2104121740
    name: mediawiki
    env:
      - name: WG_DB_PASSWORD
        value: 8n65f%6n5
      - ...
...
</syntaxhighlight>
|&rArr;
|<syntaxhighlight lang=php># Localsettings.php
$wgDBpassword = getenv("WG_DB_PASSWORD");


=== Upgrade MW ===
</syntaxhighlight>
|}
 
==== Config database ====
 
{|
|<syntaxhighlight lang=php>
<?php
# addToMWMSQLite.php


# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/versions.json upgrades.json]
$name  = $argv[1];
$localsettingsdirectives = $argv[2];
$db = new SQLite3('mwmconfigdb.sqlite');


=== Snapshots (backup/restore/clone) ===
$stmt = $db->prepare('INSERT INTO extensions (name, localsettingsdirectives) VALUES ( :name, :localsettingsdirectives)');
$stmt->bindValue(':name', $name, SQLITE3_TEXT);
$stmt->bindValue(':localsettingsdirectives', $localsettingsdirectives, SQLITE3_TEXT);


=== Safe Mode ===
$stmt->execute();
</syntaxhighlight>
|&rArr;
|<syntaxhighlight lang=php>
<?php
# updateMWMLocalSettings.php


'''Idea''': if someone corrupts <code>extensions/</code> and/or <code>LocalSettings.php</code>, then <code>./start-SAFE-MODE.sh</code> restarts the wiki in safe mode, by falling back to container-internal versions of <code>extensions/</code> and <code>LocalSettings.php</code>.
$db = new SQLite3('mwmconfigdb.sqlite');
$stmt = $db->prepare('SELECT localsettingsdirectives FROM extensions');
$result = $stmt->execute();


[[File:MWMSafeModeAlert.png]]
$mwmLocalSettingsString = "";
while($res = $result->fetchArray(SQLITE3_ASSOC)){
    $mwmLocalSettingsString .= trim($res["localsettingsdirectives"])."\n";
}


$mwmLS = fopen("mwmLocalSettings.php", "w");
fwrite($mwmLS, "<?php\n".$mwmLocalSettingsString);
fclose($mwmLS);
</syntaxhighlight>
|&rArr;
|<syntaxhighlight lang=php># Localsettings.php
$mwmls = "../mwmLocalSettings.php";
# MWStake MediaWiki Manager
if(file_exists($mwmls)) {
require_once($mwmls);
} else {
echo "ERROR: ".$mwmls." include not loaded.";
}
</syntaxhighlight>
|}
== Target User Groups ==
<div style="margin:20px; padding:50px; border-radius:50px; background-color:beige;">
'''Who can use the concepts in MWM how?'''
Here I try to segregate target users into groups that share capabilities and needs.
{|class=wikitable
{|class=wikitable
!MWM Normal Mode
!User Group
!MWM Safe Mode
!Point/Select/Type/Click
!CLI/SSH
!Scripting
!Edit configuration junior
!Edit configuration senior
|-
|-
|''Examples''
|''"Web Interface"''
|
|''Automate/schedule tasks''
*''CLI: e.g. [https://github.com/dataspects/mediawiki-manager/blob/main/cli/manage-extensions/tests.sh manage extensions]''
*''API: (pending)''
|
*''Edit LocalSettings.php''
*''Run composer''
|
|
[[File:mwm-normal-mode.png]]
PLUS
https://github.com/dataspects/mediawiki-manager/blob/main/start.sh
*''Interpret logs''<br>
<syntaxhighlight lang=yaml>
*''Report bugs/feature request''<br>
version: "3.7"
*''Branch code, develop and PR''
services:
|-
  mediawiki:
|{{mo|'''UGUI'''}} "WebAdmin"
    env_file:
|Yes
      - CanastaInstanceSettings.env
| -
    container_name: mediawiki_canasta
|"Macro" style only from within UI<br>("Excel Record Macro Style")
    image: dataspects/mediawiki:1.35.0-2103040820
| -
    ports:
| -
      - 80:80
|-
      - 443:443
|{{mo|'''UGAdmin'''}} "SysAdmin"
    volumes:
|Yes
      # MediaWiki >>>
|Yes
      - ./mediawiki_root/w/LocalSettings.php:/var/www/html/w/LocalSettings.php
|Run/arrange .sh scripts
      - ./mediawiki_root/w/extensions:/var/www/html/w/extensions
|Yes
      - ./mediawiki_root/w/skins:/var/www/html/w/skins
| -
      - ./mediawiki_root/w/vendor:/var/www/html/w/vendor
|-
      - ./mediawiki_root/w/images:/var/www/html/w/images
|{{mo|'''UGCoder'''}} "Developer"
      # MediaWiki Manager >>>
|Yes
      - ./mediawiki_root/api:/var/www/html/api
|Yes
      - ./mediawiki_root/dsmwm.log:/var/www/html/dsmwm.log
|Run/arrange/compose/create/edit .sh scripts including API calls
      - ./mediawiki_root/restic_password:/var/www/html/restic_password
|Yes
      - ./mediawiki_root/ui:/var/www/html/ui
|Yes
      - ./mediawiki_root/cloneLocation:/var/www/html/cloneLocation
|}
      - ./restic_data:/var/www/html/restic-repo
</div>
      - ./conf:/etc/apache2/sites-available
 
    # https://phabricator.wikimedia.org/source/mediawiki/browse/master/docker-compose.yml
== Use Cases ==
    # https://phoenixnap.com/kb/how-to-share-data-between-docker-containers
 
    # + mysql
=== {{mlb|Install/configure/upgrade/run/operate system(s)}} ===
  # mwmapi:
 
  #  container_name: mwmapi
# Favored path: Kubernetes-based only for mwmITLocal, mwmITIntra and mwmITCloud
  #  image: dataspects/mwmapi:210303
 
  mysql:
{|class=wikitable
    container_name: mysql_canasta
!Where
    image: mariadb:10.5.5
!How
    volumes:
!Why
      - ./mysql_data:/var/lib/mysql
|-
    environment:
|mwmITLocal: locally on a single computer
      - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
|containerized
</syntaxhighlight>
|for personal/private/development use
|-
|mwmITIntra: in an intranet
|
|
[[File:mwm-safe-mode.png]]
containerized
https://github.com/dataspects/mediawiki-manager/blob/main/start-SAFE-MODE.sh
|for corporate internal use
<syntaxhighlight lang=yaml>
|-
version: "3.7"
|mwmITCloud: on the internet/in the cloud
services:
|containerized
  mediawiki:
|for corporate internal/external/public use
    env_file:
      - CanastaInstanceSettings.env
    container_name: mediawiki_canasta
    image: dataspects/mediawiki:1.35.0-2103040820
    ports:
      - 80:80
      - 443:443
    volumes:
      # MediaWiki >>>
      #- ./mediawiki_root/w/LocalSettings.php:/var/www/html/w/LocalSettings.php
      #- ./mediawiki_root/w/extensions:/var/www/html/w/extensions
      #- ./mediawiki_root/w/skins:/var/www/html/w/skins
      #- ./mediawiki_root/w/vendor:/var/www/html/w/vendor
      - ./mediawiki_root/w/images:/var/www/html/w/images
      # MediaWiki Manager >>>
      - ./mediawiki_root/api:/var/www/html/api
      - ./mediawiki_root/dsmwm.log:/var/www/html/dsmwm.log
      - ./mediawiki_root/restic_password:/var/www/html/restic_password
      - ./mediawiki_root/ui:/var/www/html/ui
      - ./mediawiki_root/cloneLocation:/var/www/html/cloneLocation
      - ./restic_data:/var/www/html/restic-repo
      - ./conf:/etc/apache2/sites-available
    # https://phabricator.wikimedia.org/source/mediawiki/browse/master/docker-compose.yml
    # https://phoenixnap.com/kb/how-to-share-data-between-docker-containers
    # + mysql
  # mwmapi:
  #  container_name: mwmapi
  #  image: dataspects/mwmapi:210303
  mysql:
    container_name: mysql_canasta
    image: mariadb:10.5.5
    volumes:
      - ./mysql_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
</syntaxhighlight>
|}
|}


=== Manage MW Content (inject/extract/facet/edit) ===
=== {{mlb|Install/enable/disable/upgrade/configure extensions}} ===
 
[[MWStake MediaWiki Manager/MWStakeServices/ExtensionsCatalog]]
 
=== {{mlb|Backup/restore/clone/compare/consolidate system(s) (snapshots)}} ===
 
=== {{mlb|Inject/extract/facet/edit/consolidate/import/export/remove apps/structures/ontologies}} ===
 
==== CLI (Bash) ====
 
https://github.com/dataspects/mediawiki-manager/tree/main/cli/manage-content
 
=== {{mlb|Scripting}} ===
 
==== CLI (Bash) ====
 
https://github.com/dataspects/mediawiki-manager/blob/main/cli/manage-extensions/tests.sh
 
=== {{mlb|Package system(s)}} ===


# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/apps.json mediawiki-apps.json]
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/apps.json mediawiki-apps.json]
== MWStake MWM Service Portfolio ==
[[MWStake_MediaWiki_Manager/MWStakeServices]]


== Abstraction Layers ==
== Abstraction Layers ==


=== AL0: shell scripts using MWAPI and CRUDing files ===
[[File:Mediawiki-manager-Service-Architecture.png|1000px]]


https://github.com/dataspects/mediawiki-manager
=== ALcontainerization: Podman ===


# [https://github.com/dataspects/mediawiki-manager/blob/main/docker-compose.yml docker-compose.yml] ([https://github.com/dataspects/dataspectsSystemBuilder/tree/master/docker-images/mediawiki MediaWiki Dockerfile])
# The [https://hub.docker.com/r/dataspects/mediawiki/tags?page=1&ordering=last_updated mediawiki container image] contains a [https://github.com/dataspects/dataspectsSystemBuilder/blob/master/docker-images/mediawiki/Dockerfile full MediaWiki installation].
# [https://github.com/dataspects/mediawiki-manager/blob/main/cli/install-system/initialize-persistent-mediawiki-service-volumes.sh initialize-persistent-mediawiki-service-volumes.sh] will copy persistence-relevant files/directories out to the host so they can be volumed in when starting the mediawiki container.


=== AL1: MWM API (Go) wrapping AL0 ===
=== ALcli: shell scripts using MWAPI and CRUDing files in service volumes ===


https://github.com/dataspects/mwmapi
=== ALapi: MWM API wrapping and parametrizing ALcli shell scripts and using MWAPI ===


==== Unit Testing ====
==== Unit Testing ====


=== AL2: MWM UI (React/Material UI) using AL1 ===
=== ALui: MWM UI using and parametrizing ALapi endpoints ===


https://github.com/dataspects/mwmui
[[File:Mediawiki-manager-UI.png|MWM UI]]


==== Integration Testing ====
==== Integration Testing ====
== Development Broadcasting ==
There are videos about MWStake MWM at [https://www.youtube.com/channel/UCoP-EgZJPhB0UE4WaKCHR1w dataspects' YouTube channel].
* [https://www.youtube.com/watch?v=MTYq2a2Xsls First glimpse at the idea of an MWStake MediaWiki Manager]

Latest revision as of 08:20, 22 April 2021

SUBPAGES
GitHub Repo Tag "CreateCampEMWCon2021"
Code Base at              https://github.com/dataspects/mediawiki-manager
Development Discussion at https://riot.im/app/#/room/#mwdeployment:matrix.org

Project Reasoning and Potential Goals

Facilitate managing all aspects and use cases regarding the operation of MediaWiki instance(s)
  1. Across set up modes and operating systems
  2. Targeting all user groups accordingly
  3. Conveying best practices
  4. Component monitoring and certification services
  5. Not integrated, but besides MediaWiki instance(s)
  6. Install/configure/upgrade system(s)
  7. Install/enable/disable/upgrade/configure extensions
    • MediaWiki Stakeholders Group Certified Extensions Service
  8. Backup/restore/clone/compare/consolidate system(s) (snapshots)
  9. Inject/extract/facet/edit/consolidate/import/export/remove apps/structures/ontologies
    • MediaWiki Stakeholders Group Certified Apps Service
  10. Script/automate/schedule tasks
  11. Package/move/archive/migrate system(s)
  12. ORTHOGONAL MODULARITY

Backlog

  • Permissions (owner, group, rwx, executing user, etc.)
  • Apache (SSL, configuration)
  • Certified extensions and apps catalog (selection, fields, mechanisms, policies, stewardship)
  • SSO
  • Search

MWM Implementation Aspects

How and Why?

  • Dissect system…
  • …into as few as possible but into as many as necessary interfacing components…
  • …in order to fulfill all intended use cases…
  • …in accordance with corresponding users' capabilities and needs.

Abstraction Layers

CLI <-- API <-- UI
  1. UI is GUI for API
  2. API wraps CLI
  3. CLI means bash scripts covering all use cases

Podman-managed MWM Kubernetes deploy manifest ("Containers")

  1. Pod "mwm"
  2. Container "mediawiki" + user volumes and config envs
  3. Container "mariadb" + config envs

Config envs

Pending: podman secret

# my-new-system.env
export WG_DB_PASSWORD=8n65f%6n5
⇒ envsubst ⇒
# mediawiki-manager.yml
...
containers:
  - image: docker.io/dataspects/mediawiki:1.35.0-2104121740
    name: mediawiki
    env:
      - name: WG_DB_PASSWORD
        value: 8n65f%6n5
      - ...
...
# Localsettings.php
$wgDBpassword = getenv("WG_DB_PASSWORD");

Config database

<?php
# addToMWMSQLite.php

$name  = $argv[1];
$localsettingsdirectives = $argv[2];
$db = new SQLite3('mwmconfigdb.sqlite');

$stmt = $db->prepare('INSERT INTO extensions (name, localsettingsdirectives) VALUES ( :name, :localsettingsdirectives)');
$stmt->bindValue(':name', $name, SQLITE3_TEXT);
$stmt->bindValue(':localsettingsdirectives', $localsettingsdirectives, SQLITE3_TEXT);

$stmt->execute();
<?php
# updateMWMLocalSettings.php

$db = new SQLite3('mwmconfigdb.sqlite');
$stmt = $db->prepare('SELECT localsettingsdirectives FROM extensions');
$result = $stmt->execute();

$mwmLocalSettingsString = "";
while($res = $result->fetchArray(SQLITE3_ASSOC)){
    $mwmLocalSettingsString .= trim($res["localsettingsdirectives"])."\n";
}

$mwmLS = fopen("mwmLocalSettings.php", "w");
fwrite($mwmLS, "<?php\n".$mwmLocalSettingsString);
fclose($mwmLS);
# Localsettings.php
$mwmls = "../mwmLocalSettings.php";
# MWStake MediaWiki Manager
if(file_exists($mwmls)) {
	require_once($mwmls);
} else { 
	echo "ERROR: ".$mwmls." include not loaded.";
}

Target User Groups

Who can use the concepts in MWM how? Here I try to segregate target users into groups that share capabilities and needs.

User Group Point/Select/Type/Click CLI/SSH Scripting Edit configuration junior Edit configuration senior
Examples "Web Interface" Automate/schedule tasks
  • Edit LocalSettings.php
  • Run composer

PLUS

  • Interpret logs
  • Report bugs/feature request
  • Branch code, develop and PR
UGUI "WebAdmin" Yes - "Macro" style only from within UI
("Excel Record Macro Style")
- -
UGAdmin "SysAdmin" Yes Yes Run/arrange .sh scripts Yes -
UGCoder "Developer" Yes Yes Run/arrange/compose/create/edit .sh scripts including API calls Yes Yes

Use Cases

Install/configure/upgrade/run/operate system(s)

  1. Favored path: Kubernetes-based only for mwmITLocal, mwmITIntra and mwmITCloud
Where How Why
mwmITLocal: locally on a single computer containerized for personal/private/development use
mwmITIntra: in an intranet

containerized

for corporate internal use
mwmITCloud: on the internet/in the cloud containerized for corporate internal/external/public use

Install/enable/disable/upgrade/configure extensions

MWStake MediaWiki Manager/MWStakeServices/ExtensionsCatalog

Backup/restore/clone/compare/consolidate system(s) (snapshots)

Inject/extract/facet/edit/consolidate/import/export/remove apps/structures/ontologies

CLI (Bash)

https://github.com/dataspects/mediawiki-manager/tree/main/cli/manage-content

Scripting

CLI (Bash)

https://github.com/dataspects/mediawiki-manager/blob/main/cli/manage-extensions/tests.sh

Package system(s)

  1. mediawiki-apps.json

MWStake MWM Service Portfolio

MWStake_MediaWiki_Manager/MWStakeServices

Abstraction Layers

Mediawiki-manager-Service-Architecture.png

ALcontainerization: Podman

  1. The mediawiki container image contains a full MediaWiki installation.
  2. initialize-persistent-mediawiki-service-volumes.sh will copy persistence-relevant files/directories out to the host so they can be volumed in when starting the mediawiki container.

ALcli: shell scripts using MWAPI and CRUDing files in service volumes

ALapi: MWM API wrapping and parametrizing ALcli shell scripts and using MWAPI

Unit Testing

ALui: MWM UI using and parametrizing ALapi endpoints

MWM UI

Integration Testing

Development Broadcasting

There are videos about MWStake MWM at dataspects' YouTube channel.