Archive

Archive for the ‘plugin’ Category

Released Grails Spy plugin 0.2

July 6th, 2010 Comments off

I just released version 0.2 of my Grails Spy plugin.

About

The Grails Spy plugin provides some views to inspect Grails internals such as the Spring application context(s), artefacts, etc.

As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a BeanBuilder, there is no Spring xml file with bean definitions.

In order to browse the dynamic bean definitions, Grails Spy can be used to watch into an application’s guts.

Installation

grails install-plugin spy

Usage

Simply install the plugin, enable the Spy controller for the dev environment and run grails run-app. Then browse to http://localhost:8080/yourapp/spy and enjoy.

Changes

  • For security reasons the Spy controller must now be enabled in Config.groovy:
    grails.plugins.spy.enabled = true
    

    The plugin can be enabled or disabled individually for each environment. Example:

    environments {
        production {
            grails.serverURL = "http://www.changeme.com"
        }
        development {
            grails.serverURL = "http://localhost:8080/${appName}"
    	grails.plugins.spy.enabled = true
        }
        test {
            grails.serverURL = "http://localhost:8080/${appName}"
        }
    }
    
  • 'inspect' is now the default action for the spy controller, so it can be called as http://localhost:8080/yourapp/spy instead of http://localhost:8080/yourapp/spy/inspect

License

The Spy plugin is released under the Apache License 2.0.

Source code and Issues

The source code is hosted at GitHub, issues can be reported here.

Screenshots

Eye-candy you say? See below:

GrailsSpy: GrailsApplication

GrailsSpy: ApplicationContext view

GrailsSpy: bean view

Categories: grails, plugin, spy Tags:

Released Grails spy plugin

January 6th, 2010 1 comment

While digging through the inner workings of Grails in order to improve my OSGi plugin, it is sometimes necessary to inspect the GrailsApplication object and its companion Spring ApplicationContext(s).

As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a BeanBuilder, there is no Spring xml file with bean definitions.

Only the main application context can be inspected, e.g. by extracting it from the generated war file:

jinspect -a target/myapp-0.1.war

In order to browse the dynamic bean definitions I created a little plugin called Grails Spy, which can be used to watch into an application’s guts.

License

The Spy plugin is released under the Apache License 2.0.

Source code and Issues

The source code is hosted at GitHub, issues can be reported here.

Installation

As always, simply execute grails install-plugin spy.

Note: until the Grails plugin page is sync’ed, the plugin can also be installed using
grails install-pluginhttp://cloud.github.com/downloads/jetztgradnet/grails-spy-plugin/grails-spy-0.1.zip

Usage

Simply browse to http://localhost:8080/myapp/spy/ and have a closer look.

Note: this path is NOT PROTECTED, so don’t do this in a production environment! Or at least use one of the security plugins to protect this page.

Screenshots

Eye-candy you say? See below:

GrailsSpy: GrailsApplication

GrailsSpy: ApplicationContext view

GrailsSpy: bean view

Categories: grails, plugin, spy Tags:

Grails on OSGi (3): Released Grails OSGi plugin 0.1

January 3rd, 2010 30 comments

The Grails OSGi plugin provides scripts to package a Grails application as an OSGi bundle. Additionally the bundle(s) may be run in an OSGi container assembled ad hoc by the excellent Pax Runner or deployed to a SpringSource DM Server.

License

The OSGi plugin is released under the Apache License 2.0.

Installation

Simply call grails install-plugin osgi to install the OSGi plugin.

Usage:

Creating an OSGi bundle from the Grails application

grails bundle
grails prod bundle

Running the bundle

grails run-bundle
grails prod run-bundle

The application can be accessed at http://localhost:8080/myapp/.

Note: at first start the OSGi runtime is assembled, which may take some time, while Maven is downloading the internet…

Creating a zipped OSGi runtime

grails assemble-osgi-runtime
grails prod assemble-osgi-runtime

Deploy bundle to DM Server

grails dmserver deploy (Not yet implemented)

Getting around the OSGi runtime

The OSGi runtime is based on the Equinox OSGi framework, Pax Web and some additional bundles.

Web Console

The Felix Web Management Console provides excellent insight into the inner workings (see Screenshots). It can be accessed at http://localhost:8080/system/console/ with user “admin” and password “admin”.

Shell Console

The command grails run-bundle drops the user in the Equinox Shell. Typing help shows the available commands.

How it works

In order to be a valid OSGi bundle, the application is war’ed and provided with the necessary bundle manifest headers (see scripts/_Event.groovy for details).
The bundle can be created using grails bundle.

The OSGi runtime is assembled in the target/osgi directory.

Source code and Issues

The source code is hosted at GitHub, issues can be reported here.

Roadmap

  • make bundle generation configurable (e.g. include/exclude dependencies, …)
  • make OSGi runtime created by grails run-bundle and grails assemble-osgi-runtime configurable
  • support auto-reloading of changed artifacts
  • use Spring DM instead of Pax Web as Web extender
  • remove dependencies from bundle and package them as their own plugins (re-using existing bundles from the SpringSource Enterprise Repository
  • export main Grails beans and application context as OSGi service
  • export services as OSGi service (via static expose = 'osgi')
  • provide access to OSGi BundleContext to artifacts (controllers, services, …)
  • implement deployment to DM Server
  • consider other deployment options: Apache Karaf, …
Categories: grails, osgi, plugin, release Tags:

Started new offline Grails Plugin Repository

September 10th, 2009 6 comments

Plugrepo is an offline Grails (and maybe Griffon) plugin repository. It can be used as an offline proxy for the grails.org repository as well as a repository for internal plugins, which are not ment to be published.

The application is work in progress, see project page at http://github.com/jetztgradnet/plugrepo/

PlugRepo main screen

Categories: general, grails, plugin Tags:

(Temporarily) pulling the plug on Grails Monitor Plugin

February 22nd, 2008 7 comments

I’m terribly sorry, but I have to (at least temporarily) pull the plug on Monitor Plugin due to possible conflicts with my employer.

In my professional live I’m working on high availability and monitoring software. When I showed the plugin to my employer,
he asked me to suspend any activities regarding the plugin, until they decide whether this conflicts with our products.

I hope I will be able to continue with the monitor plugin, but until this issue is resolved, I have removed both sources and
downloads.

Regards,

Wolfgang

Categories: grails, monitoring, plugin, release Tags:

Grails Monitor plugin 0.1 released

February 20th, 2008 Comments off

Just in time for the upcoming 2008 Groovy/Grails Experience, I released my Grails Monitor plugin in version 0.1 (Apache License).

It’s basically a preview version, but for anybody who was dying to get his or her hands on it, the Grails wiki has all the details on how to install and use the Monitor plugin. For an introduction, see my previous post.

Installation is still a little clumsy as you have to jump through a few hoops because some patches to Grails and the Quartz plugin are needed in order to get the monitor plugin installed and running.

Lots of features are still missing, but for a first version it’s not too bad. I’m open to suggestions, criticism and usability reports. Of course, patches are most welcome 🙂

Happy monitoring,

Wolfgang

Categories: grails, monitoring, plugin, release Tags:

Introducing the Grails Monitor Plugin

February 14th, 2008 13 comments

Grails is a fantastic web framework based on Groovy, which brings the convention-over-configuration paradigm pioneered by Ruby on Rails to the Java world. There is currently a lot of buzz around Grails and so far I had a lot of fun working with the framework.

One aspect of Grails is easy extensibility using plugins. There are already some plugins, which cover a lot of functionality. I have been working on a plugin of my own, a generic monitoring plugin, which will be released shortly under a Apache License.

The monitoring plugin provides pre-defined monitors for many aspects of a web application. Additionally it is really easy to define your own monitors to track usage of application-specific metrics.

The plugin is based around rr4j, which is a Java port of the well-known RRDTool and uses its data storage and graphing engine. It requires the Quartz Plugin (with my patches for GRAILSPLUGINS-190 and GRAILSPLUGINS-213) and Java 1.5 or greater.

So, what does it look like? Some Screenshots (click for bigger image):

The monitor view showing the System group:

The Web group with the Requests graphs:

The Web group with the UserAgent graphs:

So, how do I define a monitor of my own? Following the Grails philosophy of convention over configuration, the monitor plugin defines its own artefact type: Monitor.

Creating an application-specific monitor involves defining a class ending in ‘Monitor’ in the ./grails-app/monitor/ directory and adding some simple elements:


class SessionMonitor implements HttpSessionListener {
def activeSessions = 0L

static monitorName = 'Sessions'
static monitorGroup = 'Web'
static monitorDescription = """The ${monitorName} monitor contains
information regarding active sessions."""

static monitorDefs = {
'activeSessions'( type:'gauge', aggregation:'avg', min:0) {
description = "Number of active sessions"
}
}

static monitorGraphDefs = {
'activeSessions'() {
title = '''Active sessions'''
description = title

// graph sources
source(id:'activeSessions', metric:'activeSessions', aggregation:'average')

// what to draw
area(id:'activeSessions', legend:true)
}
}

void sessionCreated(HttpSessionEvent se) {
activeSessions++
}

void sessionDestroyed(HttpSessionEvent se) {
if (activeSessions > 0) {
activeSessions--
}
}
}

The monitor class specifies a name (monitorName), a group it belongs to (monitorGroup, e.g. ‘Web’, ‘System’, or ‘Application’) and optionally a description (monitorDescription). Two DSLs, one for metrics (monitorDefs), one for graphs (monitorGraphDefs), allow to specify the monitored values and what the graphs should look like. Values are collected periodically (currently every minute) using a Quartz-controlled job.

Details will follow once the plugin is released. It still needs some work for the UI and behind the scenes, but a first version will be available soon.

Roadmap

I have plenty of ideas for additional features and monitors.

Features:

JMX export
XML/JSON/CSV export
Support for non-numeric data (e.g. Java version, OS name, hostname, …)
Possibly storage backends other than RRD4J (e.g. a database)
Notification via EMail when certain thresholds are exceeded
Integration of other graphing solutions, like JFreeChart

Monitors:

Count per Domain object
Requests by controller/action
Database/GORM query stats (using Hibernate statistics)
Special monitors for some databases (MySQL “SHOW STATS”, …)
Security monitor for JSecurity/ACEGI/CAS plugins
Monitor for Quartz jobs (job runs, min/max/avg duration)

Basically, the idea is, that every plugin would provide its own set of monitors for the contributed functionality.

I you have any other idea, advice, or feature requests please feel free to post a comment below.

Categories: grails, monitoring, plugin Tags:
Fork me on GitHub