The contents of this document are in active development and therefore may not be entirely accurate.
Depending on the situation and use case there are several ways to install this cookbook. All the methods listed below assume a tagged version release is the target, but omit the tags to get the head of development. A valid Chef repository structure like the [Opscode repo][chef_repo] is also assumed.
The [Librarian][librarian] gem aims to be Bundler for your Chef cookbooks.
Include a reference to the cookbook in a Cheffile and run
librarian-chef install. To install with Librarian:
gem install librarian cd chef-repo librarian-chef init cat >> Cheffile <<END_OF_CHEFFILE cookbook 'webapp', :git => 'git://github.com/fnichol/chef-webapp.git', :ref => 'v0.2.0' END_OF_CHEFFILE librarian-chef install
The [knife-github-cookbooks][kgc] gem is a plugin for knife that supports installing cookbooks directly from a GitHub repository. To install with the plugin:
gem install knife-github-cookbooks cd chef-repo knife cookbook github install fnichol/chef-webapp/v0.2.0
As a Git Submodule
A common practice (which is getting dated) is to add cookbooks as Git submodules. This is accomplishes like so:
cd chef-repo git submodule add git://github.com/fnichol/chef-webapp.git cookbooks/webapp git submodule init && git submodule update
Note: the head of development will be linked here, not a tagged release.
As a Tarball
If the cookbook needs to downloaded temporarily just to be uploaded to a Chef Server or Opscode Hosted Chef, then a tarball installation might fit the bill:
cd chef-repo/cookbooks curl -Ls https://github.com/fnichol/chef-webapp/tarball/v0.2.4 | tar xfz - && \ mv fnichol-chef-webapp-* webapp
Resources and Providers
webapp_site_skel (out of date)
|create||Create the resources needed to host a web application with a name and deployment profile.||Yes|
|delete||Remove the web application and its stubs.|
|disable||Disable the web application from being able to serve itself.|
|name||Name attribute: A unique identifier for the web application. This will be used for directory naming among other things.||
|profile||Declare the kind of web application that will be hosted. Current supported profiles are
|user||User that will own the web application and possibly control its deployment.||
|group||Group that will be used when set ownership on files and directories relating to the web application.||The value of the
|host_name||The primary host name that will be set in the virtual host configuration.||
|host_aliases||An array of additonal host name aliases that the web server will respond to.||
|non_ssl_server||Create a non-SSL virtual host for this web application?||
|listen_ports||An array of non-SSL ports that the web server will listen on for this web application.||
|www_redirect||Create a virtual host that redirects
|ssl_server||Create an SSL virtual host for this web application?||
|ssl_listen_ports||An array of SSL ports that the web server will listen on for this web application.||
|ssl_www_redirect||Create a virtual host that redirects
|ssl_cert||The public key for the SSL certificate.||
|ssl_key||The private key for the SSL certificate.||
A Rack Web Application Skel
webapp_site_skel "wiki" do profile "rack" host_name "wiki.example.com" www_redirect false end
www_redirect here will prevent the server from responding
to traffic on
An SSL Rails Application
Here a custom SSL certificate was declared which needs to be supplied to server by other means. An additional non-SSL listen port of 3000 was also declared.
webapp_site_skel "redmine" do profile "rails" host_name "pm.example.com" listen_ports [ 80, 3000 ] ssl_server true ssl_cert "ssl-cert-example.com.crt" ssl_key "ssl-cert-example.com.key" end
A PHP Application
Here is a questionable PHP site that needs to be taken diabled and taken
offline. It also answers to multiple host names and
webapp_site_skel "wp" do profile "php" host_name "blog.example.com" host_aliases [ "therealdeal.example.com", "example.com" ] user "php_hack" action :disable end
Note: Disabling the web application will not delete it but de-register it from the web server's enabled virtual hosts.
Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make.
License and Author
Author:: [Fletcher Nichol][fnichol] (firstname.lastname@example.org)
Copyright:: 2010, 2011, Fletcher Nichol
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.