All code for MozillaWiki is stored in our git repo: https://github.com/mozilla/wiki.mozilla.org
- 1 Server Instances
- 2 Git Branches
- 3 Repository layout
- 4 Use of git submodules
- 5 Use of composer
- 6 Deployment Workflow
- 6.1 Pre-requisites
- 6.2 Deploying for the first time
- 6.3 Deploying changes to super project only
- 6.4 Deploying changes to submodule(s), commit hash only
- 6.5 Deploying submodule additions, removals, or settings changes
All wiki data is periodically ported from Production to Stage, Dev and Sandbox. You are welcome to try things out on these other wiki instances. Your same login should work unless your account is newly created. In that case, visit #wiki to request an account. Note: At any time your edits to Stage, Dev, or Sandbox may be over written.
We have two branches:
After changes are tested via the master branch on our dev server, commits intended for release are cherry-picked into the production branch. This branch is deployed to stage, checked and if all is well, it is deployed to production.
Our github repository is organized as follows:
├── assets ├── core ├── extensions ├── .git ├── tools ├── composer.json ├── composer.lock ├── env_secrets.php ├── .gitignore ├── .gitmodules ├── htaccess ├── LICENSE ├── LocalSettings.php ├── README.md └── secrets.php-dist
- assets: fonts, logos and favicons
- core: this is the core mediawiki software, managed as a git submodule
- extensions: all utilized extensions are included here, managed either by git as submodules or by composer
- tools: this directory includes install and update scripts, an embedded composer binary and sample apache conf files
- composer.json: required for composer package manager
- composer.lock: required for composer package manager
- env_secrets.php: small php scripts that sets variables used by secrets.php via environmental vars
- LocalSettings:php: mediawiki's LocalSettings file, will be symlinked to from core directory
- secrets.php-dist: example of secrets.php file that needs to be created for each deployment (and is ignored by git)
Use of git submodules
Use of composer
All changes should be made via a local checkout of a personal fork of https://github.com/mozilla/wiki.mozilla.org. Once these changes have been submitted as a pull request and accepted, they are ready for deployment.
In order to install the wiki, you need:
- a linux server with apache, php and mysql
- a copy of mozillawiki database
- a copy of images directory (optional)
Note: We currently do not offer a version of the MozillaWiki database that anyone can use for development.
Deploying for the first time
1. Clone the repository
You should clone the repository to a location: a) that you can configure apache to serve from, b) that you can write to without using sudo. You can use your home directory, or Ubuntu's default of /var/www. If you use /var/www we recommend making yourself user of this directory (
sudo chown <username> /var/www).
git clone firstname.lastname@example.org:mozilla/wiki.mozilla.org.git
This will clone the contents of the repository into a directory named wiki.mozilla.org.
2. Run install.sh script
cd wiki.mozilla.org tools/install.sh
The install script:
- initializes and updates the git submodules
- installs extensions as specified by composer
- create a symlink from where mediawiki expects it in core/LocalSettings.php to LocalSettings.php
- create a symlink from inside core to assets directory
- create symlinks for static assets
- changes group of entire directory to www-data (user that apache runs as on Ubuntu)
The last step is required for some extensions.
Notes: a) you should not need to run the install.sh as root or with sudo, b) the install script needs to be run from the top-level directory.
3. Create secrets.php
Now you need to create secrets.php using secrets.php-dist as a template.
cp secrets.php-dist secrets.php
Open this file in the editor of your choice.
<?php $SECRETS_wgServer = 'http://server.dom'; $SECRETS_wgLogo = 'logo.png'; $SECRETS_wgDBserver = 'my_db_server'; $SECRETS_wgDBname = 'db_name'; $SECRETS_wgDBuser = 'db_user'; $SECRETS_wgDBpassword = 'XXXX'; $SECRETS_wgSecretKey = 'XXXXXX'; $SECRETS_wgUpgradeKey = 'XXXX'; $SECRETS_wgReCaptchaPublicKey = ''; $SECRETS_wgReCaptchaPrivateKey = ''; $SECRETS_wgGoogleAnalyticsAccount = ''; $SECRETS_wgSquidServers = array('192.168.1.1', '192.168.1.2'); $SECRETS_wgMemCachedServers = array();
Next, update values for $SECRETS_wgServer, $SECRETS_wgLogo, $SECRETS_wgDBserver, $SECRETS_wgDBname, $SECRETS_wgDBuser, $SECRETS_wgDBpassword.
4. Configure Apache
Use the sample configuration in
tools/wiki-dev.allizom.org.conf to configure an Apache virtualhost.
You might need to enable mod_rewrite with
sudo a2enmod rewrite.
Don't forget to restart apache with
sudo service apache2 graceful.
5. Import database