Extension:AWS

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
AWS

Release status: experimental

Implementation File repository
Description Allows usage of Amazon Web Services as a back-end infrastructure for MediaWiki
Author(s) Tyler Romeo, Thai Phan
Latest version 0.5 (2013-05-30)
MediaWiki 1.22+
PHP 5.3+
Database changes No
License GPL
Download
Parameters
  • $wgAWSCredentials
  • $wgAWSRegion

Translate the AWS extension if possible

Check usage and version matrix; code metrics

The AWS extension allows your wiki to take advantage of your Amazon Web Services account. It currently only supports using S3 as the file repo but SQS support is coming soon.

Download instructions[edit | edit source]

You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

One of the extensions tags

Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag

  • Go to the tags list
  • Click the name of the tag you want to download
  • Click "snapshot"
The latest version of one of the extensions branches

Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.

  • Go to the branches list
  • Click the branch name
  • Click "snapshot"
A snapshot made during the release of a MediaWiki version.

This might be unstable and is not guaranteed to work with the associated MediaWiki version.

After you've got the code, save it into the extensions/AWS directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AWS.git

Installation[edit | edit source]

Install the AWS SDK[edit | edit source]

You will first need to install the AWS SDK. There is a composer.json file provided in the extension root directory that lists the SDK and all its prerequisites.

1. Download and install composer.

curl -sS https://getcomposer.org/installer | php

2. Install your dependencies.

php composer.phar install

Configure LocalSettings.php[edit | edit source]

1. Choose four (4) different unique keys to be used as the S3 containers for file storage. See the Amazon S3 documentation for more information on what containers are. The three container names must be unique.

2. Add the following code to your LocalSettings.php.

require_once("$IP/extensions/AWS/AWS.php");
 
// Configure AWS credentials
$wgAWSCredentials = array(
    'key' => 'your-aws-key',
    'secret' => 'your-aws-secret'
);
 
$wgAWSRegion = 'your-aws-region';
 
$wgFileBackends['s3']['containerPaths'] = array(
    'wiki_id-local-public' => 'some_s3_bucket_1',
    'wiki_id-local-thumb' => 'some_s3_bucket_2',
    'wiki_id-local-deleted' => 'some_s3_bucket_3',
    'wiki_id-local-temp' => 'some_s3_bucket_4'
);
 
// Make MediaWiki use Amazon S3 for file storage.
$wgLocalFileRepo = array (
    'class'             => 'LocalRepo',
    'name'              => 'local',
    'backend'           => 's3',
    'scriptDirUrl'      => $wgScriptPath,
    'scriptExtension'   => $wgScriptExtension,
    'url'               => $wgScriptPath . '/img_auth.php',
    'zones'             => array(
        'public'  => array( 'url' => 'http://some_s3_bucket_1.s3.amazonaws.com/' ),
        'thumb'   => array( 'url' => 'http://some_s3_bucket_2.s3.amazonaws.com/' ),
        'temp'    => array( 'url' => 'http://some_s3_bucket_3.s3.amazonaws.com/' ),
        'deleted' => array( 'url' => 'http://some_s3_bucket_4.s3.amazonaws.com/' )
    )
);
 
// Make MediaWiki use Amazon SQS for the JobQueue.
// If you only want to use SQS for one job type, switch 'default' with the job type.
$wgJobTypeConf['default'] = array( 'class' => 'JobQueueAmazonSqs' );

Make sure to replace your-aws-key, your-aws-secret, your-aws-region, and the four container names with your own values.

Using separate credentials[edit | edit source]

This extension lets you use multiple services from AWS (e.g., S3 and SQS). In some cases you may want to use different sets of credentials or different regions for different services. This is possible by editing the configuration for each service.

Amazon S3[edit | edit source]

Here is how to add custom credentials to Amazon S3 in LocalSettings.php.

$wgFileBackends['s3']['aws-key'] = 'your-aws-key';
$wgFileBackends['s3']['aws-secret'] = 'your-aws-secret';
$wgFileBackends['s3']['aws-region'] = 'your-aws-region';

Amazon SQS[edit | edit source]

Here is how to add custom credentials to Amazon SQS in LocalSettings.php

// If you only want to change credentials for one job type, switch 'default' with the job type.
$wgJobTypeConf['default']['aws-key'] = 'your-aws-key';
$wgJobTypeConf['default']['aws-secret'] = 'your-aws-secret';
$wgJobTypeConf['default']['aws-region'] = 'your-aws-region';

See also[edit | edit source]