MediaWiki-Vagrant: Difference between revisions

add tips
m tag
 
(7 intermediate revisions by 2 users not shown)
Line 9: Line 9:
[[File:MediaWiki-Vagrant.screenshot.png | thumb | screenshot showing aspects of the MediaWiki-Vagrant system]]
[[File:MediaWiki-Vagrant.screenshot.png | thumb | screenshot showing aspects of the MediaWiki-Vagrant system]]


== Engineering / Architecture ==
MediaWiki-Vagrant runs on <strike>HHVM</strike><ref>[[mw:HHVM]]</ref><ref>Facecrook announced in Sept. 2017 that HHVM would not aim for PHP compatibility in the future.[https://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html 1] After discussion[https://lists.wikimedia.org/pipermail/wikitech-l/2017-September/088784.html 2] WMF adopted a plan to [https://phabricator.wikimedia.org/T176370 migrate the WMF production cluster to PHP 7], first [https://phabricator.wikimedia.org/T174431 migrating appservers from Jessie to Stretch]. Once that's done, HHVM support will likely be dropped from MediaWiki (exact details tbd). See [https://phabricator.wikimedia.org/T176209 task T176209].</ref> PHP7-FPM with Apache etc. Of course it all relies on [[Vagrant]] and [[VirtualBox]]
Meanwhile, current versions of [[VirtualBox]] have [https://www.virtualbox.org/ticket/17490 problems with running Guest Additions on Linux]. This is but one ticket. There are tons of examples of breakage, and fixes haven't landed yet in a stable release.  Current solution: run development? (I'm checking on compatibility)


== Quick Tips ==
== Quick Tips ==
Be sure to check the documentation at [[mw:MediaWiki-Vagrant]]
Be sure to check the documentation at [[mw:MediaWiki-Vagrant]]


MediaWiki-Vagrant runs on HHVM.  It simultaneously runs on Apache, but at a more complex host scheme.  To convert all wikis in your MediaWiki-Vagrant instance to PHP5: <code>vagrant roles enable zend && vagrant provision</code>  Once you do this, and visit http://localhost:8080/wiki/Special:Version, you will see '''PHP''' displayed where '''HHVM''' used to be in the product box showing the currently running versions of 'MediaWiki, PHP, MySQL, ICU'  
* wiki login is 'Admin' 'vagrant'
* local shell user is 'vagrant' 'vagrant'
* ssh: <code>vagrant ssh</code>
 
<code>vagrant roles list</code> To enable certain roles in your MediaWiki Vagrant: <code>vagrant roles enable <role> -- provision</code>  Once you do this, and visit http://localhost:8080/wiki/Special:Version, you can check the product box showing the currently running versions of 'MediaWiki, PHP, MySQL, ICU' and extensions.
 
== DNS ==
MediaWiki Vagrant docs will tell you to visit http://dev.wiki.local.wmftest.net:8080/wiki which is fine, because this specific domain routes to 127.0.0.1 (your local host). There's nothing you have to do with DNS. All three of the following are equivalent.
* http://localhost:8080/wiki/Special:Version
* http://127.0.0.1:8080/wiki/Special:Version
* http://dev.wiki.local.wmftest.net:8080/wiki/Special:Version


== Deploy MediaWiki-Vagrant to Amazon ==
== Deploy MediaWiki-Vagrant to Amazon ==
Line 35: Line 49:
==== Console Tools ====
==== Console Tools ====
It may be helpful to have the command line tools for Elastic Cloud installed so that you can test your connection ability.  For Ubuntu,
It may be helpful to have the command line tools for Elastic Cloud installed so that you can test your connection ability.  For Ubuntu,
<source lang="bash">
<syntaxhighlight lang="bash">
sudo apt-get install ec2-api-tools
sudo apt-get install ec2-api-tools
ec2-describe-regions -v --auth-dry-run --aws-access-key KEY --aws-secret-key KEY
ec2-describe-regions -v --auth-dry-run --aws-access-key KEY --aws-secret-key KEY
</source>
</syntaxhighlight>
Rather than specifying your keys on the command line, you may want to set them in <code>~/.bashrc</code> and <code>source</code> the file to bring them into your current shell session. <ref>For some reason, this didn't work for me the first time, so I regenerated keys, and it worked.</ref>
Rather than specifying your keys on the command line, you may want to set them in <code>~/.bashrc</code> and <code>source</code> the file to bring them into your current shell session. <ref>For some reason, this didn't work for me the first time, so I regenerated keys, and it worked.</ref>


<source lang="bash">
<syntaxhighlight lang="bash">
export AWS_ACCESS_KEY=THISISJUSTANEXAMPLE
export AWS_ACCESS_KEY=THISISJUSTANEXAMPLE
export AWS_SECRET_KEY=ThisIsNotARealSecretEnterYourSecretHere
export AWS_SECRET_KEY=ThisIsNotARealSecretEnterYourSecretHere
</source>
</syntaxhighlight>




==== Vagrant-AWS Plugin ====
==== Vagrant-AWS Plugin ====
You need the vagrant-aws plugin (https://github.com/mitchellh/vagrant-aws)
You need the vagrant-aws plugin (https://github.com/mitchellh/vagrant-aws)
<source lang="bash">
<syntaxhighlight lang="bash">
cd ~/vagrant
cd ~/vagrant
vagrant plugin install vagrant-aws
vagrant plugin install vagrant-aws
</source>
</syntaxhighlight>


== Status ==
== Status ==
Line 59: Line 73:
<pre>
<pre>
Current machine states:
Current machine states:
default                  poweroff (virtualbox)
default                  poweroff (virtualbox)
The VM is powered off. To restart the VM, simply run `vagrant up`
The VM is powered off. To restart the VM, simply run `vagrant up`
</pre>
</pre>


The machine is called '''default''' and the provider is '''virtualbox'''.
The machine is called '''default''' and the provider is '''virtualbox'''.
Line 72: Line 82:


== Boxes ==
== Boxes ==
The base box that is used at this time is [https://vagrantcloud.com/debian/boxes/contrib-stretch64/versions/9.4.0/providers/virtualbox.box Debian stretch] (see also https://app.vagrantup.com/debian). If you <code>vagrant up --provision</code> an old box based on Ubuntu, then it will prompt you to destroy the existing box (so that it can re-provision with the right OS) <code>vagrant destroy -f; vagrant up</code>
Each '[http://docs.vagrantup.com/v2/providers/basic_usage.html box]' in vagrant is specific to a provider, so we'll need to get a new box that will run on AWS.
Each '[http://docs.vagrantup.com/v2/providers/basic_usage.html box]' in vagrant is specific to a provider, so we'll need to get a new box that will run on AWS.




<source lang="bash">
<syntaxhighlight lang="bash">
vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
vagrant box list
vagrant box list
</source>
</syntaxhighlight>


You need to create a custom stanza in <code>Vagrantfile-extra.rb</code><ref>Don't edit Vagrantfile since that is distributed by MediaWiki-Vagrant and you won't be able to upgrade your environment</ref>
You need to create a custom stanza in <code>Vagrantfile-extra.rb</code><ref>Don't edit Vagrantfile since that is distributed by MediaWiki-Vagrant and you won't be able to upgrade your environment</ref>
Line 91: Line 103:


To get the keypair_name, you need to create (or upload) a keypair into your AWS Console for the region.  It's easy to create a keypair in the AWS console, and as soon as you do, it will prompt you to download the .pem file.  Save the .pem file to your ~/.ssh/ directory, and ensure the file mode is 400
To get the keypair_name, you need to create (or upload) a keypair into your AWS Console for the region.  It's easy to create a keypair in the AWS console, and as soon as you do, it will prompt you to download the .pem file.  Save the .pem file to your ~/.ssh/ directory, and ensure the file mode is 400
<source lang="bash">
<syntaxhighlight lang="bash">
chmod 400 ~/.ssh/my-aws-keys.pem
chmod 400 ~/.ssh/my-aws-keys.pem
</source>
</syntaxhighlight>


Need to find the image (AMI) you want.  You can search for Ubuntu images at http://cloud-images.ubuntu.com/locator/ec2/ The latest Ubuntu version used in MediaWiki-Vagrant as of March 2015 is Trusty-Tahr (or 14.04 LTS) You need to choose the region that you want to host in.  So for example if you want to host in Oregon state, then you want the "US West" region for Amazon. Searching for "trusty 64 west" we can see several options for the AMD64 architecture
Need to find the image (AMI) you want.  You can search for Ubuntu images at http://cloud-images.ubuntu.com/locator/ec2/ The latest Ubuntu version used in MediaWiki-Vagrant as of March 2015 is Trusty-Tahr (or 14.04 LTS) You need to choose the region that you want to host in.  So for example if you want to host in Oregon state, then you want the "US West" region for Amazon. Searching for "trusty 64 west" we can see several options for the AMD64 architecture
Line 105: Line 117:


I tried to customize the Vagrantfile-extra.rb but couldn't quite understand the required structure
I tried to customize the Vagrantfile-extra.rb but couldn't quite understand the required structure
<source lang=ruby line>
<syntaxhighlight lang=ruby line>
# -*- mode: ruby -*-
# -*- mode: ruby -*-
# vi: set ft=ruby :
# vi: set ft=ruby :
Line 188: Line 200:


end
end
</source>
</syntaxhighlight>


== Test or Run ==
== Test or Run ==
When you're done with the customizations to the Vagrantfile-extra.rb
When you're done with the customizations to the Vagrantfile-extra.rb


<source lang="bash">
<syntaxhighlight lang="bash">
vagrant status
vagrant status
## status looks good?
## status looks good?
vagrant up --provider=aws
vagrant up --provider=aws
</source>
</syntaxhighlight>




Line 212: Line 224:
[[Category:Wiki]]
[[Category:Wiki]]
[[Category:Virtualization]]
[[Category:Virtualization]]
[[Category:MediaWiki]]