Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Last active November 24, 2015 21:25
Show Gist options
  • Save mlafeldt/9347509 to your computer and use it in GitHub Desktop.
Save mlafeldt/9347509 to your computer and use it in GitHub Desktop.
Vagrant + fpm-cookery

Boot up the Vagrant virtual machine:

$ vagrant up

Build a specific recipe with fpm-cookery:

$ RECIPE=<recipe-name> vagrant provision

The final packages will be located here:

$ ls recipes/<recipe-name>/pkg/

Alternatively, ssh into the VM and use fpm-cook directly:

$ vagrant ssh
vm$ cd /vagrant/recipes/<recipe-name>
vm$ sudo fpm-cook
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "jimdo-debian-6.0.7"
config.vm.box_url = "https://jimdo-vagrant-boxes.s3.amazonaws.com/jimdo-debian-6.0.7.box"
config.vm.hostname = "fpm-cookery"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--cpus", 1]
end
recipe = ENV["RECIPE"]
if recipe
unless File.directory?(File.join("recipes", recipe))
abort "error: recipe #{recipe} not found"
end
# Build packages if recipe is provided
config.vm.provision :shell, :inline => "cd /vagrant/recipes/#{recipe} && fpm-cook"
else
# Install fpm-cookery and dependencies
config.vm.provision :shell, :inline => <<SCRIPT
set -e -x
test -f /var/lib/apt/periodic/update-success-stamp || apt-get update -y
apt-get install -y update-notifier-common ruby ruby-dev rubygems
gem install --no-ri --no-rdoc fpm-cookery puppet
SCRIPT
end
end
@beddari
Copy link

beddari commented Mar 6, 2014

I'll add this to https://github.com/norcams/fpm-refinery and tag a 0.1.0 once I get a bootstrap I'm satisfied with. Thanks for the shoutout!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment