Chef Server on Vagrant

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build a mirror
of live, locally on vagrant. So that builds closely mirror production I want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef server with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to get the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention. I want
the developers to check out the project and with a single command provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point me at
documentation or a working example.

Cheers

Sean

are you using the vagrant chef solo provisioner? it should automatically
copy over the chef repos,
you can also set up a shared directory containing the chef repo in an
automated fashion

On Tue, Oct 16, 2012 at 2:00 PM, srawilliams seanwil@gmail.com wrote:

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build a
mirror
of live, locally on vagrant. So that builds closely mirror production I
want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef server
with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to get
the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention. I
want
the developers to check out the project and with a single command
provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point me at
documentation or a working example.

Cheers

Sean

On Tue, Oct 16, 2012 at 9:30 AM, srawilliams seanwil@gmail.com wrote:

Has anyone else had experience of doing this and if so can you point me at
documentation or a working example.

One way would be to run the following script with the shell provisioner.

e.g.

Vagrant::Config.run do |config|
config.vm.provision :shell, :path => "bootstrap.sh"
end

--
Andy Gale

http://twitter.com/andygale
https://alpha.app.net/andygale

This is the way we do cookbook development with Vagrant:
http://vialstudios.com/guide-authoring-cookbooks.html

It's a fantastic guide (written by Jamie Winsor) on the complete iteration
cycle. We've been using this method at Riot for some time now and are very
pleased with the results.

Josiah

On Tue, Oct 16, 2012 at 2:49 AM, Andy Gale andy@salgo.net wrote:

On Tue, Oct 16, 2012 at 9:30 AM, srawilliams seanwil@gmail.com wrote:

Has anyone else had experience of doing this and if so can you point me
at
documentation or a working example.

One way would be to run the following script with the shell provisioner.

GitHub - salgo/chef-server-bootstrap: Shell script to bootstrap a chef server using chef-solo for maintainability

e.g.

Vagrant::Config.run do |config|
config.vm.provision :shell, :path => "bootstrap.sh"
end

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale
Not Found

Hi,

you may what to have a look at the repo I posted recently: GitHub - karmi/chef-hello-cloud: A demo of a full stack Rails application deployment (1x load balancer, 3x appserver, 1x database, 3x elasticsearch) with Chef Server

It does a fully automated Chef Server-based installation in Vagrant. This is the relevant part of the Vagrantfile: chef-hello-cloud/Vagrantfile at master · karmi/chef-hello-cloud · GitHub

Karel

On Oct 16, 2012, at 10:30 AM, srawilliams seanwil@gmail.com wrote:

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build a mirror
of live, locally on vagrant. So that builds closely mirror production I want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef server with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to get the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention. I want
the developers to check out the project and with a single command provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point me at
documentation or a working example.

Cheers

Sean

Or you could use Fletcher Nichol's awesome knife-server plugin [1] for
bootstrapping a Chef Server from scratch. In order to make the bootstrap
process more realistic you could use a bare OS basebox [2] with no
Guestadditons, Ruby or Chef installed. If you do this repeatedly and it
becomes too fine-consuming you might consider to repackage a new basebox
once Chef Server is installed...

[1] http://fnichol.github.com/knife-server/
[2]
bills-kitchen-repo/Vagrantfile at master · tknerr/bills-kitchen-repo · GitHub
Am 16.10.2012 17:02 schrieb "Karel Minařík" karel.minarik@gmail.com:

Hi,

you may what to have a look at the repo I posted recently:
GitHub - karmi/chef-hello-cloud: A demo of a full stack Rails application deployment (1x load balancer, 3x appserver, 1x database, 3x elasticsearch) with Chef Server

It does a fully automated Chef Server-based installation in Vagrant. This
is the relevant part of the Vagrantfile:
chef-hello-cloud/Vagrantfile at master · karmi/chef-hello-cloud · GitHub

Karel

On Oct 16, 2012, at 10:30 AM, srawilliams seanwil@gmail.com wrote:

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build a
mirror
of live, locally on vagrant. So that builds closely mirror production I
want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef
server with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to
get the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention. I
want
the developers to check out the project and with a single command
provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point me
at
documentation or a working example.

Cheers

Sean

Once the Chef server is up and empty, I build up knife commands with
Spiceweasel. You can point it at a Chef repository and it will
generate the necessary commands to upload all the
cookbooks/environments/roles/data bags in the proper dependency order.

(It's role-driven, though, so make sure your roles are in order ... if
a cookbook's not in any roles, it won't get uploaded using this
method!)

You could also do variations on "knife cookbook upload -a" ... "find
roles/ -exec knife role from file {} ;" ... etc.

On Tue, Oct 16, 2012 at 3:02 PM, Torben Knerr ukio@gmx.de wrote:

Or you could use Fletcher Nichol's awesome knife-server plugin [1] for
bootstrapping a Chef Server from scratch. In order to make the bootstrap
process more realistic you could use a bare OS basebox [2] with no
Guestadditons, Ruby or Chef installed. If you do this repeatedly and it
becomes too fine-consuming you might consider to repackage a new basebox
once Chef Server is installed...

[1] http://fnichol.github.com/knife-server/
[2]
bills-kitchen-repo/Vagrantfile at master · tknerr/bills-kitchen-repo · GitHub

Am 16.10.2012 17:02 schrieb "Karel Minařík" karel.minarik@gmail.com:

Hi,

you may what to have a look at the repo I posted recently:
GitHub - karmi/chef-hello-cloud: A demo of a full stack Rails application deployment (1x load balancer, 3x appserver, 1x database, 3x elasticsearch) with Chef Server

It does a fully automated Chef Server-based installation in Vagrant. This
is the relevant part of the Vagrantfile:
chef-hello-cloud/Vagrantfile at master · karmi/chef-hello-cloud · GitHub

Karel

On Oct 16, 2012, at 10:30 AM, srawilliams seanwil@gmail.com wrote:

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build a
mirror
of live, locally on vagrant. So that builds closely mirror production I
want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef
server with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to
get the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention. I
want
the developers to check out the project and with a single command
provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point me
at
documentation or a working example.

Cheers

Sean

Berkshelf has an uploader built in, as well. It'll read your cookbook's
dependencies and upload all the cookbooks required to run the cookbook.

On Wed, Oct 17, 2012 at 12:17 AM, steve . leftathome@gmail.com wrote:

Once the Chef server is up and empty, I build up knife commands with
Spiceweasel. You can point it at a Chef repository and it will
generate the necessary commands to upload all the
cookbooks/environments/roles/data bags in the proper dependency order.

(It's role-driven, though, so make sure your roles are in order ... if
a cookbook's not in any roles, it won't get uploaded using this
method!)

You could also do variations on "knife cookbook upload -a" ... "find
roles/ -exec knife role from file {} ;" ... etc.

On Tue, Oct 16, 2012 at 3:02 PM, Torben Knerr ukio@gmx.de wrote:

Or you could use Fletcher Nichol's awesome knife-server plugin [1] for
bootstrapping a Chef Server from scratch. In order to make the bootstrap
process more realistic you could use a bare OS basebox [2] with no
Guestadditons, Ruby or Chef installed. If you do this repeatedly and it
becomes too fine-consuming you might consider to repackage a new basebox
once Chef Server is installed...

[1] http://fnichol.github.com/knife-server/
[2]

bills-kitchen-repo/Vagrantfile at master · tknerr/bills-kitchen-repo · GitHub

Am 16.10.2012 17:02 schrieb "Karel Minařík" karel.minarik@gmail.com:

Hi,

you may what to have a look at the repo I posted recently:
GitHub - karmi/chef-hello-cloud: A demo of a full stack Rails application deployment (1x load balancer, 3x appserver, 1x database, 3x elasticsearch) with Chef Server

It does a fully automated Chef Server-based installation in Vagrant.
This
is the relevant part of the Vagrantfile:

chef-hello-cloud/Vagrantfile at master · karmi/chef-hello-cloud · GitHub

Karel

On Oct 16, 2012, at 10:30 AM, srawilliams seanwil@gmail.com wrote:

Hi,

I am a newbie to chef and need help.

I want developers to be able to check out an infrastructure and build
a
mirror
of live, locally on vagrant. So that builds closely mirror production
I
want to
provision a chef server as part of the local build.

So the first step of the run will be to set up and provision a chef
server with
all the recipies, roles etc from the chef-repo.

Seems straight forward enough to get the chef server provisioned using
chef-solo and rubygems-install. However I am now stumped as to how to
get the
the recipies etc loaded onto the server. Clearly I can do this in a
non-automated way using knife but what i am really after is a seamless
automation, so that the server is built with no manual intervention.
I
want
the developers to check out the project and with a single command
provision the
whole environment including generation of client auth for knife etc.

Has anyone else had experience of doing this and if so can you point
me
at
documentation or a working example.

Cheers

Sean