Upgrading Mediawiki: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "In the following instructions, `eb_deploy` refers to the shell script found in the `littled_wiki` project root. * Download new wiki distribution to `littled_wiki` project roo...")
 
Tag: wikieditor
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
In the following instructions, `eb_deploy` refers to the shell script found in the `littled_wiki` project root.
== Procedure ==
 
<p class="alert alert-info">In the following instructions, `eb_deploy` refers to the shell script found in the `littled_wiki` project root. Note that `eb_deploy` is not the same thing as the command `eb deploy`. Use the shell script and not the `eb` command.</p>


* Download new wiki distribution to `littled_wiki` project root.
* Download new wiki distribution to `littled_wiki` project root.
** Unzip the archive.
** Make sure that all custom extensions listed in `LocalSettings.php` are present in the `extensions` folder of the new distribution.
* Edit `eb_deploy`.
* Edit `eb_deploy`.
** Change `WIKI_DISTRO_DIR` to point to the directory containing the new wiki distribution.
** Change `WIKI_DISTRO_DIR` to point to the directory containing the new wiki distribution.
Line 16: Line 20:
** Custom extensions which would be found at the very end of the file.
** Custom extensions which would be found at the very end of the file.


[[Category:Wiki Customization]]
=== Upgrading the database ===
 
Some MediaWiki updates may require database updates especially related to specific MediaWiki extensions.
 
In order to force the database to update, upload the boilerplate `LocalSettings.php` included in the MediaWiki distribution. When the wiki is next visited, it will prompt for a full configuration including user and database settings. After completing this set up, download the `LocalSettings.php` file and merge it with the previous working version.
 
== Troubleshooting ==
 
=== eb_deploy ===
 
==== `/etc/letsencrypt` directory not found ====
 
'''Symptom:'''
 
The following error is found after running `eb logs`:
 
<syntaxhighlight lang="text">
2022/08/20 16:01:24.558924 [INFO] nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/wiki.dbarchowsky.com/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/wiki.dbarchowsky.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /var/proxy/staging/nginx/nginx.conf test failed
</syntaxhighlight>
 
'''Resolution:'''
 
Edit `/platform/nginx/conf.d/ssl.conf` and comment out the following lines:
 
<syntaxhighlight>
        # Include the Elastic Beanstalk generated locations
        include conf.d/elasticbeanstalk/*.conf;
</syntaxhighlight>
 
Also comment out all keys with paths as values, e.g. `ssl_certificate`, `ssl_certificate_key`, `include`, `ssl_dhparam`
 
Re-run `eb_deploy` locally.
 
=== Extensions ===
 
==== BacktickCode ====
 
Enabling the BacktickCode extension in `LocalSettings.php` causes a 500 error.
 
Search for "Mediawiki backtick" will point to [https://www.mediawiki.org/wiki/Extension:BacktickCode this page]. The information on that page is out of date.
 
The current version of Mediawiki loads extensions with `wfLoadExtension()` not `$wgHooks`. Make sure the code for BacktickCode uses a class named `BacktickCode` and not `$wgHooks`.
 
Also, the current Mediawiki distribution requires an `extension.json` file in the extension directory. The directory without this file will result in a 500 error.
 
If the BacktickCode extension is causing 500 errors, it can be disabled by commenting out the `wfLoadExtension('BacktickCode')` call in `LocalSettings.php`.
 
==== AWS ====
 
See [[Storing Mediawiki Resources on AWS S3]]. The AWS extension requires a `composer.local.json` file in the Mediawiki web root that includes `composer.json` found within the AWS extension folder. This `composer.local.json` must be copied into the MW distro root before running `./eb_deploy`.
 
[[Category:MediaWiki]]

Latest revision as of 04:28, 25 August 2022

Procedure[edit]

In the following instructions, eb_deploy refers to the shell script found in the littled_wiki project root. Note that eb_deploy is not the same thing as the command eb deploy. Use the shell script and not the eb command.

  • Download new wiki distribution to littled_wiki project root.
    • Unzip the archive.
    • Make sure that all custom extensions listed in LocalSettings.php are present in the extensions folder of the new distribution.
  • Edit eb_deploy.
    • Change WIKI_DISTRO_DIR to point to the directory containing the new wiki distribution.
  • Make backup of previous wiki configuration
    • Backup the current wiki database.
    • Make sure to save a copy of the current LocalSettings.php for the wiki to migrate any custom settings to the new wiki distribution.
  • Run eb_deploy.
  • Connect to the wiki on the live server.
    • Go through the installation steps to create LocalSettings.php.
    • Download the newly created LocalSettings.php from the server to [littled_wiki_PROJECT_ROOT]/wiki_config/
  • Migrate settings from previous LocalSettings.php to the new file.
    • Database settings, e.g. $wgDBServer = getenv('MEDIAWIKI_DB_SERVER');
    • Do not store any sensitive information in the configuration file.
    • Custom extensions which would be found at the very end of the file.

Upgrading the database[edit]

Some MediaWiki updates may require database updates especially related to specific MediaWiki extensions.

In order to force the database to update, upload the boilerplate LocalSettings.php included in the MediaWiki distribution. When the wiki is next visited, it will prompt for a full configuration including user and database settings. After completing this set up, download the LocalSettings.php file and merge it with the previous working version.

Troubleshooting[edit]

eb_deploy[edit]

/etc/letsencrypt directory not found[edit]

Symptom:

The following error is found after running eb logs:

2022/08/20 16:01:24.558924 [INFO] nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/wiki.dbarchowsky.com/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/wiki.dbarchowsky.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /var/proxy/staging/nginx/nginx.conf test failed

Resolution:

Edit /platform/nginx/conf.d/ssl.conf and comment out the following lines:

# Include the Elastic Beanstalk generated locations
        include conf.d/elasticbeanstalk/*.conf;

Also comment out all keys with paths as values, e.g. ssl_certificate, ssl_certificate_key, include, ssl_dhparam

Re-run eb_deploy locally.

Extensions[edit]

BacktickCode[edit]

Enabling the BacktickCode extension in LocalSettings.php causes a 500 error.

Search for "Mediawiki backtick" will point to this page. The information on that page is out of date.

The current version of Mediawiki loads extensions with wfLoadExtension() not $wgHooks. Make sure the code for BacktickCode uses a class named BacktickCode and not $wgHooks.

Also, the current Mediawiki distribution requires an extension.json file in the extension directory. The directory without this file will result in a 500 error.

If the BacktickCode extension is causing 500 errors, it can be disabled by commenting out the wfLoadExtension('BacktickCode') call in LocalSettings.php.

AWS[edit]

See Storing Mediawiki Resources on AWS S3. The AWS extension requires a composer.local.json file in the Mediawiki web root that includes composer.json found within the AWS extension folder. This composer.local.json must be copied into the MW distro root before running ./eb_deploy.