When updating Rundeck from version 4.17 to 5.0, the database has to be migrated from v2 to v3.
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-v2-$(date +%F).tar /var/lib/rundeck/data
There's a script that can be utilized to migrate the db from v2 to v3 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 ~]# sh migration.sh -f /var/lib/rundeck/data/rundeckdb -u 'sa' -p '' -s v2 -d v3
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/v3/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;NON_KEYWORDS=MONTH,HOUR,MINUTE,YEAR,SECONDS
++ datasource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;NON_KEYWORDS=MONTH,HOUR,MINUTE,YEAR,SECONDS;DB_CLOSE_ON_EXIT=FALSE
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