You can configure Rundeck to use a RDB instead of the default file-based data storage.
You must modify the server/config/rundeck-config.properties
file, to change the dataSource
configuration, and you will have to add the appropriate JDBC driver JAR file to the lib directory.
For Mysql-specific instructions, jump to: Mysql Setup Guide.
The default dataSource is configured for filesystem storage using HSQLDB:
dataSource.url = jdbc:hsqldb:file:/var/lib/rundeck/data/grailsdb;shutdown=true
Here is an example configuration to use an Oracle backend:
1 2 3 4 5 |
|
Here is an example configuration to use Mysql:
1 2 3 |
|
NB: for Mysql, the autoReconnect=true
will fix a common problem where the Rundeck server's connection to Mysql is dropped after a period of inactivity, resulting in an error message: "Message: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost."
See the Mysql Setup Guide for instructions on creating the rundeck database and granting access.
See more about configuring the Mysql JDBC Connector/J URL.
Rundeck includes a JDBC driver for Mysql and H2. If you are using another database copy the appropriate JDBC driver, such as "ojdbc14.jar" for Oracle into the server lib
dir:
cp ojdbc14.jar $RDECK_BASE/server/lib
This is a simple guide for setting up Mysql for use with Rundeck.
You can "yum install" or "apt-get install" the server, or you can download rpms manually if you like. See mysql linux installation
After install, run the mysql_secure_installation script. This will let prompt you to set the root password for mysql, as well as disable anonymous access.
Now you want to create a database and user access for the Rundeck server.
If it is not running, start mysqld with "service mysqld start"
Use the 'mysql' commandline tool to access the db as the root user:
$ mysql -u root -p
Enter your root password to connect. Once you have the mysql> prompt, enter the following commands to create the rundeck database:
mysql> create database rundeck;
Query OK, 1 row affected (0.00 sec)
Then "grant" access for a new user/password, and specify the hostname the Rundeck server will connect from. if it is the same server, you can use "localhost".
mysql> grant ALL on rundeck.* to 'rundeckuser'@'localhost' identified by 'rundeckpassword';
Query OK, 1 row affected (0.00 sec)
You can then exit the mysql prompt.
Test access (if it's from localhost) by running:
$ mysql -u rundeckuser -p
You can verify you can see the "rundeck" database with:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| rundeck |
+--------------------+
2 rows in set (0.00 sec)
Now you need to configure Rundeck to connect to this DB as described earlier in this document: Customize the Datasource.
Update your rundeck-config.properties
and configure the datasource:
dataSource.url = jdbc:mysql://myserver/rundeck?autoReconnect=true
dataSource.username=rundeckuser
dataSource.password=rundeckpassword
With recent Rundeck version, MySQL connector is already there. You can check if present in this path: $RDECK_BASE/exp/webapp/WEB-INF/lib/
Else: * Download the mysql connector jar. * Copy the mysql-connector-java-5.x.x-bin.jar to $RDECK_BASE/server/lib
(for launcher install) or $WEBAPPS/rundeck/WEB-INF/lib
(for Tomcat).
Finally you can start rundeck. If you see a startup error about database access, make sure that the hostname that the Mysql server sees from the client is the same one you granted access to.
This section describes how to migrate a set of Rundeck projects from the built-in H2 database, to use Mysql.
For each project you want to retain, Export the archive via the GUI:
Note: make sure to click the final link that is presented to download the file.
Save each project archive file (named "[project name]-XXXX.rdproject.jar") in a place you can upload it later.
/var/rundeck/projects
$RDECK_BASE/prjoects
/var/rundeck/data
$RDECK_BASE/server/data
Unix:
sudo service rundeckd stop
Install Mysql according to the instructions for your platform.
Perform this command to log in as root:
mysql -u root -p
Then execute this sql:
> create database rundeckdb
> grant ALL on rundeckdb.* to ‘rundeckuser’@‘localhost’ identified by ‘rundeckpassword’
Set the datasource URL to point to your Mysql host, with appropriate database name, username and password.
Modify the rundeck config file.
/etc/rundeck/rundeck-config.properties
$RDECK_BASE/server/config/rundeck-config.properties
Replace the dataSource.url
entry with these lines:
dataSource.url=jdbc:mysql://mysqlhost/rundeckdb?autoReconnect=true
dataSource.username=rundeckuser
dataSource.password=rundeckpassword
dataSource.driverClassName=com.mysql.jdbc.Driver
Enable DB storage for Project configurations, and Key Storage. Optionally enable encryption.
For more info refer to:
Modify rundeck-config.properties
# Enables DB for Project configuration storage
rundeck.projectsStorageType=db
# Encryption for project config storage
rundeck.config.storage.converter.1.type=jasypt-encryption
rundeck.config.storage.converter.1.path=projects
rundeck.config.storage.converter.1.config.password=mysecret
# Enable DB for Key Storage
rundeck.storage.provider.1.type=db
rundeck.storage.provider.1.path=keys
# Encryption for Key Storage
rundeck.storage.converter.1.type=jasypt-encryption
rundeck.storage.converter.1.path=keys
rundeck.storage.converter.1.config.password=mysecret
Start the Rundeck server again.
Unix:
sudo service rundeckd start
View the "service.log" or "rundeck.log" file for any error messages.
For each project you wish to import, go to the Configure page for the project: