Skip to content

IDE Development Environment

Stephen Joyner edited this page Jul 28, 2020 · 17 revisions

I use IntelliJ IDEA for development, it has pretty good integration with Groovy/Grails. You should also be able to use Eclipse or NetBeans.

Current Grails version used by main: 4.0.3

Install grails

  • You can install it easily using sdkman.

Setup IDEA

  1. Clone rundeck from GitHub.
  2. In IDEA: Import an existing project, select the rundeck git basedir
  3. Choose "Import from external model", and select Gradle
  4. Enable Lombok annotation processing (see below)

At this point, IDEA will load modules for all of the gradle subprojects, and index the sources.

Enable Lombok Annotation Processing

Rundeck uses Lombok for some classes. To enable Lombok processing in IDEA (see this stackoverflow):

  1. In the IDEA Preferences, search for Annotation Processors, and turn on "Enable annotation processing"
  2. In the IDEA Plugins list, search for and install the Lombok plugin
  3. Restart IDEA

Setup testbed

To run in a Debug/development mode, there are a few things you will want to do:

  1. Get the commandline build working smoothly via Gradle. See Building and Testing.

  2. Create a directory to be your testbed for the rundeck server, e.g. $HOME/rundeck-dev.

  3. Use the built launcher to initialize a Rundeck basedir. Copy the launcher to your testbed dir. The launcher will be located under rundeck-launcher/launcher/build/libs within your source directory.

  4. CD to your rundeck-dev dir, and run java -jar rundeck-launcher-x.y.z.jar. Control-c to stop the server.

  5. Modify the file server/config/jaas-loginmodule.conf, and duplicate the RDpropertyfilelogin and rename it to rundecklogin (this step might become unnecessary later).

  6. Modify the file server/config/rundeck-config.properties, to declare the URL context:

     grails.app.context=/
    

Now set up an IDEA Run Configuration.

  1. Choose Run > Edit Configurations

  2. Add a new Grails configuration, rename it to "run-app"

  3. Select rundeck in the Application section

  4. Use the following in the VM Options section: NOTE: Be sure to replace the appropriate value for $BASEDIR since IDEA will not substitute environment variables into the JVM parameters:

     -XX:MaxPermSize=256m -Xmx1024m -Xms256m -server -Drdeck.base=$BASEDIR -Djava.security.auth.login.config=$BASEDIR/server/config/jaas-loginmodule.conf -Drundeck.config.location=$BASEDIR/server/config/rundeck-config.properties -Dserver.port=4440
    

To break this down,

  • $BASEDIR - Replace this with the location of your rundeck basedir for development
  • -Drdeck.base=$BASEDIR - This tells the app what the basedir is.
  • -Djava.security.auth.login.config=$BASEDIR/server/config/jaas-loginmodule.conf - this specifies the JAAS config file for the dev dir
  • -Drundeck.config.location=$BASEDIR/server/config/rundeck-config.properties - this specifies the rundeck config file to use.

As well, you can change the port with these JVM parameters: -Dserver.port=4440.

If you want the app context to be different than /rundeck, you will have to add this to your rundeck-config.properties for it to work:

grails.app.context=/

Here is a minimal rundeck-config.properties file:

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
grails.serverURL=http://myhostname:4440
grails.app.context=/
dataSource.dbCreate = update
dataSource.url = jdbc:h2:file:/path/to/basedir/server/data/grailsdb

Finally, here is the IDEA Grails "Run/Debug" configuration that I use to run/debug the full app with a development basedir of /Users/greg/rundeck:

  • Command line:

    run-app

  • VM Options:

    -XX:MaxPermSize=256m -Xmx1024m -Xms256m -server -Drdeck.base=/Users/greg/rundeck -Djava.security.auth.login.config=/Users/greg/rundeck/server/config/jaas-loginmodule.conf -Drundeck.config.location=/Users/greg/rundeck/server/config/rundeck-config.properties -Dserver.port=4440

Troubleshooting

Resolve error obtaining dependencies

If you get a message like Resolve error obtaining dependencies: The following artifacts could not be resolved: org.rundeck:rundeck-core:jar:2.10.3-SNAPSHOT, org.rundeck:rundeck-storage-filesys:jar:2.10.3-SNAPSHOT: Could not find artifact org.rundeck:rundeck-core:jar:2.10.3-SNAPSHOT in repo1_maven_org_maven2_ (http://repo1.maven.org/maven2/) (Use --stacktrace to see the full trace)

The problem is that the rundeck grails app (rundeckapp) depends on rundeck-core and other Java libraries. Since the SNAPSHOT version is not available via a maven repo, it is failing.

You will need to install those to your local maven repo. Perform the following within your rundeck source dir:

  • ./gradlew -p core install
  • ./gradlew -p rundeck-storage install