-
Notifications
You must be signed in to change notification settings - Fork 922
IDE Development Environment
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 master: 3.3.8
- You can install it easily using sdkman.
- Clone rundeck from GitHub.
- In IDEA: Import an existing project, select the rundeck git basedir
- Choose "Import from external model", and select Gradle
- Enable Lombok annotation processing (see below)
At this point, IDEA will load modules for all of the gradle subprojects, and index the sources.
Rundeck uses Lombok for some classes. To enable Lombok processing in IDEA (see this stackoverflow):
- In the IDEA Preferences, search for Annotation Processors, and turn on "Enable annotation processing"
- In the IDEA Plugins list, search for and install the Lombok plugin
- Restart IDEA
To run in a Debug/development mode, there are a few things you will want to do:
-
Get the commandline build working smoothly via Gradle. See Building and Testing.
-
Create a directory to be your testbed for the rundeck server, e.g.
$HOME/rundeck-dev
. -
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. -
CD to your rundeck-dev dir, and run
java -jar rundeck-launcher-x.y.z.jar
. Control-c to stop the server. -
Modify the file
server/config/jaas-loginmodule.conf
, and duplicate theRDpropertyfilelogin
and rename it torundecklogin
(this step might become unnecessary later). -
Modify the file
server/config/rundeck-config.properties
, to declare the URL context:grails.app.context=/
Now set up an IDEA Run Configuration.
-
Choose Run > Edit Configurations
-
Add a new Grails configuration, rename it to "run-app"
-
Select
rundeck
in the Application section -
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
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