Add the plugin to your grails plugins in BuildConfig.groovy
to embed CRaSH into your grails application:
plugins {
...
compile ":crash:1.3.0-beta1-SNAPSHOT"
...
}
It includes the ssh shell and by default listens on port 2000 with the username/password 'admin'. So make sure to change that for production! For general documentation on CRaSH visit the CRaSH project website.
To start up CRaSH, a spring bean named crashSpringWebBootstrap
of type org.crsh.grails.GrailsBootstrap
is defined.
Its config properties can be set by assigning a map of config properties to plugin.crash.config
, e.g.:
plugin.crash.config = [
'crash.ssh.port': 2001,
'crash.auth.simple.password': 'secretPassword'
]
To include telnet support include the following dependency in your own BuildConfig:
runtime 'org.crashub:crash.connectors.telnet:1.3.0-cr7'
The plugin install CRaSH commands in the directory /WEB-INF/crash/commands
of your web application
base
contains base commands such as jdbc
, thread
, jmx
, etc...grails
contains grails commands allowing to interact with the grails runtimeExisting commands or new commands can be done at anytime during runtime.
You can switch to the Groovy repl using the repl command:
% repl groovy
The Groovy Repl is similar to the Groovy Shell but can evaluate commands:
% thread.ls()
You can switch back to the Script repl with the same command but with a Groovy syntax:
% repl("script")
There are a few commands available specifically developed for Grails:
application
managementgrails
managementplugin
managementWithin a command or in the Groovy repl you can access the contextual attributes:
context.attributes.application
is the current GrailsApplication
context.attributes.beans
is a map of Spring beanscontext.attributes.factory
the Spring bean factory