Tuesday, February 28, 2017

Updating Bitnami Redmine

Image result for bitnami redmine
Recently just went through upgrading Bitnami Redmine (1.0.2 to 3.3.2). Following are the steps for my own record, and hopefully might be helpful for others as well. :

Information 


  • installation directory is /opt/bitnami.
  •  main folders that you can find inside 'apps/redmine' are the following:
• conf: folder that includes the apache configuration files for redmine
• htdocs: this folder includes the redmine files (Gemfile and Rakefile files, redmine configuration files, plugins folder, gems, etc).

  • The location of the redmine configuration files (database configuration, email settings, etc) is the 'apps/redmine/htdocs/config' folder.



Upgrading Process


1. Backup existing redmine DB

mysqldump -u root -p bitnami_redmine > /home/bitnami/wordpress_backup.sql

2. Copy the database backup to the new Bitnami version server. using "WinSCP"

3. Stop all services and restart MySQL service
sudo /opt/bitnami/ctlscript.sh stop
sudo /opt/bitnami/ctlscript.sh start mysql
3a. if you found that u unable to login to the root account, youmay need to carry out the following steps to reset the MySQL root's password:

  • Create a file in /home/bitnami/mysql-init with the content shown below (replace NEW_PASSWORD with the password you wish to use):
  •  UPDATE mysql.user SET Password=PASSWORD('NEW_PASSWORD') WHERE User='root';
     FLUSH PRIVILEGES;
  • If you are using MySQL 5.7 only, use the following content instead of that shown above:
  •  UPDATE mysql.user SET authentication_string=PASSWORD('NEW_PASSWORD') WHERE User='root';
     FLUSH PRIVILEGES;
  • Stop the MySQL server:
  • sudo /opt/bitnami/ctlscript.sh stop mysql
  • Start MySQL with the following command:
  • sudo /opt/bitnami/mysql/bin/mysqld_safe --pid-file=/opt/bitnami/mysql/data/mysqld.pid --datadir=/opt/bitnami/mysql/data --init-file=/home/bitnami/mysql-init 2> /dev/null &
  • Restart the MySQL Server 
  • sudo /opt/bitnami/ctlscript.sh restart mysql
  • Remove the Script
  • rm /home/bitnami/mysql-init
    

4. Login to MySQL and rebuild the DB
 mysql -u root -p 
mysql> drop database bitnami_redmine;
mysql> create database bitnami_redmine;
mysql> grant all privileges on bitnami_redmine.* to 'bitnami_redmine'@'localhost' identified by 'DATABASE_PASSWORD';
mysql -u root -p bitnami_redmine < backup.sql
5. Edit the Redmine configuration file to update the database user password (the same that you set previously) "/opt/bitnami/apps/redmine/htdocs/config/database.yml"

6. Migrate the database to the latest version:
cd /opt/bitnami/apps/redmine/htdocs 
ruby bin/rake db:migrate RAILS_ENV=production
7. Copy the ""/opt/bitnami/apps/redmine/htdocs/files" folder from the old installation to the new one. 

8. Copy the folders from "vendor/plugins" directory into new installation directory, in "plugins" folder.

9. Check the plugins also support this new version and run the following command
ruby bin/rake redmine:plugins RAILS_ENV="production"
10. clean the cache and the sessions, then you are free to restart the services :
ruby bin/rake tmp:cache:clear
ruby bin/rake tmp:sessions:clear
 sudo /opt/bitnami/ctlscript.sh restart