When updating Rundeck from version 4.0 to 4.1(+), the database has to be migrated from v1 to v2 because the service won't start otherwise. So here's a quick how-to:
First, stop the rundeck service and create a backup:
[root@rundeck ~]# systemctl stop rundeckd.service
[root@rundeck ~]# mkdir -p /var/backup/rundeck
[root@rundeck ~]# tar -cvpf /var/backup/rundeck/rundeck-db-v1-$(date +%F).tar /var/lib/rundeck/data
There's a script that can be utilized to migrate the db from v1 to v2 so let's clone that:
[root@rundeck ~]# git clone https://github.com/rundeck-plugins/h2-v2-migration.git
Now run the migration script against the current database. Ensure that you have a backup so you can rollback if things go haywire:
[root@rundeck ~]# cd h2-v2-migration
[root@rundeck ~]# /usr/bin/sh migration.sh -f /var/lib/rundeck/data/rundeckdb -u 'sa' -p
Once that migration is done, the script will create an './output' directory where the db files are stored. You can go ahead and copy them to the appropriate place and make sure the owner is set to your rundeck service user. In my case, it's 'rundeck':
[root@rundeck ~]# org=myorganization
[root@rundeck ~]# cp -v output/v2/data/grailsdb.${org}.db /var/lib/rundeck/data/rundeckdb.${org}.db
[root@rundeck ~]# chown -R rundeck.rundeck /var/lib/rundeck/
With the config files in place, you'll have to modify the rundeck-config.properties to include 'NON_KEYWORDS=MONTH,HOUR,MINUTE,YEAR,SECONDS' in your datasource url:
[root@rundeck ~]# vim /etc/rundeck/rundeck-config.properties
-- datasource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb
++ datasource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;NON_KEYWORDS=MONTH,HOUR,MINUTE,YEAR,SECONDS
The migration should be done, you can go ahead and start the 'rundeckd' service:
[root@rundeck ~]# systemctl start rundeckd.service
Check the logs for any errors, in my case, there were none so the migration is done.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment