Browse files

added jetty cookbook

  • Loading branch information...
1 parent 9db8e45 commit 04eeff4fdafe1a43538e333aa2b6845b75f39ff7 @schisamo schisamo committed Oct 28, 2010
Showing with 290 additions and 0 deletions.
  1. +54 −0 jetty/README.md
  2. +53 −0 jetty/attributes/default.rb
  3. +51 −0 jetty/metadata.json
  4. +16 −0 jetty/metadata.rb
  5. +59 −0 jetty/recipes/default.rb
  6. +57 −0 jetty/templates/default/default_jetty.erb
View
54 jetty/README.md
@@ -0,0 +1,54 @@
+Description
+===========
+
+Installs and configures Jetty, Java servlet engine and webserver.
+
+Requirements
+============
+
+Platform:
+
+* Debian, Ubuntu (OpenJDK, Sun)
+* CentOS, Red Hat, Fedora (OpenJDK)
+
+The following Opscode cookbooks are dependencies:
+
+* java
+
+Attributes
+==========
+
+* `node["jetty"]["host"]` - Listen to connections from this network host, default '0.0.0.0'.
+* `node["jetty"]["port"]` - The network port used by Jetty, default '8080.
+* `node["jetty"]["jetty_args"]` - Additional arguments to pass to Jetty, default ''.
+* `node["jetty"]["java_options"]` - Extra options to pass to the JVM, default '-Xmx256m -Djava.awt.headless=true'.
+
+Usage
+=====
+
+Simply include the recipe where you want Jetty installed.
+
+TODO
+====
+
+* enable SSL support
+* instrument logging
+
+License and Author
+==================
+
+Author:: Seth Chisamore (<schisamo@opscode.com>)
+
+Copyright:: 2010, Opscode, Inc
+
+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
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+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.
View
53 jetty/attributes/default.rb
@@ -0,0 +1,53 @@
+#
+# Cookbook Name:: jetty
+# Attributes:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+default["jetty"]["host"] = "0.0.0.0"
+default["jetty"]["port"] = 8080
+default["jetty"]["no_start"] = 0
+default["jetty"]["jetty_args"] = ""
+default["jetty"]["java_options"] = "-Xmx256m -Djava.awt.headless=true"
+
+case platform
+when "centos","redhat","fedora"
+ set["jetty"]["user"] = "root"
+ set["jetty"]["group"] = "root"
+ set["jetty"]["home"] = "/usr/share/jetty6"
+ set["jetty"]["config_dir"] = "/etc/jetty6"
+ set["jetty"]["log_dir"] = "/var/log/jetty6"
+ set["jetty"]["tmp_dir"] = "/var/cache/jetty/data"
+ set["jetty"]["context_dir"] = "/srv/jetty6/contexts"
+ set["jetty"]["webapp_dir"] = "/srv/jetty6/webapps"
+when "debian","ubuntu"
+ set["jetty"]["user"] = "jetty"
+ set["jetty"]["group"] = "jetty"
+ set["jetty"]["home"] = "/usr/share/jetty"
+ set["jetty"]["config_dir"] = "/etc/jetty"
+ set["jetty"]["log_dir"] = "/var/log/jetty"
+ set["jetty"]["tmp_dir"] = "/var/cache/jetty/data"
+ set["jetty"]["context_dir"] = "/etc/jetty/contexts"
+ set["jetty"]["webapp_dir"] = "/var/lib/jetty/webapps"
+else
+ set["jetty"]["user"] = "jetty"
+ set["jetty"]["group"] = "jetty"
+ set["jetty"]["home"] = "/usr/share/jetty"
+ set["jetty"]["config_dir"] = "/etc/jetty"
+ set["jetty"]["log_dir"] = "/var/log/jetty"
+ set["jetty"]["tmp_dir"] = "/var/cache/jetty/data"
+ set["jetty"]["context_dir"] = "/etc/jetty/contexts"
+ set["jetty"]["webapp_dir"] = "/var/lib/jetty/webapps"
+end
View
51 jetty/metadata.json
@@ -0,0 +1,51 @@
+{
+ "providing": {
+ },
+ "maintainer": "Opscode, Inc.",
+ "replacing": {
+ },
+ "description": "Installs/Configures jetty",
+ "maintainer_email": "cookbooks@opscode.com",
+ "groupings": {
+ },
+ "attributes": {
+ },
+ "recommendations": {
+ },
+ "dependencies": {
+ "java": [
+
+ ],
+ "jpackage": [
+
+ ]
+ },
+ "suggestions": {
+ },
+ "long_description": "Description\n===========\n\nInstalls and configures Jetty, Java servlet engine and webserver.\n\nRequirements\n============\n\nPlatform: \n\n* Debian, Ubuntu (OpenJDK, Sun)\n* CentOS, Red Hat, Fedora (OpenJDK)\n\nThe following Opscode cookbooks are dependencies:\n\n* java\n\nAttributes\n==========\n\n* `node[\"jetty\"][\"host\"]` - Listen to connections from this network host.\n* `node[\"jetty\"][\"port\"]` - The network port used by Jetty.\n* `node[\"jetty\"][\"jetty_args\"]` - Additional arguments to pass to Jetty \n* `node[\"jetty\"][\"java_options\"]` - Extra options to pass to the JVM \n\nUsage\n=====\n\nSimply include the recipe where you want Jetty installed.\n\nTODO\n====\n\n* enable SSL support\n* instrument logging\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\n\nCopyright:: 2010, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "platforms": {
+ "debian": [
+
+ ],
+ "fedora": [
+
+ ],
+ "centos": [
+
+ ],
+ "ubuntu": [
+
+ ],
+ "redhat": [
+
+ ]
+ },
+ "name": "jetty",
+ "version": "0.0.1",
+ "conflicting": {
+ },
+ "license": "Apache 2.0",
+ "recipes": {
+ "jetty::default": "Main Jetty configuration"
+ }
+}
View
16 jetty/metadata.rb
@@ -0,0 +1,16 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs/Configures jetty"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.0.1"
+
+%w{ java jpackage }.each do |cb|
+ depends cb
+end
+
+%w{ debian ubuntu centos redhat fedora }.each do |os|
+ supports os
+end
+
+recipe "jetty::default", "Main Jetty configuration"
View
59 jetty/recipes/default.rb
@@ -0,0 +1,59 @@
+#
+# Cookbook Name:: jetty
+# Recipe:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+include_recipe "java"
+
+case node.platform
+when "centos","redhat","fedora"
+ include_recipe "jpackage"
+end
+
+jetty_pkgs = value_for_platform(
+ ["debian","ubuntu"] => {
+ "default" => ["jetty","libjetty-extra"]
+ },
+ ["centos","redhat","fedora"] => {
+ "default" => ["jetty6","jetty6-jsp-2.1","jetty6-management"]
+ },
+ "default" => ["jetty"]
+)
+jetty_pkgs.each do |pkg|
+ package pkg do
+ action :install
+ end
+end
+
+service "jetty" do
+ case node["platform"]
+ when "centos","redhat","fedora"
+ service_name "jetty6"
+ supports :restart => true
+ when "debian","ubuntu"
+ service_name "jetty"
+ supports :restart => true, :status => true
+ action [:enable, :start]
+ end
+end
+
+template "/etc/default/jetty" do
+ source "default_jetty.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ notifies :restart, resources(:service => "jetty")
+end
View
57 jetty/templates/default/default_jetty.erb
@@ -0,0 +1,57 @@
+# Defaults for jetty see /etc/init.d/jetty for more
+#
+# It was dynamically generated by Chef on <%= node["fqdn"] %>
+#
+# Local modifications will be overwritten by Chef.
+#
+
+# change to 0 to allow Jetty to start
+NO_START=<%= node["jetty"]["no_start"] %>
+
+# change to 'no' or uncomment to use the default setting in /etc/default/rcS
+VERBOSE=yes
+
+# Run Jetty as this user ID (default: jetty)
+# Set this to an empty string to prevent Jetty from starting automatically
+JETTY_USER=<%= node["jetty"]["user"] %>
+
+# Listen to connections from this network host (leave empty to accept all connections)
+#Uncomment to restrict access to localhost
+JETTY_HOST=<%= node["jetty"]["host"] %>
+
+# The network port used by Jetty
+JETTY_PORT=<%= node["jetty"]["port"] %>
+
+# The location of the Jetty log files
+JETTY_LOGS=<%= node["jetty"]["log_dir"] %>
+
+# Timeout in seconds for the shutdown of all webapps
+#JETTY_SHUTDOWN=30
+
+# Additional arguments to pass to Jetty
+JETTY_ARGS=<%= node["jetty"]["jetty_args"] %>
+
+# Extra options to pass to the JVM
+JAVA_OPTIONS="<%= node["jetty"]["java_options"] %>"
+
+# Home of Java installation.
+JAVA_HOME=<%= node["java"]["java_home"] %>
+
+# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
+# defined in /etc/default/jetty). Should contain a list of space separated directories.
+#JDK_DIRS="/usr/lib/jvm/default-java /usr/lib/jvm/java-6-sun"
+
+# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
+# compilers that are accepted by Ant's build.compiler property.
+#JSP_COMPILER=jikes
+
+# Jetty uses a directory to store temporary files like unpacked webapps
+JETTY_TMP=<%= node["jetty"]["tmp_dir"] %>
+
+# Jetty uses a config file to setup its boot classpath
+#JETTY_START_CONFIG=/etc/jetty/start.config
+
+# Default for number of days to keep old log files in /var/log/jetty/
+#LOGFILE_DAYS=14
+
+#

0 comments on commit 04eeff4

Please sign in to comment.