I’ve got the nginx cookbook in place now, but I’m a little fuzzy on how to
proceed next. I bootstrapped a node and it configured nginx with all the
defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
Or, to just replace the default config block directly and save the hassle
of mucking around with multiple files.
What’s the best way to go about this?
Also, I’m using a SVN repo for my chef repo, because we do our hosting on
Jira OnDemand, which doesn’t offer Git (yet). Is there any way I can get
"knife cookbook download" to play nice with SVN? Can I use git-svn to use
it as a git repo locally but push commits to the master over SVN? I’m sure
I’m not the first person to run into this issue…
Thanks for any help.
–
~~ StormeRider ~~
“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how to proceed next. I bootstrapped a node and it configured nginx with all the defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration as appropriate)
Or, to just replace the default config block directly and save the hassle of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute node["nginx"]["default_site_enabled"] which you can set to false to disable the default site. You can then use the above recommendation to institute your own default site. You can set this from a recipe, role, environment, etc.
Thanks, but I'm a bit more used to Puppet. Where can I put the actual file
in Chef to push it to the node? I'd like to autoconfigure the node
completely with Chef. Does that go in a databag, or a template, or?
Still trying to get bootstrapped myself Too bad there's know
"knife-person bootstrap"...
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta dcrosta@late.am wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how to
proceed next. I bootstrapped a node and it configured nginx with all the
defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration as
appropriate)
Or, to just replace the default config block directly and save the hassle
of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute
node["nginx"]["default_site_enabled"] which you can set to false to disable
the default site. You can then use the above recommendation to institute
your own default site. You can set this from a recipe, role, environment,
etc.
Thanks, but I'm a bit more used to Puppet. Where can I put the actual file in Chef to push it to the node? I'd like to autoconfigure the node completely with Chef. Does that go in a databag, or a template, or?
Check out the cookbook_file resource: http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile. I think that does what you want. You could also use template, which gives you the ability to vary some of the file contents based on node attributes or variables in your recipe, etc.
Still trying to get bootstrapped myself Too bad there's know "knife-person bootstrap"...
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta dcrosta@late.am wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how to proceed next. I bootstrapped a node and it configured nginx with all the defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration as appropriate)
Or, to just replace the default config block directly and save the hassle of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute node["nginx"]["default_site_enabled"] which you can set to false to disable the default site. You can then use the above recommendation to institute your own default site. You can set this from a recipe, role, environment, etc.
When I did some work on Puppet, I found the concept of the file
server hella confusing as I had come from Chef. I also found the
documentation on where to put template files and file-files
confusing. (You should put templates in X dir but Puppet will look
for them in Y dir first, WAT?)
In Chef, when you have a file or template associated with a
cookbook, you can simply drop them in
<cookbook>/templates/default and
<cookbook>/files/default. There are more complex use cases as
well, however, 99% of the time the default directory is good enough
for what you want.
When referencing the files in recipes, you use the "source"
attribute and chef will figure out where the file is starting by
looking in those default cookbook directories.
cookbook_file "/etc/blah/blah.config" do
source "blah.config"
end
This is all in the resource reference page, but I figured it was
worth talking about in more detail if you are used to Puppet and a
file server. Chef and Puppet seem to come at this from odd
directions if you are used to one over the other. I actually
started a Puppet for Chef users series on my blog and was going to
talk about files and templates, but figuring it out for Puppet kind
of gave me some ragefaces. And by the time I was over it, I was
working on something else. I may revisit.
Sascha
On 8/2/12 7:29 AM, Morgan Blackthorne wrote:
<blockquote cite="mid:CAE=pETvmoDRpOBdQ5fMFXTWFULxfs4cCNQ8R=rcqVBR5PZx6mw@mail.gmail.com" type="cite">Thanks, but I'm a bit more used to Puppet. Where can I
put the actual file in Chef to push it to the node? I'd like to
autoconfigure the node completely with Chef. Does that go in a
databag, or a template, or?
Still trying to get bootstrapped myself Too bad there's
know "knife-person bootstrap"...
--
~*~ StormeRider ~*~
"Every world needs its heroes [...] They inspire us to
be better than we are. And they protect from the darkness
that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan
Crosta <dcrosta@late.am>
wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne
wrote:
I've got the nginx cookbook
in place now, but I'm a little fuzzy on how to
proceed next. I bootstrapped a node and it
configured nginx with all the defaults. I wrote my
own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in
/etc/nginx/sites-enabled
disable the
/etc/nginx/sites-enabled/default symlink
You can drop a file in
/etc/nginx/sites-available, and then use
nginx_site
"name-of-your-file-in-sites-available" do enable true end
to have Chef enable the site for you (reloading
nginx's configuration as appropriate)
Or, to just replace the default config
block directly and save the hassle of mucking
around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an
attribute node["nginx"]["default_site_enabled"]
which you can set to false to disable the default
site. You can then use the above recommendation to
institute your own default site. You can set this
from a recipe, role, environment, etc.
When I did some work on Puppet, I found the concept of the file server
hella confusing as I had come from Chef. I also found the documentation on
where to put template files and file-files confusing. (You should put
templates in X dir but Puppet will look for them in Y dir first, WAT?)
In Chef, when you have a file or template associated with a cookbook, you
can simply drop them in /templates/default and
/files/default. There are more complex use cases as well,
however, 99% of the time the default directory is good enough for what you
want.
When referencing the files in recipes, you use the "source" attribute and
chef will figure out where the file is starting by looking in those default
cookbook directories.
cookbook_file "/etc/blah/blah.config" do
source "blah.config"
end
This is all in the resource reference page, but I figured it was worth
talking about in more detail if you are used to Puppet and a file server.
Chef and Puppet seem to come at this from odd directions if you are used to
one over the other. I actually started a Puppet for Chef users series on
my blog and was going to talk about files and templates, but figuring it
out for Puppet kind of gave me some ragefaces. And by the time I was over
it, I was working on something else. I may revisit.
Sascha
On 8/2/12 7:29 AM, Morgan Blackthorne wrote:
Thanks, but I'm a bit more used to Puppet. Where can I put the actual file
in Chef to push it to the node? I'd like to autoconfigure the node
completely with Chef. Does that go in a databag, or a template, or?
Still trying to get bootstrapped myself Too bad there's know
"knife-person bootstrap"...
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta dcrosta@late.am wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how
to proceed next. I bootstrapped a node and it configured nginx with all the
defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration
as appropriate)
Or, to just replace the default config block directly and save the
hassle of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute
node["nginx"]["default_site_enabled"] which you can set to false to disable
the default site. You can then use the above recommendation to institute
your own default site. You can set this from a recipe, role, environment,
etc.
So with some help from tigris on Chef Infra (archive), I got the config mostly sorted out.
However, when I do a chef-client run on the node, I now get:
root@domU-12-31-39-0B-4E-C3:/etc# chef-client
[Thu, 02 Aug 2012 14:47:22 +0000] INFO: *** Chef 10.12.0 ***
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List is
[role[nginx-server-cloudant]]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List expands to [users, sudo,
nginx]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Starting Chef Run for
domU-12-31-39-0B-4E-C3.compute-1.internal
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Running start handlers
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Start handlers complete.
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Loading cookbooks [bluepill,
build-essential, nginx, ohai, runit, sudo, users, yum]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Storing updated
cookbooks/nginx/recipes/proxy-cloudant.rb in the cache.
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:24 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 1/5 in 3s
[Thu, 02 Aug 2012 14:47:27 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:27 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 2/5 in 5s
[Thu, 02 Aug 2012 14:47:32 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:32 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 3/5 in 12s
[Thu, 02 Aug 2012 14:47:44 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:44 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 4/5 in 23s
[Thu, 02 Aug 2012 14:48:07 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:48:07 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 5/5 in 51s
[Thu, 02 Aug 2012 14:48:58 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Running exception handlers
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Saving node information to
/var/cache/chef/failed-run-data.json
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Exception handlers complete
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Stacktrace dumped to
/var/cache/chef/chef-stacktrace.out
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Net::HTTPFatalError: 500 "Internal
Server Error"
root@domU-12-31-39-0B-4E-C3:/etc#
Any idea what might be going on? I'm not sure what it's trying to retrieve
so I'm not sure which log to look into. I was having some stability
problems so I moved from the deb setup to gem setup recently, but I can
look at the web UI and use knife node list, knife role list, etc. just fine.
Thanks!
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:33 AM, Dan Crosta dcrosta@late.am wrote:
Thanks, but I'm a bit more used to Puppet. Where can I put the actual file
in Chef to push it to the node? I'd like to autoconfigure the node
completely with Chef. Does that go in a databag, or a template, or?
Check out the cookbook_file resource: http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile. I
think that does what you want. You could also use template, which gives you
the ability to vary some of the file contents based on node attributes or
variables in your recipe, etc.
Still trying to get bootstrapped myself Too bad there's know
"knife-person bootstrap"...
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta dcrosta@late.am wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how
to proceed next. I bootstrapped a node and it configured nginx with all the
defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration as
appropriate)
Or, to just replace the default config block directly and save the hassle
of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute
node["nginx"]["default_site_enabled"] which you can set to false to disable
the default site. You can then use the above recommendation to institute
your own default site. You can set this from a recipe, role, environment,
etc.
So with some help from tigris on Chef Infra (archive), I got the config mostly sorted out.
However, when I do a chef-client run on the node, I now get:
root@domU-12-31-39-0B-4E-C3:/etc# chef-client
[Thu, 02 Aug 2012 14:47:22 +0000] INFO: *** Chef 10.12.0 ***
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List is
[role[nginx-server-cloudant]]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List expands to [users, sudo,
nginx]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Starting Chef Run for
domU-12-31-39-0B-4E-C3.compute-1.internal
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Running start handlers
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Start handlers complete.
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Loading cookbooks [bluepill,
build-essential, nginx, ohai, runit, sudo, users, yum]
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Storing updated
cookbooks/nginx/recipes/proxy-cloudant.rb in the cache.
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:24 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 1/5 in 3s
[Thu, 02 Aug 2012 14:47:27 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:27 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 2/5 in 5s
[Thu, 02 Aug 2012 14:47:32 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:32 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 3/5 in 12s
[Thu, 02 Aug 2012 14:47:44 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:47:44 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 4/5 in 23s
[Thu, 02 Aug 2012 14:48:07 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:48:07 +0000] ERROR: Server returned error for http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000,
retrying 5/5 in 51s
[Thu, 02 Aug 2012 14:48:58 +0000] INFO: HTTP Request Returned 500 Internal
Server Error: Net::HTTPServerException: 404 "Not Found"
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Running exception handlers
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Saving node information to
/var/cache/chef/failed-run-data.json
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Exception handlers complete
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Stacktrace dumped to
/var/cache/chef/chef-stacktrace.out
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Net::HTTPFatalError: 500
"Internal Server Error"
root@domU-12-31-39-0B-4E-C3:/etc#
Any idea what might be going on? I'm not sure what it's trying to retrieve
so I'm not sure which log to look into. I was having some stability
problems so I moved from the deb setup to gem setup recently, but I can
look at the web UI and use knife node list, knife role list, etc. just fine.
Thanks!
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:33 AM, Dan Crosta dcrosta@late.am wrote:
Thanks, but I'm a bit more used to Puppet. Where can I put the actual
file in Chef to push it to the node? I'd like to autoconfigure the node
completely with Chef. Does that go in a databag, or a template, or?
Check out the cookbook_file resource: http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile. I
think that does what you want. You could also use template, which gives you
the ability to vary some of the file contents based on node attributes or
variables in your recipe, etc.
Still trying to get bootstrapped myself Too bad there's know
"knife-person bootstrap"...
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta dcrosta@late.am wrote:
On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
I've got the nginx cookbook in place now, but I'm a little fuzzy on how
to proceed next. I bootstrapped a node and it configured nginx with all the
defaults. I wrote my own config block which I would like to either:
place in /etc/nginx/sites-available
create a symlink to it in /etc/nginx/sites-enabled
disable the /etc/nginx/sites-enabled/default symlink
You can drop a file in /etc/nginx/sites-available, and then use
nginx_site "name-of-your-file-in-sites-available" do
enable true
end
to have Chef enable the site for you (reloading nginx's configuration as
appropriate)
Or, to just replace the default config block directly and save the
hassle of mucking around with multiple files.
What's the best way to go about this?
Recent versions of the nginx cookbook have an attribute
node["nginx"]["default_site_enabled"] which you can set to false to disable
the default site. You can then use the above recommendation to institute
your own default site. You can set this from a recipe, role, environment,
etc.