MWStake MediaWiki Manager: Difference between revisions

From MWStake
Jump to navigation Jump to search
()
No edit summary
 
(123 intermediate revisions by 2 users 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="packed-hover">
'''[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-UI.png|MWM UI
Development Discussion at https://riot.im/app/#/room/#mwdeployment:matrix.org
File:Mediawiki-manager-ExtensionsStore.png|MWM ExtensionsStore
</gallery>


== Resources ==
== Project Reasoning and Potential Goals ==


  https://github.com/dataspects/mediawiki-manager
  Facilitate managing all aspects and use cases regarding the operation of MediaWiki instance(s)
https://github.com/dataspects/mwmui


# [https://github.com/dataspects/mediawiki-manager/blob/main/docker-compose.yml docker-compose.yml]
# Across set up modes and operating systems
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/extensions.json extensions.json]
# Targeting all user groups accordingly
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/versions.json upgrades.json]
# Conveying best practices
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/apps.json mediawiki-apps.json]
# Component monitoring and certification services
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/systemSettings.json systemSettings.json]
# Not integrated, but besides MediaWiki instance(s)
# [https://github.com/dataspects/mediawiki-manager/tree/main/mwmapi mwmapi.php] (MediaWiki Manager API)
# Install/configure/upgrade system(s)
# [https://github.com/dataspects/mwmui mwmui] (User Interface)
# Install/enable/disable/upgrade/configure extensions
# [https://github.com/dataspects/mediawiki-manager/blob/main/mwmapi/test.php Integration Testing]
#* 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
 
__TOC__
 
== 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&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.
 
=== Abstraction Layers ===
 
CLI <-- API <-- UI
 
# 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]
 
=== [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
 
==== Config envs ====
Pending: [http://docs.podman.io/en/latest/markdown/podman-secret.1.html podman secret]
{|
|<syntaxhighlight lang=bash>
# my-new-system.env
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");
 
</syntaxhighlight>
|}
 
==== Config database ====
 
{|
|<syntaxhighlight lang=php>
<?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();
</syntaxhighlight>
|&rArr;
|<syntaxhighlight lang=php>
<?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);
</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
!User Group
!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''
|
PLUS
*''Interpret logs''<br>
*''Report bugs/feature request''<br>
*''Branch code, develop and PR''
|-
|{{mo|'''UGUI'''}} "WebAdmin"
|Yes
| -
|"Macro" style only from within UI<br>("Excel Record Macro Style")
| -
| -
|-
|{{mo|'''UGAdmin'''}} "SysAdmin"
|Yes
|Yes
|Run/arrange .sh scripts
|Yes
| -
|-
|{{mo|'''UGCoder'''}} "Developer"
|Yes
|Yes
|Run/arrange/compose/create/edit .sh scripts including API calls
|Yes
|Yes
|}
</div>
 
== Use Cases ==
 
=== {{mlb|Install/configure/upgrade/run/operate system(s)}} ===
 
# Favored path: Kubernetes-based only for mwmITLocal, mwmITIntra and mwmITCloud
 
{|class=wikitable
!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
|}
 
=== {{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}} ===


=== MediaWiki Manager API ===
==== CLI (Bash) ====


* PHP right now (possibly Go?)
https://github.com/dataspects/mediawiki-manager/blob/main/cli/manage-extensions/tests.sh
* Security review (e.g. exec commands)


==== Usecase: edit system settings ====
=== {{mlb|Package system(s)}} ===


Experimental, see https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/systemSettings.json
# [https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/apps.json mediawiki-apps.json]


==== Usecase: enable (install) and disable extension ====
== MWStake MWM Service Portfolio ==
[[MWStake_MediaWiki_Manager/MWStakeServices]]


See
== Abstraction Layers ==
* https://github.com/dataspects/mediawiki-manager/blob/ca621f9dab7ba784c6d16f6fa71f0d500e9544d8/mwmapi/extension.php#L27
* https://github.com/dataspects/mediawiki-manager/blob/ca621f9dab7ba784c6d16f6fa71f0d500e9544d8/mwmapi/extension.php#L72


==== Usecase: upgrade MediaWiki "package" ====
[[File:Mediawiki-manager-Service-Architecture.png|1000px]]


See https://github.com/dataspects/mediawiki-manager/blob/ca621f9dab7ba784c6d16f6fa71f0d500e9544d8/mwmapi/system.php#L12
=== ALcontainerization: Podman ===


==== Usecase: take snapshot ====
# 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.


See https://github.com/dataspects/mediawiki-manager/blob/ca621f9dab7ba784c6d16f6fa71f0d500e9544d8/mwmapi/snapshots.php#L19
=== ALcli: shell scripts using MWAPI and CRUDing files in service volumes ===


==== Usecase: inject dataspects ontology ====
=== ALapi: MWM API wrapping and parametrizing ALcli shell scripts and using MWAPI ===


See https://github.com/dataspects/mediawiki-manager/blob/ca621f9dab7ba784c6d16f6fa71f0d500e9544d8/mwmapi/app.php#L27
==== Unit Testing ====


=== MediaWiki Manager UI ===
=== ALui: MWM UI using and parametrizing ALapi endpoints ===


* Gatsby/React/MaterialUI
[[File:Mediawiki-manager-UI.png|MWM UI]]
* Security review
* Protection: .htaccess or own user management?


=== MediaWiki Stakeholders Group Certified Extensions Catalogue ===
==== Integration Testing ====


* Format right now: https://github.com/dataspects/mediawiki-manager/blob/main/catalogues/extensions.json
== Development Broadcasting ==
* Management, roles, responsibilities, privileges, processes, QA?
* Hosting?


=== Integration Testing ===
There are videos about MWStake MWM at [https://www.youtube.com/channel/UCoP-EgZJPhB0UE4WaKCHR1w dataspects' YouTube channel].


# https://github.com/dataspects/mediawiki-manager/blob/main/mwmapi/test.php
* [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.