The scripts mentioned in this guide are available in Dradis Pro v1.9 and newer. If you need to export from a pre-v1.9 installation, copy the scripts across to your old installation first.
There are a number of migration scripts that let you export, import and backup all your data easily.
In this guide we cover:
If you're unsure on what OVA version you are in right now, visit your instance's CIC page found on the /setup
page in your browser. You will also see the End Of Support date for the OVA - we support OVAs built on the current and previous versions of Debian.
You can also check the OVA version by running the following in the console:
$ cat /opt/dradispro/ova_version
Note: If your CIC setup page doesn't have a Versions section or the ova_version
file does not exist on your instance, then you are running on an older OVA (< v3.0.0) and it's time to migrate!
Follow the instructions in the Deploying Dradis Pro step by step guide to launch a new instance of Dradis and use your existing license key to activate it when prompted. Yes, you can have >1 instance running with the same license key at the same time for situations just like this!
In some cases, we have found that migration of project templates can fail if the path where they were stored on the original instance was changed in the Admin Settings. To be safe, it's a good idea to back up your project templates using SCP or a similar method before commencing the migration. Additionally, ensure that your project templates path is set to "/opt/dradispro/dradispro/shared/templates/projects/" in the new instance.
Dradis provides a set of scripts to make exporting all your data easily. The export scripts can be used to move your data from an old install to a newer one or to just backup your data.
You can find the scripts referenced in this guide under: /opt/dradispro/bin/
In this guide we'll use [dradispro.old]
to refer to the IP address of the original Dradis instance containing the data you want to export / backup and [dradispro.new]
to refer to the IP address of a new and fresh install where the data will end up being imported.
Run these commands from your local machine (note that each command can be run in a single line, although we're breaking them up in two):
$ ssh dradispro@[dradispro.old] -- 'dp-export-attachments' |\ ssh dradispro@[dradispro.new] -- 'dp-import-attachments' $ ssh dradispro@[dradispro.old] -- 'dp-export-mysql' |\ ssh dradispro@[dradispro.new] -- 'dp-import-mysql' $ ssh dradispro@[dradispro.old] -- 'dp-export-templates' |\ ssh dradispro@[dradispro.new] -- 'dp-import-templates'
From our local machine or laptop we are connecting to [dradispro.old]
running the export script and then piping the result to the import script running in [dradispro.new]
.
After piping, make sure to migrate the database:
Run the following in the command line of [dradispro.new]
as dradispro:
$ cd /opt/dradispro/dradispro/current/ $ RAILS_ENV=production bundle exec rails db:migrate $ god restart dradispro-puma $ god restart dradispro-resque-1
If this is a bit too much magic for you, you can break each of the steps in two: export data and dump into an intermediate file in your laptop and then pipe that file into the new install. For example:
$ ssh dradispro@[dradispro.old] -- 'dp-export-attachments' > dradis-attachments.tar $ cat dradis-attachments.tar | ssh dradispro@[dradispro.new] -- 'dp-import-attachments'
$ ssh dradispro@[dradispro.old] -- 'dp-export-mysql' > dradis-mysql-backup.sql $ cat dradis-mysql-backup.sql | ssh dradispro@[dradispro.new] -- 'dp-import-mysql'
$ ssh dradispro@[dradispro.old] -- 'dp-export-templates' > dradis-templates.tar $ cat dradis-templates.tar | ssh dradispro@[dradispro.new] -- 'dp-import-templates'
Troubleshooting: MySQL Some newer OVAs may generate dradis-mysql-backup.sql
files with a problematic first line that will cause the following error:
ERROR at line 1: Unknown command '\-',
We are looking into a fix, but for now, you can fix it with the following steps:
dradis-mysql-backup.sql
file in your preferred text editor/*M!999999\- enable the sandbox mode */
cat dradis-mysql-backup.sql | ssh dradispro@[dradispro.new] -- 'dp-import-mysql'
command.
Troubleshooting: Cloud deployments Cloud deployments on AWS and Azure can be difficult in terms of loading the shell environment correctly, depending on how the session is started. If the shell environment is not loaded correctly, you may see command not found
errors when running the migration scripts.
One solution is to run source ~/.bashrc
after logging in as the dradispro
user. If you then run the echo $PATH
command you should see:
/opt/dradispro/bin:/opt/dradispro/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Another option is to run the migration scripts with their full paths. Then, for example:
$ cat dradis-attachments.tar | ssh dradispro@[dradispro.new] -- 'dp-import-attachments'
becomes
$ cat dradis-attachments.tar | ssh dradispro@[dradispro.new] -- '/opt/dradispro/bin/dp-import-attachments'
Again, after exporting and importing, make sure to migrate the database:
Run the following in the command line of [dradispro.new]
as dradispro:
$ cd /opt/dradispro/dradispro/current/ $ RAILS_ENV=production bundle exec rails db:migrate $ god restart dradispro-puma $ god restart dradispro-resque-1
If you are migrating from an instance with Dradis Pro version lower (<) than 3.0.0 to an instance with version greater or equal to (>=) 3.0.0, most paths on the app have changed.
This can affect paths to attachments you could have inserted in your issues, notes, evidence, etc...
If that is your case and you want to update those paths, grab this script, scp it in your new instance /tmp folder, and execute it like this:
RAILS_ENV=production bin/rails runner /tmp/update_attachment_paths_to_v3.rb
Add-ons that can be installed via the Integration and Tool Manager can be installed normally, no migration required!
Do you have an add-on like Azure Authentication, LDAP, Okta, SAML, or a custom add-on installed on [dradispro.old]
? You'll want to make sure to migrate those over to your new instance!
Copy the file /opt/dradispro/dradispro/shared/addons/Gemfile.plugins
from [dradispro.old]
to [dradispro.new]
.
Open the file and confirm that you have the latest versions of the gems in that file. The add-on version should match the Dradis version (e.g. Dradis v3.0.0 needs dradispro-ldap-3.0.0.gem)
Need an updated add-on? Contact our support team and we'll get you the files that you need!
In [dradispro.new]
, scp the new gems to the /opt/dradispro/dradispro/shared/addons/cache
directory then update the Gemfile.plugins
file with the right version number of the gems.
Copy subfolders in the /opt/dradispro/dradispro/shared/addons/
folder from [dradispro.old]
to [dradispro.new]
by running the following commands on [dradispro.old]
:
$ cd /opt/dradispro/dradispro/shared/ $ scp -r /opt/dradispro/dradispro/shared/addons/config dradispro@[dradispro.new]:/opt/dradispro/dradispro/shared/addons $ scp -r /opt/dradispro/dradispro/shared/addons/initializers dradispro@[dradispro.new]:/opt/dradispro/dradispro/shared/addons
Symlink the add-on files by running these commands on [dradispro.new]
:
$ ln -s /opt/dradispro/dradispro/shared/addons/Gemfile.plugins /opt/dradispro/dradispro/current $ ln -s /opt/dradispro/dradispro/shared/addons/cache/* /opt/dradispro/dradispro/current/vendor/cache $ ln -s /opt/dradispro/dradispro/shared/addons/config/* /opt/dradispro/dradispro/current/config $ ln -s /opt/dradispro/dradispro/shared/addons/initializers/* /opt/dradispro/dradispro/current/config/initializers
Install the add-ons by running the following commands on [dradispro.new]
:
$ cd /opt/dradispro/dradispro/current/ $ RAILS_ENV=production bundle install --local --without development test $ RAILS_ENV=production bundle exec rails assets:precompile $ RAILS_ENV=production bundle exec rails db:migrate $ god restart dradispro-puma $ god restart dradispro-resque-1
Local changes will be overwritten during the migration. If you made any local changes to [dradispro.old]
, make sure to re-apply them to [dradispro.new]
.
If your users have uploaded custom avatars, you can migrate them to the new instance by simply copying over the image files found in /opt/dradispro/dradispro/shared/avatars
. Run this command on [dradispro.old]
:
$ scp -r /opt/dradispro/dradispro/shared/avatars dradispro@[dradispro.new]:/opt/dradispro/dradispro/shared/
The backup operation is conceptually the same as the export operation described earlier, the only difference is that instead of piping the export scripts to the import scripts in the new VM we just archive the results.
Run these commands from your local machine:
$ ssh dradispro@[dradispro] -- 'dp-export-attachments' > dradis-attachments.tar $ ssh dradispro@[dradispro] -- 'dp-export-mysql' | gzip > dradis-mysql-backup.sql.gz $ ssh dradispro@[dradispro] -- 'dp-export-templates' > dradis-templates.tar
You can script this and combine it with your standard backup software to make sure all your Dradis data is safe.
In addition, you should consider the additional step of encrypting your backups for good measure (something simple like openssl should do the trick):
$ openssl enc -aes-256-cbc -salt -in file.plain -out file.enc
Great job, you reached the end of the guide! Have you read all of them?
Last updated by Christoffer Bjørk Pedersen on 2024-11-21
Your email is kept private. We don't do the spam thing.