How do I speed up my puppet module development-testing cycle?
puppet, vagrant
Solution
- cache your apt/yum repository on your host with the vagrant-cachier plugin
- use profile –evaltrace to find where you loose time on full provisioning
- use package base distribution :
- eg: `rvm install ruby-2.0.0` vs a `pre-compiled ruby package` created with fpm
- avoid a "wget the internet and compile" approach
- this will probably make your provisioning more reproducible and speedier.
- don't code modules
- try reusing some from the forge/github/...
- note that it can be against my previous advice
- if this is an option, upgrade your puppet/ruby version
- iterate and prevent full provisioning
- vagrant up
- vagrant provision
- modify manifest/modules
- vagrant provision
- modify manifest/modules
- vagrant provision
- vagrant destroy
- vagrant up
- launch server-spec
- minimize typed command
- launch command as you modify your files
- you can perhaps setup guard to launch lint/test/spec/provision as you save
- you can also send notifications from guest to host machine with vagrant-notify
- test without actually provisioning in vagrant
- rspec puppet (ideal when refactoring modules)
- test your provisioning instead of manual checking
- stop `vagrant ssh`-ing checking if service is running or a config has a given value
- launch server-spec
- take a look at Beaker
- delegate running the test to your preferred ci server (jenkins, travis-ci,...)
- if you are a bit fustrated by puppet... take a look at ansible
- easy to setup (no ruby to install/compile)
- you can select portion of stuff you want to run with tags
- you can share the playbooks via synched folders and run ansible in the vagrant box locally (no librairian-puppet to launch)
update : after discussion with @garethr, take a look at his last presentation about guard.
Problem
I'm looking for some best practices on how to increase my productivity when writing new puppet modules. My workflow looks like this right now: - vagrant up - Make changes/fixes - vagrant provision - Find mistakes/errors, GOTO 2 After I get through all the mistakes/errors I do: - vagrant destroy - vagrant up - Make sure everything is working - commit my changes This is too slow... how can i make this workflow faster? I am in denial about writing tests for puppet. What are my other options?