It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.
Upgrade Redmine and all stack components (recommended)
You can upgrade the application and the stack components by following the steps below:
- Launch a new Redmine server.
- Copy the database backup to the new server.
Stop all servers and start only MySQL.
$ sudo /opt/bitnami/ctlscript.sh stop apache $ sudo /opt/bitnami/ctlscript.sh stop mysql $ sudo /opt/bitnami/ctlscript.sh start mysql
Remove the previous database and create the new one. You can configure the database user password with a secure password. Remember to add the -h option to specify the hostname if your database is hosted on a different server.
$ mysql -u root -p Password: **** mysql> drop database bitnami_redmine; mysql> create database bitnami_redmine; mysql> grant all privileges on bitnami_redmine.* to 'bn_redmine'@'localhost' identified by 'DATABASE_PASSWORD';
Restore the new database:
$ mysql -u root -p bitnami_redmine < backup.sql
Edit the Redmine configuration file to update the database user password (the same that you set previously) at /opt/bitnami/apps/redmine/htdocs/config/database.yml.
production: adapter: mysql2 database: bitnami_redmine host: localhost username: bn_redmine password: "DATABASE_PASSWORD" encoding: utf8
Migrate the database to the latest version:
$ cd /opt/bitnami/apps/redmine/htdocs/ $ ruby bin/rake db:migrate RAILS_ENV=production
If you see the following error, go to your database and remove the specified table and run the migration command again.
Mysql::Error: Table 'changeset_parents' already exists: CREATE TABLE `changeset_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE=InnoDB
Run these commands:
$ mysql -u root -p mysql> use bitnami_redmine; mysql> drop table changeset_parents; $ cd /opt/bitnami/apps/redmine/htdocs/ $ ruby bin/rake db:migrate RAILS_ENV=production
Then, copy the /opt/bitnami/apps/redmine/htdocs/files directory from the old installation to the new one. If you have installed plugins in the previous version, copy the directories from the vendor/plugins directory into the new installation area, in the plugins directory. Check that the plugins are compatible with the new version and run the following command:
$ ruby bin/rake redmine:plugins RAILS_ENV="production"
Clean the cache and the sessions.
$ ruby bin/rake tmp:cache:clear $ ruby bin/rake tmp:sessions:clear
Restart the servers.
$ sudo /opt/bitnami/ctlscript.sh restart
If you upgrade from a 1.x version and you see something similar to this error:
MysqlStatement::Error Value for field `value` cannot be NULL INSERT INTO custom_value ...
Go to your custom values in the admin panel, edit and save them again to fix the issue.