How to Setup a Free MediaWiki on Heroku
Join the DZone community and get the full member experience.
Join For FreeI had to setup a wiki for some project, and thought of using Heroku for this purpose.
Heroku doesn’t cost anything for 1 dyno, and comes with a bundled 5MB database that might just suffice for this project’s need. To my surprise, I didn’t find any guide on how to do it … but the task didn’t prove to be difficult at all:
- Create a new git repository
- Populate it with the latest MediaWiki installation
- heroku create <app_name>
- git push heroku master
- Setup a CNAME record pointing wiki.yourproject.org to your-project.herokuapp.com
- git config | grep DATABASE
- Go to http://wiki.yourproject.org/, follow the wizard and configure your database
- This creates a LocalSettings.php file – download it but DO NOT COMMIT IT yet.
- Edit it, and replace all the local database settings with this:
## Database settings $_wgDBConnectionString = getenv('DATABASE_URL'); if (preg_match('%(.*?)://([^:]+):([^@]+)@([^:]+):(\d+)/(.*)%', $_wgDBConnectionString, $regs, PREG_OFFSET_CAPTURE)) { $wgDBtype = $regs[1][0]; $wgDBuser = $regs[2][0]; $wgDBpassword = $regs[3][0]; $wgDBserver = $regs[4][0]; $wgDBport = $regs[5][0]; $wgDBname = $regs[6][0]; } else { die("Failed to parse DB connection string"); }
(Obviously, it’s important not to commit your user/pass to a public git repository. If you accidentally did, just remove all reference to it from source control, parse the connection string as above, and then reset your db password).
For your convenience/reference, here is the github repository, although I recommend to just follow the procedure above in order to get the latest MediaWiki and setup wizard.
Published at DZone with permission of Ron Gross, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Introduction to API Gateway in Microservices Architecture
-
Azure Virtual Machines
-
Understanding Data Compaction in 3 Minutes
-
How To Use Git Cherry-Pick to Apply Selected Commits
Comments