Skip to content

Instantly share code, notes, and snippets.

@rmrfslashbin
Last active August 16, 2022 06:26
Show Gist options
  • Save rmrfslashbin/766ec544fb0742172c72aca7f4465194 to your computer and use it in GitHub Desktop.
Save rmrfslashbin/766ec544fb0742172c72aca7f4465194 to your computer and use it in GitHub Desktop.
Deploying and updating MediaWiki on Heroku.

Deploying and Updating MediaWiki on Heroku

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!

Assumptions

  • 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.

Heroku Configs

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]

Forking

First, fork mediawiki to your GitHub account and then clone.

Config

  • 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");).
  • 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)

Deploy

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.

Update

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment