Reading/Web/Setting up a staging environment

Setting up a staging environment for the MobileFrontend projects is trivial with MediaWiki-Vagrant in a Cloud VPS, though there are some minor manual steps that you'll need to perform.

Defining an instance
An instance should have the following properties:
 * Security groups: web and default
 * Image id: ubuntu-14.04-trusty
 * It should be configured to ensure that the role::labs::vagrant is enabled.

Set up the instance
ssh to the instance and run the following commands:

sudo puppet agent -tv cd /srv/mediawiki-vagrant vagrant enable-role mobilefrontend minerva svg vagrant enable-role interwiki vagrant enable-role math vagrant enable-role geodata visualeditor cite echo popups wikimediaevents until vagrant up --provision; do :; done
 * 1) For testing the language switcher feature.
 * 1) For testing the lazily-loaded images on pages with equations.
 * 1) The proverbial kitchen sink
 * 1) Keep trying until everything downloads

Set up regular codebase updates
The simplest solution to this is to regularly run. So, as the MediaWiki-Vagrant user add the following to the crontab file : */10 * * * * cd /srv/mediawiki-vagrant; vagrant git-update

Set up the Selenium_newuser and Selenium_user accounts
After you've set up the instance, you'll notice that a Selenium_user account has already been created. You'll need to promote this user, and to create and promote Selenium_newuser as well:

vagrant ssh mwscript maintenance/createAndPromote.php --server wiki --force --bureaucrat --sysop Selenium_user " " mwscript maintenance/createAndPromote.php --server wiki --force --bureaucrat --sysop Selenium_newuser " "

For more information on how to use this password in the browser tests, see the docs.

Adding another admin account
You can add another admin account using the  script as above:

Set up a handful of interlanguage prefixes
Visit the Special:Interwiki page while logged in as a user with the "interwiki" right and add a handful of stub interlanguage prefixes. The selenium tests check the language picker by adding an interlanguage link with the prefix , so add that. If you try to add an interlanguage link to a page (e.g  it may not show up in the mobile view immediately. It may be necessary to run   for it to be available with the langlinks api.

Configure the MobileFrontend extension
See https://phabricator.wikimedia.org/P936 for the production-like configuration for the MobileFrontend extension. Since you're using MediaWiki-Vagrant to set up the instance, you can isolate the MobileFrontend configuration from other extension configurations by creating a file in the  directory, i.e..

Configure proxies
Since the mobilefrontend role depends on the centralauth role, your staging server will have the CentralAuth extension installed and configured. This means that you'll have to create proxies for both the default wiki and the login wiki, which is managed by the centralauth role, e.g. reading-web-staging.wmflabs.org, and login-reading-web-staging.wmflabs.org.

Import articles
You should import articles from a Special:Export dump with the  maintenance script:

(Alternative) Configure MobileFrontend to fetch content from another wiki's API
Per Extension:MobileFrontend, add the following to the config file you created in the Configure the MobileFrontend extension section above:

Edit Vagrantfile-extra.rb
(equivalent to running  )