@webship.co/workspace-mediawiki 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,6 +71,7 @@ Everything the builder runs for a wiki runs in the wiki's own container, through
71
71
  | `ai/prompts/mediawiki-build-and-test.md`, `mediawiki-scenarios-for-an-area.md` | Two prompts: whole launch commands for a new session |
72
72
  | `src/index.ts` | `register(api)`: what the assistant is told about MediaWiki here |
73
73
  | `features/mediawiki.feature` | Scenarios for the dashboard's own browser suite |
74
+ | `features/mediawiki-runtimes.feature` | The row, the test users and the pages of a wiki built on Docker Compose and on Kubernetes |
74
75
 
75
76
  The `workspacePlugin` block in `package.json` is the manifest the installer reads.
76
77
 
@@ -108,15 +109,64 @@ bash cmd-mediawiki-project.sh mywiki --install --add-users --visual-editor
108
109
  | `--visual-editor` | Turn the visual editor on (VisualEditor; Parsoid is in core) |
109
110
  | `--mediawiki-version <x>` | The release to install, for example `1.43.11` (the long-term-support line); empty means the current stable release (1.46.2) |
110
111
  | `--php-version <x>` | The PHP of the project container (the current release needs 8.3 or later) |
112
+ | `--runtime <name>` | The container runtime to build on: `ddev` (the default), `docker`, `kubernetes` or `podman`. See [Runtimes](#runtimes) |
111
113
  | `--launch` | Open the wiki when it is ready |
112
114
 
113
- The wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
115
+ On DDEV the wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
114
116
  The build adds to `LocalSettings.php`: uploads on, the "confirmed" group (the rights an account
115
117
  otherwise earns after 4 days and 10 edits, the thresholds it sets as on large public wikis), the job
116
118
  queue run by the service (`$wgJobRunRate = 0`), and the object cache and the sessions in the
117
119
  database (the installer picks the PHP process cache, which the maintenance scripts cannot see and a
118
120
  restart empties). A project of the same name is deleted first.
119
121
 
122
+ ### Runtimes
123
+
124
+ ```bash
125
+ bash cmd-mediawiki-project.sh mywiki --install --add-users # DDEV, the default
126
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --runtime docker # Docker Compose
127
+ bash cmd-mediawiki-project.sh mywiki --install --add-users --runtime kubernetes # a Kubernetes cluster
128
+ ```
129
+
130
+ Without `--runtime` a build takes `container.runtime` of the workspace's `settings.yml`, then DDEV.
131
+ It needs a Webship Workspace with the container runtimes
132
+ ([webship/workspace#694](https://github.com/webship/workspace/issues/694)); on an older one the
133
+ builder refuses `--runtime` and builds on DDEV only.
134
+
135
+ | | DDEV | Docker Compose | Kubernetes | Podman |
136
+ | --- | --- | --- | --- | --- |
137
+ | Build and install, with the default accounts (and the visual editor) | Yes | Yes, with webship/workspace#723 | Yes, with webship/workspace#723 | The same code as Docker Compose, not yet run |
138
+ | The main page, the login page, the REST API and the action API | Yes | Yes | Yes | Not yet run |
139
+ | `cmd-tools-mediawiki-maintenance.sh`: what the wiki is, `--run`, `--jobs` | Yes | Yes | Yes | Not yet run |
140
+ | Test users, cancelled and given back (the command line and the row's Tests menu) | Yes | Yes | Yes | Not yet run |
141
+ | The testing setup and the suite, with the pack's examples | Yes | Yes | Yes | Not yet run |
142
+ | Export and import the database | Yes | Yes | Yes | Not yet run |
143
+ | The row in the dashboard, and remove | Yes | Yes | Yes | Not yet run |
144
+
145
+ "Yes" means it was run on a real wiki of that runtime. On Docker Compose and Kubernetes the installer needs webship/workspace#723: before it, the name of the wiki and the account given to the installer come apart at their spaces there.
146
+
147
+ | Runtime | The wiki's address | What the project carries |
148
+ | --- | --- | --- |
149
+ | DDEV | `https://mywiki.ddev.site` | `.ddev/config.yaml` (type `php`), the nginx rule of the REST API, the job service |
150
+ | Docker Compose | `http://127.0.0.1:<port>`, printed by the build | `compose.yaml` (with `platform: mediawiki`: the claim), `.webship/runtime/Dockerfile` |
151
+ | Kubernetes | `http://<node address>:<port>`, printed by the build | The same, and `k8s/` (the namespace `ws-mywiki`) |
152
+
153
+ What differs on Docker Compose and Kubernetes:
154
+
155
+ - **The claim:** the project type is `php` there too, so the builder writes `platform: mediawiki` in
156
+ the `x-webship:` block of `compose.yaml`. The tools and the row's Tests menu read it.
157
+ - **The address** the installer is given (`$wgServer`) is the runtime's.
158
+ - **The web server** is Apache, which passes `rest.php/v1/…` to the REST API by itself: no rule is
159
+ written. The database is the same: `db` / `db` / `db` on the host `db`.
160
+ - **The job queue:** the stack has no service for it, so the wiki runs its jobs itself at the end
161
+ of a request (`$wgJobRunRate = 1`, MediaWiki's default). `--jobs` of the maintenance tool runs the
162
+ waiting ones at once.
163
+ - **Not there yet:** HTTPS and a host name are DDEV's. Podman runs the same code as Docker Compose
164
+ and was not run yet.
165
+
166
+ The same commands work on every runtime: `cmd-tools-mediawiki-maintenance.sh`, `cmd-tools-add-users.sh`,
167
+ `cmd-tools-testing.sh`. The pattern is the reference plugin's:
168
+ [On Docker Compose and Kubernetes](https://github.com/webship/workspace-wordpress/blob/1.0.x/docs/cms-plugin-pattern.md#on-docker-compose-and-kubernetes).
169
+
120
170
  ### Work on a wiki
121
171
 
122
172
  ```bash
@@ -39,8 +39,10 @@ bash cmd-mediawiki-project.sh mywiki --install --add-users --visual-editor
39
39
  | `--php-version <x>` | The PHP of the project container (8.3 or 8.4: the current release needs 8.3 or later). |
40
40
  | `--launch` | Opens the wiki when it is ready. |
41
41
 
42
- The wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
43
- A project of the same name is deleted first: never build over a wiki somebody still needs.
42
+ On DDEV the wiki answers at `https://mywiki.ddev.site`, its login at `/index.php?title=Special:UserLogin`.
43
+ With `--runtime docker` or `--runtime kubernetes` it is built on Docker Compose or a Kubernetes
44
+ cluster, at the address the build prints (`http://127.0.0.1:<port>`, or the node's address and a
45
+ port): never write a `ddev.site` address for such a wiki. A project of the same name is deleted first: never build over a wiki somebody still needs.
44
46
 
45
47
  What the build does, so you can explain it:
46
48
 
@@ -4,8 +4,9 @@
4
4
 
5
5
  # Installed by the MediaWiki plugin (plugins.sh --install mediawiki); __WORKSPACE__ is the workspace it was installed into.
6
6
  #
7
- # Build a wiki in a container from the MediaWiki release tarball, at https://<name>.ddev.site (DDEV
8
- # project type php, the wiki at the docroot). With --install it is installed by its own installer on
7
+ # Build a wiki in a container from the MediaWiki release tarball: on DDEV (the default) at
8
+ # https://<name>.ddev.site (project type php, the wiki at the docroot), and with --runtime docker,
9
+ # podman or kubernetes on that runtime, at the address the build prints. With --install it is installed by its own installer on
9
10
  # the container's database, with the extensions a default wiki uses, and the workspace account is its
10
11
  # first account; with --add-users it also gets the default accounts; with --visual-editor, the visual
11
12
  # editor.
package/dist/src/index.js CHANGED
@@ -34,7 +34,8 @@ function assistantContext() {
34
34
  'MediaWiki (a plugin, @webship.co/workspace-mediawiki): a wiki is built with',
35
35
  '`bash cmd-mediawiki-project.sh <name> --install --add-users --visual-editor` from a sites folder (dev, test, sandboxes, demos),',
36
36
  'from the release tarball (the current stable release, or `--mediawiki-version <x>`), installed by its own installer',
37
- 'in a container like every other project (DDEV project type php, the wiki at the docroot), at https://<name>.ddev.site,',
37
+ 'in a container like every other project (project type php, the wiki at the docroot): on DDEV by default, at https://<name>.ddev.site,',
38
+ 'or with `--runtime docker` or `--runtime kubernetes` on Docker Compose or a Kubernetes cluster, at the address the build prints;',
38
39
  'with WikiEditor, CategoryTree and Cite (and the visual editor with `--visual-editor`), uploads on and the job queue run by a service of the container.',
39
40
  '`bash cmd-tools-mediawiki-maintenance.sh <name>` says what the wiki is; `--run "<script> <args>"` runs a maintenance script in it,',
40
41
  '`--update` runs the database updates, `--jobs` runs the waiting jobs,',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAuBH,4CAiBC;AAED,4BAEC;AAxCD,iGAAiG;AACpF,QAAA,QAAQ,GAAG,WAAW,CAAC;AAEpC,+DAA+D;AAClD,QAAA,QAAQ,GAAG,CAAC,0BAA0B,EAAE,oCAAoC,CAAC,CAAC;AA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AAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,SAAgB,QAAQ,CAAC,GAAc;IACrC,GAAG,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,54 @@
1
+ Feature: A wiki on Docker Compose and on Kubernetes
2
+ The builder builds on DDEV by default, and with --runtime on Docker Compose or on a Kubernetes cluster. A wiki
3
+ built there has the row a DDEV site has: its state, its own address, the runtime's menu, and the test users of
4
+ the plugin in its Tests menu.
5
+
6
+ # Each scenario drives a real wiki of that runtime, built with cmd-mediawiki-project.sh --runtime: the first
7
+ # running one the workspace holds that the plugin claims. Without one it is skipped, with the reason. In the
8
+ # plugin's CI the Docker Compose wiki is the one the manifest's featuresSite builds.
9
+
10
+ @needs-runtime-docker @needs-platform-mediawiki
11
+ Scenario: A wiki built on Docker Compose runs at its own address, with the DOCKER menu
12
+ Given I am on the folder of the "docker" site
13
+ Then the row of the "docker" site should show "Running"
14
+ And the row of the "docker" site should link to the address of its runtime
15
+ And the address of the "docker" site should answer
16
+ And the row of the "docker" site should carry the "DOCKER" menu and no DDEV menu
17
+
18
+ @needs-runtime-docker @needs-platform-mediawiki
19
+ Scenario: The Tests menu of a wiki on Docker Compose offers the test users
20
+ Given I am on the folder of the "docker" site
21
+ When I open the "tests" menu of the "docker" site
22
+ Then the open menu should offer "Add the test users"
23
+ And the open menu should offer "Cancel the test users"
24
+
25
+ @needs-runtime-docker @needs-platform-mediawiki
26
+ Scenario: The wiki on Docker Compose is installed: its main page and its login page
27
+ Given I am on the folder of the "docker" site
28
+ When I open "/index.php?title=Main_Page" on the "docker" site
29
+ Then I should see "Main Page"
30
+ When I open "/index.php?title=Special:UserLogin" on the "docker" site
31
+ Then I should see "Keep me logged in"
32
+
33
+ @needs-runtime-kubernetes @needs-platform-mediawiki
34
+ Scenario: A wiki built on Kubernetes runs at the address of its node, with the K8S menu
35
+ Given I am on the folder of the "kubernetes" site
36
+ Then the row of the "kubernetes" site should show "Running"
37
+ And the row of the "kubernetes" site should link to the address of its runtime
38
+ And the address of the "kubernetes" site should answer
39
+ And the row of the "kubernetes" site should carry the "K8S" menu and no DDEV menu
40
+
41
+ @needs-runtime-kubernetes @needs-platform-mediawiki
42
+ Scenario: The Tests menu of a wiki on Kubernetes offers the test users
43
+ Given I am on the folder of the "kubernetes" site
44
+ When I open the "tests" menu of the "kubernetes" site
45
+ Then the open menu should offer "Add the test users"
46
+ And the open menu should offer "Cancel the test users"
47
+
48
+ @needs-runtime-kubernetes @needs-platform-mediawiki
49
+ Scenario: The wiki on Kubernetes is installed: its main page and its login page
50
+ Given I am on the folder of the "kubernetes" site
51
+ When I open "/index.php?title=Main_Page" on the "kubernetes" site
52
+ Then I should see "Main Page"
53
+ When I open "/index.php?title=Special:UserLogin" on the "kubernetes" site
54
+ Then I should see "Keep me logged in"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webship.co/workspace-mediawiki",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MediaWiki for Webship Workspace: the builder (`cmd-mediawiki-project.sh`, the release tarball installed by its own installer, with the visual editor on request) and the maintenance tool in every sites folder, the default accounts, the MediaWiki step pack wired into the testing setup, and its AI items in their folders: two agents, a skill, a command and two prompts.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -83,8 +83,10 @@
83
83
  ]
84
84
  },
85
85
  "features": [
86
- "features/mediawiki.feature"
87
- ]
86
+ "features/mediawiki.feature",
87
+ "features/mediawiki-runtimes.feature"
88
+ ],
89
+ "featuresSite": "cmd-mediawiki-project.sh ci-mediawiki --install --add-users --runtime docker"
88
90
  },
89
91
  "devDependencies": {
90
92
  "@types/node": "^24.0.0",
@@ -2,7 +2,12 @@
2
2
 
3
3
  argparse "$@" <<ARGEOF || exit 1
4
4
  parser.add_argument('PROJECT_NAME',
5
- help='The name of the project: its folder, its DDEV project and its host name.')
5
+ help='The name of the project: its folder, and its name on the container runtime (on DDEV its host name too).')
6
+ parser.add_argument('--runtime',
7
+ dest='RUNTIME',
8
+ default="_none_",
9
+ choices=['ddev', 'docker', 'podman', 'kubernetes'],
10
+ help='The container runtime to build on: ddev (the default, or container.runtime of settings.yml), docker (Docker Compose), podman or kubernetes.')
6
11
  parser.add_argument('-i', '--install',
7
12
  action='store_true',
8
13
  default=False,
@@ -11,6 +11,14 @@
11
11
  # The installer writes the wiki's database settings into LocalSettings.php from the container's own
12
12
  # values (db, db, db on the host db), and nothing personal.
13
13
  #
14
+ # The runtimes: a wiki is built on DDEV, or with --runtime on Docker Compose, Podman or Kubernetes.
15
+ # The commands are the same on each: `ddev <verb>` is DDEV itself on a DDEV project, and on another
16
+ # runtime the core's layer (fun-runtime.sh) gives the verb its meaning there. What differs is behind
17
+ # mediawiki_runtime: the address (mediawiki_url), the claim of the plugin on the project (rt_claim,
18
+ # which is how a wiki of another runtime is known), and the two things DDEV carries in .ddev/ that
19
+ # the stack of the other runtimes has no place for: the nginx rule of the REST API (Apache, the web
20
+ # server there, needs none) and the job queue as a service (the wiki runs its jobs itself there).
21
+ #
14
22
  # Four names are the ones the core's tools look for:
15
23
  # set_mediawiki_users the default accounts (cmd-tools-add-users.sh <project> mediawiki)
16
24
  # add_mediawiki_users create them in the wiki (the same tool, and --add-users of the builder)
@@ -42,10 +50,25 @@ function set_mediawiki_users() {
42
50
  user_reader_role='' ;
43
51
  }
44
52
 
45
- # Is this folder a MediaWiki project? A container project with the maintenance runner of the release
46
- # and the version it defines.
53
+ # The runtime of the project in this folder, or of a new build (--runtime, else the workspace's
54
+ # setting, else DDEV). A core without the runtime layer has DDEV only.
55
+ function mediawiki_runtime() {
56
+ if declare -f runtime_of > /dev/null ; then runtime_of ; else echo 'ddev' ; fi
57
+ }
58
+
59
+ # The address of the wiki in this folder: https://<name>.ddev.site on DDEV, http://127.0.0.1:<port>
60
+ # on Docker Compose and Podman, the node's address and a port on Kubernetes. Asked after `ddev config`.
61
+ function mediawiki_url() {
62
+ if declare -f rt_url > /dev/null ; then rt_url ; else echo "https://${PROJECT_NAME}.ddev.site" ; fi
63
+ }
64
+
65
+ # Is this folder a MediaWiki project? On Docker Compose, Podman and Kubernetes the claim of the
66
+ # plugin says so (`platform: mediawiki` in the x-webship block of compose.yaml, written by the
67
+ # builder: the core's rt_is_platform reads it). On DDEV, whose project type for it is `php`, a
68
+ # container project with the maintenance runner of the release and the version it defines, as before.
47
69
  function mediawiki_is_project() {
48
70
  local project_path="$1";
71
+ if declare -f rt_is_platform > /dev/null && rt_is_platform "${project_path}" mediawiki ; then return 0 ; fi
49
72
  [ -f "${project_path}/.ddev/config.yaml" ] && [ -f "${project_path}/maintenance/run.php" ] \
50
73
  && grep -q "define( 'MW_VERSION'" "${project_path}/includes/Defines.php" 2>/dev/null ;
51
74
  }
@@ -68,7 +91,7 @@ function mediawiki_enter_project() {
68
91
  return 1 ;
69
92
  fi
70
93
  if ! mediawiki_is_project "${project_path}" ; then
71
- echo "${doc_name}/${PROJECT_NAME} is not a MediaWiki project (it has no maintenance/run.php and includes/Defines.php of the release)." ;
94
+ echo "${doc_name}/${PROJECT_NAME} is not a MediaWiki project (it has no maintenance/run.php and includes/Defines.php of the release, and no plugin claims it in compose.yaml)." ;
72
95
  return 1 ;
73
96
  fi
74
97
  cd "${project_path}" || return 1 ;
@@ -94,8 +117,23 @@ $wgAutoConfirmAge = 4 * 86400;
94
117
  $wgAutoConfirmCount = 10;
95
118
  $wgGroupPermissions['confirmed']['autoconfirmed'] = true;
96
119
  $wgGroupPermissions['confirmed']['editsemiprotected'] = true;
120
+ PHPEOF
121
+ # On DDEV the job queue runs as a service of the web container. The stack of the other runtimes
122
+ # has no such service: there the wiki runs its jobs itself, at the end of a request, as a wiki
123
+ # does by default.
124
+ if [ "$(mediawiki_runtime)" == 'ddev' ] ; then
125
+ cat >> LocalSettings.php <<'PHPEOF'
97
126
  # The job queue runs as a service of the container (.ddev/config.mediawiki-jobs.yaml).
98
127
  $wgJobRunRate = 0;
128
+ PHPEOF
129
+ else
130
+ cat >> LocalSettings.php <<'PHPEOF'
131
+ # The job queue: the wiki runs its jobs itself, at the end of a request (the container has no
132
+ # service for it on this runtime).
133
+ $wgJobRunRate = 1;
134
+ PHPEOF
135
+ fi
136
+ cat >> LocalSettings.php <<'PHPEOF'
99
137
  # The object cache and the sessions in the database: the maintenance scripts and the job
100
138
  # runner share them with the web requests, and a restart keeps the sessions.
101
139
  $wgMainCacheType = CACHE_DB;
@@ -164,7 +202,12 @@ for r in rows:
164
202
  # installed by its own installer, the workspace account as its first account.
165
203
  function mediawiki_build() {
166
204
  trim_project_name ;
167
- local base_url="https://${PROJECT_NAME}.ddev.site" ;
205
+ local base_url runtime ;
206
+ runtime="$(mediawiki_runtime)" ;
207
+ if [ "${RUNTIME:-_none_}" != '_none_' ] && [ "${RUNTIME}" != "${runtime}" ] ; then
208
+ echo "--runtime ${RUNTIME} needs a Webship Workspace with the container runtimes (webship/workspace#694): update the workspace, or build on DDEV." ;
209
+ exit 1 ;
210
+ fi
168
211
  local release="${MEDIAWIKI_VERSION:-${site_mediawiki_version:-${MEDIAWIKI_DEFAULT_RELEASE}}}" ;
169
212
  local major ;
170
213
  major="$(echo "${release}" | cut -d. -f1,2)" ;
@@ -182,8 +225,16 @@ function mediawiki_build() {
182
225
  # DDEV has no project type for the wiki: php, the wiki at the docroot.
183
226
  ddev config --project-type=php --docroot="" --project-name=${PROJECT_NAME} \
184
227
  --nodejs-version=$(ddev_nodejs_version) ${php_version:+--php-version=${php_version}} --auto || exit 1 ;
185
- mediawiki_write_container_config ;
228
+ if [ "${runtime}" == 'ddev' ] ; then
229
+ mediawiki_write_container_config ;
230
+ else
231
+ # The project type is `php` on every runtime: on another runtime than DDEV the plugin claims the
232
+ # project, so the tools and the dashboard know it is a wiki. Apache needs no rule for rest.php.
233
+ rt_claim mediawiki || exit 1 ;
234
+ fi
186
235
  ddev_up start -y || exit 1 ;
236
+ # The address is the runtime's to say, once the project is configured: never a written ddev.site.
237
+ base_url="$(mediawiki_url)" ;
187
238
 
188
239
  # The release tarball from the release server, unpacked at the docroot in the container.
189
240
  ddev exec "curl -sSfL https://releases.wikimedia.org/mediawiki/${major}/mediawiki-${release}.tar.gz | tar -xz --strip-components=1" < /dev/null \
@@ -205,9 +256,12 @@ function mediawiki_build() {
205
256
  add_mediawiki_users ;
206
257
  cd ${WORKSPACE_ROOT}/${doc_name}/${PROJECT_NAME} || exit 1 ;
207
258
  fi
208
- # The job queue as a service: it needs the installed wiki, and starts with this restart.
209
- mediawiki_write_jobs_service ;
210
- ddev restart || exit 1 ;
259
+ # The job queue as a service: it needs the installed wiki, and starts with this restart. A
260
+ # service of DDEV's web container: on another runtime the wiki runs its jobs itself.
261
+ if [ "${runtime}" == 'ddev' ] ; then
262
+ mediawiki_write_jobs_service ;
263
+ ddev restart || exit 1 ;
264
+ fi
211
265
  elif [ "${ADD_USERS}" == 'yes' ] ; then
212
266
  echo "--add-users needs --install: there is no wiki to add accounts to yet." ;
213
267
  fi
@@ -306,7 +360,7 @@ function mediawiki_maintenance_tool() {
306
360
  set_mediawiki_users ;
307
361
  cancel_mediawiki_users ;
308
362
  else
309
- echo "${doc_name}/${PROJECT_NAME}: MediaWiki $(mediawiki_version) at https://${PROJECT_NAME}.ddev.site" ;
363
+ echo "${doc_name}/${PROJECT_NAME}: MediaWiki $(mediawiki_version) at $(mediawiki_url)" ;
310
364
  if mediawiki_installed ; then
311
365
  echo " Extensions: $(sed -nE "s/^wfLoadExtension\( '([^']+)'.*/\1/p" LocalSettings.php | tr '\n' ' ')" ;
312
366
  echo "" ; echo "Accounts:" ;