the metacpan vm part ii (using the vm)
DESCRIPTION
Now that you have the MetaCPAN VM installed, let's take a look at what you need to know so that you can be productive.TRANSCRIPT
The MetaCPAN VMPart II
Olaf Alders @wundercounterToronto Perl Mongers
Jan 30, 2014
Thursday, 30 January, 14
Installation
Getting started (Part I): http://www.slideshare.net/oalders/the-metacpan-vm-for-dummies-part-one-installation
Thursday, 30 January, 14
Starting your VM
cd metacpan/metacpan-developer vagrant up vagrant ssh
Thursday, 30 January, 14
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
Running web tests
sudo su metacpan cd ~/metacpan.org prove -lvr t
Thursday, 30 January, 14
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
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
Port-Mapped URLs
http://0.0.0.0:5001 (metacpan-web)
http://0.0.0.0:5000 (cpan-api)
Thursday, 30 January, 14
Access and Error Logs
/var/www
Thursday, 30 January, 14
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
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
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
Vagrant Workflow
Edit files on the host
Run tests and deploy code on the guest
Thursday, 30 January, 14
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
Now, let's code!
Thursday, 30 January, 14