15
The MetaCPAN VM Part II Olaf Alders @wundercounter Toronto Perl Mongers Jan 30, 2014 Thursday, 30 January, 14

The MetaCPAN VM Part II (Using the VM)

Embed Size (px)

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.

Citation preview

Page 1: The MetaCPAN VM Part II (Using the VM)

The MetaCPAN VMPart II

Olaf Alders @wundercounterToronto Perl Mongers

Jan 30, 2014

Thursday, 30 January, 14

Page 3: The MetaCPAN VM Part II (Using the VM)

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)

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)

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)

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)

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)

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)

Access and Error Logs

/var/www

Thursday, 30 January, 14

Page 10: The MetaCPAN VM Part II (Using the VM)

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)

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)

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)

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)

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)

Now, let's code!

Thursday, 30 January, 14