Giter Site home page Giter Site logo

jetty's Introduction

hipsnip-jetty

A cookbook to setup a Jetty 8/9 server.

Build status Dependency Status

Requirements

Built to run on Linux distribution. Tested on Ubuntu 12.04. Depends on the java cookbook.

Usage

By default the Jetty server is running on port 8080, override node[:jetty][:port] if you're not happy with that. As you can see below you can personnalized your Jetty installation thanks to a bunch of attributes to run a Jetty server as you wish.

N.B: Do not freak out when you see this message on the root page of the Jetty server.

Error 404 - Not Found.

No context on this server matched or handled this request.
Contexts known to this server are:

Everything is alright, it only means that nothing is deployed on the root context which is okay that's your job ;).

For example if you like to install Jetty 9 and use syslog:

node.set['java']['jdk_version'] = 7

node.set['jetty']['port'] = 8080
node.set['jetty']['version'] = '9.0.3.v20130506'
node.set['jetty']['link'] = 'http://eclipse.org/downloads/download.php?file=/jetty/9.0.3.v20130506/dist/jetty-distribution-9.0.3.v20130506.tar.gz&r=1'
node.set['jetty']['checksum'] = 'eff8c9c63883cae04cec82aca01640411a6f8804971932cd477be2f98f90a6c4'

node.set['jetty']['syslog']['enable'] = true
node.set['jetty']['syslog']['priority'] = 'user.notice'
node.set['jetty']['syslog']['tag'] = 'TEST'

include_recipe 'hipsnip-jetty'

For more usage examples, have a look to the recipes in test/cookbooks/hipsnip-jetty_test/recipes/.

Attributes

  • node["jetty"]["user"] - name of the jetty user, default "jetty".

  • node["jetty"]["group"] - name of the jetty group, default "jetty".

  • node["jetty"]["home"] - location of the home directory of jetty, default "/usr/share/jetty".

  • node["jetty"]["port"] - port number of where jetty listens, default 8080

  • node["jetty"]["args"] - arguments pass to jetty at startup , default [], e.g: ["jetty.logs=/var/log/jetty"].

  • node["jetty"]["logs"] - location of the log directory for jetty logs files, default "/var/log/jetty", by default only a file containing the logs of each requests is created by Jetty in this folder, all other logs go to stdout but you use the attributes to put all logs in syslog or separate files.

  • node["jetty"]["java_options"] - extra arguments pass to the jvm, default []. Note: Between two chef run the attributes are saved on the node if you add on each run an argument, the argument will be duplicated on each new run in the array, use ".uniq" method if you don't want to have duplicated argument in your array when you add a new argument.

  • node["jetty"]["add_confs"] - set of paths, each path must point to a Jetty configuration file, relative path are relative to jetty home directory, default []. e.g: ['etc/jetty-webapps.xml', 'etc/jetty-http.xml']

  • node["jetty"]["version"] - version of jetty, default '8.1.10.v20130312'.

  • node["jetty"]["link"] - link to the jetty archive, default 'http://eclipse.org/downloads/download.php?file=/jetty/stable-8/dist/jetty-distribution-8.1.10.v20130312.tar.gz&r=1', the link and the version must be coherent.

  • node["jetty"]["checksum"] - hash sha256 of the jetty archive, default 'e966f87823adc323ce67e99485fea126b84fff5affdc28aa7526e40eb2ec1a5b'

  • node["jetty"]["directory"] - location of the extracted archive, default "/usr/local/src"

  • node["jetty"]["log"]["level"] - log level , default "INFO". levels: SEVERE ERROR WARNING INFO CONFIG FINE FINER FINEST

  • node["jetty"]["log"]["class"] - java class used for logging, default "org.eclipse.jetty.util.log.StdErrLog"

  • node["jetty"]["syslog"]["enable"] - if true, it will use the utility logger to log messages into syslog, default false. In order to do this a custom init script is used, see in the "templates" folder, the init script is different for Jetty 8 and Jetty 9.

  • node["jetty"]["syslog"]["priority"] - string expressing the priority, format expected is "facilility.level", passes the given string as value to the logger utility into the option "--priority"

  • node["jetty"]["syslog"]["tag"] - tag the messages with the given string, passes the given string as value to the logger utility into the option "--tag"

  • node["jetty"]["start_ini"]["custom"] - if true, it will generate a configuration file start.ini from the value of the node attribute ["jetty"]["start_ini"]["content"], it means that the default configuration file start.ini downloaded from the mirror will not be copied in the jetty home, default false.

  • node["jetty"]["start_ini"]["content"] - an array of strings, each row is a line of text in the configuration file start.ini. The value of this attribute is used only if node["jetty"]["start_ini"]["custom"] = true otherwise the value is ignored. default [].

Cookbook development

You will need to do a couple of things to be up to speed to hack on this cookbook. Everything is explained here have a look.

Test

bundle exec rake cookbook:full_test

Licence

Author: Rémy Loubradou

Copyright 2013 HipSnip Limited

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.

jetty's People

Contributors

lbdremy avatar mattcl avatar motns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jetty's Issues

No way to pass to --list-config to Jetty 9

When troubleshooting Jetty 9 configurations, the --list-config option on ${jetty.home}/start.jar is the best way to discover how the ${jetty.base} is configured.

Yet using node["jetty"]["args"] produces no output.

Should be possible to customize the configuration start.ini if necessary from the node attributes

It would be convenient to be able to customize the configuration file start.ini used by Jetty at startup, for that we need two new attributes:

node['jetty']['start_ini']['custom'] = true
node['jetty']['start_ini']['content'] = [
'OPTIONS=Server,jsp',
'etc/jetty.xml',
'etc/jetty-webapps.xml',
'etc/jetty-contexts.xml'
]

These attributes will allow to generate a file start.ini that will override the default start.ini file, from the example above the brand new start.ini file will look like that:

#===========================================================
# Jetty start.jar arguments
# Each line of this file is prepended to the command line 
# arguments # of a call to:
#    java -jar start.jar [arg...]
#===========================================================
OPTIONS=Server,jsp
etc/jetty.xml
etc/jetty-webapps.xml
etc/jetty-contexts.xml

Jetty 9 Doesn't Start

This cookbook currently installs Jetty 9 and finishes without error, but Jetty 9 doesn't start successfully.

JETTY_HOME + JETTY_USER not being set

Is this perhaps an issue with my setup? Jetty manages to install everything but doesn't set the JETTY_HOME or JETTY_USER environment variables. Running echo $JETTY_HOME or echo $JETTY_USER returns blank values.

If you are going to use java.util.logging with chef, make jetty 9 use it too

It appears that you are configuring Jetty 9 for java.util.logging.

If that is the case, then either config:

  1. Jetty to use Slf4jLog internally (using slf4j's java.util.logging bridge)
  2. Jetty to use JavaUtilLog internally (using your own configured java.util.logging handler to manage output)

In either case, the use of --module=logging should be discouraged, as that will simply redirect System.out and System.err to a file ${jetty.base}/logs/stderrlog.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.