This is a very rough guide to deploying and updating MediaWiki on Heroku. Lots of assumptions are made. Be sure to keep your MediaWiki deployment up-to-date!
- A GitHub account.
- A Heroku account.
- A configured app on Heroku.
- A MySQL (or compatible database. This guide assumes the use of Cleardb Heroku add-on).
- Optional add-on: Hosted Graphite.
- Optional add-on: Papertrail.
- Optional: SMTP endpoint for email. I use AWS SES.
CLEARDB_DATABASE_URL: mysql://URL_ASSIGNED
HOSTEDGRAPHITE_APIKEY: $KEY_STRING
PAPERTRAIL_API_TOKEN: $TOKEN_STRING
SECRET_KEY: $SOME_RANDOM_STRING_OF_CHARS
SMTP_HOST: tls://email-smtp.us-east-1.amazonaws.com
SMTP_ID_HOST: email-smtp.us-east-1.amazonaws.com
SMTP_PASSWORD: $SES_IAM_PASSWORD
SMTP_PORT: 465
SMTP_USERNAME: $SES_IAM_USERNAME
UPGRADE_KEY: $SOME_RANDOM_STRING_OF_CHARS
wgEmergencyContact: [email protected]
wgPasswordSender: [email protected]
wgUserEmailUseReplyTo: [email protected]
First, fork mediawiki to your GitHub account and then clone.
- In GitHub, fork wikimedia (https://github.com/wikimedia/mediawiki).
- Clone the fork (git clone [email protected]:$USERNAME/mediawiki.git) and
cd mediawiki
. - Change to desired branch (ex:
git checkout REL1_31
).
- Config composer as needed to include extensions and skins.
- Run
composer install
. - Config
LocalSettings.php
.- Be sure not to store any passwords, user names, or other sensitive info. Use Heroku configs to fill in the blanks. (ex:
$wgSecretKey = env("SECRET_KEY");
).
- Be sure not to store any passwords, user names, or other sensitive info. Use Heroku configs to fill in the blanks. (ex:
- Commit and push to
origin
- Set up an upstream remote (used later to update your wiki):
git remote add upstream https://github.com/wikimedia/mediawiki.git)
You should already have set up an app within Heroku. The Heroku CLI should automatically add a git remote
to your repo. You will be pushing from a mediawiki branch to the master branch at Heroku.
- Config Heroku as needed.
- Push to Heroku:
git push origin heroku:master
- Test.
It's important to keep your MediaWiki deployment up-to-date.
- From the repo directory, pull the latest code from the MediaWiki project:
git fetch upstream
. - If upgrading within a single branch (ex: REL1_31), merge branches
git checkout $DESIRED_BRANCH
,git merge upstream/$DESIRED_BRANCH
. Otherwise, checkout the desired branch. - Make changes, as needed. Be sure to copy LocalSetting.php to the desired branch.
- Commit and push to the GitHub forked copy:
git push origin $DESIRED_BRANCH
. - Push to Heroku
git push --force heroku REL1_31:master
. - Test.