Short url: caseywatts.com/mediawikionheroku
Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book
How to get set up with Mediawiki running on Heroku.
Create Git Repo
Fork https://github.com/mediawiki/mediawiki (from the web interface)
master worked fine for me, but you might want the last stable tag?)
git clone https://github.com/YOURUSERNAME/mediawiki heroku apps:create YOURAPPNAME
Mediawiki's repo doesn't have a
composer.lock in it, and Heroku requires one. (I wish I knew more about why they didn't check that in?)
Before being able to generate a
composer.lock, you may need to get
php installed using brew see here (brew is for OSX). Packagist require you use a not-old version of
openssl in your php, or else it won't let you download packages from it. Installing through
brew gets a newer version of
openssl bundled into your install of php.
Generate and add to the repo a
brew install composer composer update git add -f composer.lock git commit -m "add composer.lock" git push heroku master
Configuring with ClearDB
Install an instance of ClearDB, either through the Heroku Dashboard or CLI. The free database isn't enough, you'll probably need the cheapest paid one ('punch', not 'ignite').
heroku addons:create cleardb:punch
Get the database information from the CLEARDB_DATABASE_URL ready to use soon
mysql://USERNAME:PASSWORD@HOST/TABLENAME (and there is no table prefix)
Now go to your deployed Heroku app, and follow the setup wizard. Put in the database information where requested.
Once you're done, you'll have to download
LocalSettings.php and change some things before checking it into the repo. DO NOT check in
LocalSettings.php with the passwords still in it. Instead, we'll use ENV vars.
## Database settings sesction of LocalSettings.php with this (based on this):
## Database settings $url = parse_url(getenv("CLEARDB_DATABASE_URL")); $wgDBtype = "mysql"; $wgDBserver = $url["host"]; $wgDBname = substr($url["path"], 1); $wgDBuser = $url["user"]; $wgDBpassword = $url["pass"];
$wgSecretKey into an ENV var:
$wgSecretKey = getenv("SECRET_KEY");
Also move the
$wgUpgradeKey into an ENV var:
$wgUpgradeKey = getenv("UPGRADE_KEY");
Now you can add, check in, push the new file "LocalSettings.php"
git add -f "LocalSettings.php" git commit -m "add LocalSettings.php" git push heroku master
Installing a Skin (Vector)
You can install the vector skin by adding it to the
composer.json - add a line something like this (followed by
Then you'll have to add the skin explicitly to the bottom of
LocalSettings.php like the instructions on the deployed site say to do (but what is the default skin for if it's not used??):
wfLoadSkin( 'Vector' );
An Example Setup
Compare it to mediawiki's repo to see the differences: https://github.com/wikimedia/mediawiki/compare/master...caseywatts:master
Inspiration taken from: