1
I've set up a vagrant box with this vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "puphpet/debian75-x64"
config.vm.synced_folder "../.", "/kweetet", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=777,fmode=777"]
config.vm.network "forwarded_port", guest: 80, host: 8080
# install packages
config.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = ["./cookbooks", "./dk_cookbooks"]
chef.add_recipe "nginx"
chef.json = {
"nginx" => {
"init_style" => "upstart"
}
}
end
end
When I vagrant up
the machine for the first time, the nginx service is started automatically, because the provisioning is executed. But when I halt
the machine and up
it again, I have to manually start the nginx server.
So my question is: how to configure my nginx recipe so it starts nginx automatically on system startup?
UPDATE
I've included this in a custom recipe as suggested bu Tejay but it doesn't work:
# make a daemon for nginx
service 'nginx' do
action :enable
end
When I halt my machine and reboot it, nginx isn't started automatically. My custom recipe is included in the vagrant runlist, and I'm sure it is run correctly, because other actions in it, run well.
Any ideas?
I tried that: I have included it in a custom recipe (see update above), but it doens't help. When I halt my vagrant box and 'up' it again, nginx isn't started automatically – Ernie – 2015-01-22T09:02:22.977