The MetaCPAN VM Part II (Using the VM)
-
Upload
olaf-alders -
Category
Technology
-
view
388 -
download
2
description
Transcript of The MetaCPAN VM Part II (Using the VM)
![Page 1: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/1.jpg)
The MetaCPAN VMPart II
Olaf Alders @wundercounterToronto Perl Mongers
Jan 30, 2014
Thursday, 30 January, 14
![Page 2: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/2.jpg)
Installation
Getting started (Part I): http://www.slideshare.net/oalders/the-metacpan-vm-for-dummies-part-one-installation
Thursday, 30 January, 14
![Page 3: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/3.jpg)
Starting your VM
cd metacpan/metacpan-developer vagrant up vagrant ssh
Thursday, 30 January, 14
![Page 4: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/4.jpg)
Just become metacpan
For almost everything, you'll be better off as the metacpan user
So, "sudo su metacpan" whenever you start an SSH session
Thursday, 30 January, 14
![Page 5: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/5.jpg)
Running web tests
sudo su metacpan cd ~/metacpan.org prove -lvr t
Thursday, 30 January, 14
![Page 6: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/6.jpg)
Running api tests # run Elasticsearch in the foreground # you don't have to stop elasticsearch, but it saves some resources
vagrant ssh sudo /etc/init.d/elasticsearch stop sudo /opt/elasticsearch-0.20.2/bin/elasticsearch -f \ -Des.http.port=9900 -Des.cluster.name=testing
# log in with a new session to run the tests # don't pass the -r flag to prove vagrant ssh sudo su metacpan cd ~/api.metacpan.org source ~/.metacpanrc prove -lv t
Thursday, 30 January, 14
![Page 7: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/7.jpg)
Restarting Services /etc/init.d/metacpan-www restart /etc/init.d/metacpan-api restart
# if you're running the api locally sudo /etc/init.d/elasticsearch restart
# if you're indexing the full CPAN # and want to watch for the latest changes sudo /etc/init.d/metacpan-watcher start
Thursday, 30 January, 14
![Page 8: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/8.jpg)
Port-Mapped URLs
http://0.0.0.0:5001 (metacpan-web)
http://0.0.0.0:5000 (cpan-api)
Thursday, 30 January, 14
![Page 9: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/9.jpg)
Access and Error Logs
/var/www
Thursday, 30 January, 14
![Page 10: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/10.jpg)
Installing Modules # front end deps sudo su metacpan cd ~/metacpan.org sudo ~/bin/install_modules --installdeps .
# api deps cd ~/api.metacpan.org sudo ~/bin/install_modules --installdeps .
# install some arbitrary module sudo ~/bin/install_modules Acme::Urinal
Thursday, 30 January, 14
![Page 11: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/11.jpg)
Prefer plackup? # front end sudo su metacpan cd ~/metacpan.org /etc/init.d/metacpan-www stop
plackup -R lib --port 5001
# api cd ~/api.metacpan.org /etc/init.d/metacpan-api stop
plackup -R lib --port 5000
Thursday, 30 January, 14
![Page 12: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/12.jpg)
Prefer carton? # assumes you are "metacpan" and have stopped services # front end cd ~/metacpan.org carton install
carton exec plackup -R lib --port 5001
# api cd ~/api.metacpan.org carton install
carton exec plackup -R lib --port 5000
Thursday, 30 January, 14
![Page 13: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/13.jpg)
Vagrant Workflow
Edit files on the host
Run tests and deploy code on the guest
Thursday, 30 January, 14
![Page 14: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/14.jpg)
Playing with Puppet # on the host, in the dev directory you created cd metacpan/metacpan-puppet # let's add a new binary (ncdu) to the system vi modules/metacpan/manifests/packages.pp
package { ncdu: ensure => present }
cd ../../metacpan-developer vagrant provision
Thursday, 30 January, 14
![Page 15: The MetaCPAN VM Part II (Using the VM)](https://reader034.fdocuments.net/reader034/viewer/2022052303/547e1fedb4af9fa0158b55a3/html5/thumbnails/15.jpg)
Now, let's code!
Thursday, 30 January, 14