azureredmine

Upgrade Redmine

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

It is strongly recommended that you create a full 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

The recommended way to upgrade Redmine is to migrate all the data to a fresh Bitnami installation, which runs the updated version of Redmine.

On the original Redmine server, follow the steps below:

  • Create a temporary folder for the backup:

      $ mkdir /tmp/redmine-backup
    
  • Create a database backup file named bitnami_redmine.sql in the temporary backup folder:

      $ mysqldump -u root -p --databases bitnami_redmine --add-drop-database > /tmp/redmine-backup/bitnami_redmine.sql
    
  • Navigate to the Redmine installation directory. Depending on your installation type, execute the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/redmine
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/redmine/htdocs/
      
  • Compress Redmine application and plugin files from the files directory into the temporary backup folder:

      $ tar czf /tmp/redmine-backup/redmine_files.tar.gz files
      $ tar czf /tmp/redmine-backup/redmine_plugins.tar.gz plugins
    

Launch a new Redmine server and follow the steps below:

  • Stop Apache:

      $ sudo /opt/bitnami/ctlscript.sh stop apache
    
  • Upload the file redmine_files.tar.gz to the new server.

  • Restore the database backup:

      $ mysql -u root -p < bitnami_redmine.sql
    
  • Navigate to the Redmine installation directory. Depending on your installation type, execute the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/redmine
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/redmine/htdocs/
      
  • Copy the Redmine application files to the files directory, by copying redmine_files.tar.gz to the new instance and extracting its contents:

      $ sudo tar xzf redmine_files.tar.gz
    
  • Temporarily give full write permissions to the Redmine log file:

      $ sudo chmod 666 log/production.log
    
  • Migrate the database to the latest version:

      $ bundle exec rake db:migrate RAILS_ENV=production
    
  • (Optional) If you had installed plugins in your previous installation, follow these steps:

  • Check that the plugins are compatible with the new version.

  • Copy the Redmine plugin files to the plugins directory, by copying redmine_plugins.tar.gz to the new instance and extracting it:

         $ sudo tar xzf redmine_plugins.tar.gz
    
  • Install the plugins:

         $ bundle exec rake redmine:plugins RAILS_ENV=production
    
  • Clean the cache:

      $ bundle exec rake tmp:clear
    
  • Revert the permissions of the Redmine log file:

      $ sudo chmod 644 log/production.log
    
  • Start Apache:

      $ sudo /opt/bitnami/ctlscript.sh start apache
    

Troubleshooting upgrades

  • 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
    

    First, navigate to the Redmine installation directory. Depending on your installation type, execute the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/redmine
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/redmine/htdocs/
      

    Then, run these commands:

      $ mysql -u root -p
      mysql> use bitnami_redmine;
      mysql> drop table changeset_parents;
    
      $ bundle exec rake db:migrate RAILS_ENV=production
    
Last modification August 31, 2021