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:
 * medium ("large" instances are rarely needed and space is precious and limited in our project environment)
 * Image id: debian-9.4-stretch
 * Edit instance and ensure security groups: web and default
 * It should be configured (in puppet configuration) to ensure that the role::labs::vagrant is enabled.

Check the instance is working
Follow instructions on wikitech

Confirm your new instance is accessible from the web.

Reading-web-ify the instance
Once you've confirmed the instance is running you'll want it useful to your team! The following commands are recommended:

vagrant enable-role mobilefrontend minerva vagrant enable-role interwiki vagrant enable-role math vagrant enable-role wikidiff2 vagrant enable-role cite echo svg eventlogging vagrant enable-role popups wikimediaevents relatedarticles vagrant enable-role geodata visualeditor 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) Recommended installations
 * 2) For testing diffs
 * 1) Recommended reading web projects
 * 1) The proverbial kitchen sink (optional extras)
 * 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  )

readers-web-master set up
Stephen manages this server! It's ok to change it in a pinch but let them know so they can wipe it and start over. This is supposed to be a well defined configuration!
 * 1) Most of the set up is in MediaWiki-Vagrant in a Cloud VPS. Follow the screenshots repeated below (now on debian-9.4-stretch). HorizonLaunchInstanceScreenPart1-2018-05-07-14-17.png HorizonLaunchInstanceScreenPart2-2018-05-07-14-17.png HorizonLaunchInstanceScreenPart3-2018-05-07-14-17.png HorizonLaunchInstanceScreenPart4-2018-05-07-14-17.png HorizonPuppetConfiguration-2018-06-15-10-55.png HorizonCreateAProxyScreen-2018-05-07-14-22.png


 * 1) After configuring everything in Horizon:
 * 2) Test the instance https://readers-web-master.wmflabs.org.

Troubleshooting
would collide with some other application that is already listening on these ports." - run sudo netstat -nlp | grep :8080 and then sudo kill the pid
 * Ports sometimes hang open after  but restarting fixes them.
 * No wiki is sometimes shown after provisioning but  and restarting fixes it.
 * "Vagrant cannot forward the specified ports on this VM, since they
 * the wiki not found (showing in web interface): vagrant ssh, then run sudo service apache2 restart
 * Visiting https://horizon.wikimedia.org/project/instances/ and soft rebooting may help you with any port issues. Try multiple times if necessary!