Local upgrade and remote migration upgrade of redmine

Source: Internet
Author: User
Tags imagemagick redmine

Recently, the Director gave me a task asking me to migrate the redmine version 1.2.1 to another server and upgrade it to the latest version 2.3.1 redmine. If you have this requirement, you can view the document online. I am reading the document at http://www.redmine.org/projects/redmine/wiki/redmineupgrade.

At that time, I thought it was about migration. I didn't expect it to be successful for a whole day. I found various errors, solved various problems, and encountered another problem, in general, it never succeeded, so I decided to listen to the song for 30 minutes and try again. Finally, after I carefully read this article, I found that this article is about upgrading redmine locally, rather than wasting my day for Migration ), finally, I found a migration method based on my experience and have successfully solved this problem. I will share my experience and hope to help you.

This document consists of two parts: local version update and remote migration version update.

It is upgraded from 1.2.1 to 2.3.1 around redmine.

The system environment is centos 5.6.

1.2.1 redmine uses ruby 1.8.5.

2.3.1 redmine uses ruby 1.9.3.

Remember to update ruby at a time when updating the version, and the version is 1.9.x.

I. Local version updates

1. Backup database and redmine data are stored in the database. Therefore, the first step of version update is to back up the current database. This step mainly prevents upgrade problems and timely data recovery, be careful)

I used mysqldump. I once consulted the dba of my company. He said that if the ibdata log of a general database uses a shared tablespace with a size greater than 20 GB, he uses xtrabackup for backup and recovery, if it is smaller than mysqldump, mysqldump is used. I tried it according to his method. It is indeed faster and more convenient to use mysqldump for backup and recovery during redmine backup.

The command used is mysqldump-u username-p password-database Name>/tmp/redmine. SQL

Use this command to back up the full database of the redmine database to the redmine. SQL IN THE tmp directory.

2. download the latest version and decompress it.

wget http://rubyforge.org/frs/download.php/76933/redmine-2.3.1.tar.gztar zxf redmine-2.3.1.tar.gzmv redmine-2.3.1 redmine

3. Modify the Database Configuration File

cd redminecp config/database.yml.example config/database.ymlvim config/database.yml

Modify the redmine Database Name, user name, and password in mysql2.

Requirements on the official website in this step

Copy your database settings-file config/database.yml into the new config directory. If you're running Redmine >= 1.4 with mysql and ruby1.9, change the database adapter to `mysql2`.

However, if you use mysql, follow the instructions on the official website to proceed to the next step.

rake generate_secret_token

Pg_config cannot be found. If you want to install postgresql, you do not need to follow the instructions on the official website to rename the Database Configuration template in the latest redmine version and modify the database information.

4. From the old version of redmineconfig/configuration.ymlCopy to the config directory of the new version.

5. Copy all files in the old version to files in the new version, including all your last files, so make sure to copy the files );

6. generate random key files to encrypt session data

rake generate_secret_token

After completion, you can see the secret_token.rb file in config/initializers /.

7. Use rake db: migrate RAILS_ENV = production to update your database. Otherwise, when you run the new version of redmine to use the old version of database and data, an error is reported when you open the settings interface;

If you have run some plug-ins and want to run their data running programs, you need to use the following command

rake redmine:plugins:migrate RAILS_ENV=production

8. Storage and session updates

rake tmp:cache:clearrake tmp:sessions:clear

9. After the version is updated, run redmine.

Now you have completed the redmine version update locally.

Ii. Remote migration version updates

Follow the steps 1-5 in the first part of "update the local redmine version", and then follow the steps below

1. Create a database and authorize a user

CREATE DATABASE redmine CHARACTER SET utf8;CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

2. import data from the old redmine database to the new redmine Database

Use mysqldump-u username-p password </tmp/redmine. SQL

3. Install Dependencies

gem install bundlerbundle install --without development test

Also note thatRmagick, which features allows the use of ImageMagick to manipulate images for PDF and PNG export

If not, usebundle install --without development test rmagickInstall

If

Can't install RMagick 2.13.2. Can't find Magick-config in /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/apache/bin:/root/bin

Use the following methods to solve the problem:

yum install ImageMagick-devel

If you meet

Package MagickCore was not found in the pkg-config search path.Perhaps you should add the directory containing `MagickCore.pc'to the PKG_CONFIG_PATH environment variableNo package 'MagickCore' found

Use the following methods

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig gem install rmagick

Then, follow the steps 6-9 in the first part of "local version Update" to complete the remote migration version update redmine.

Note: In the latest version of redmine 2.3.1, if you want to run redmine in the background, you can use

ruby script/rails server webrick -e production –d
However, when you log on to the web, you will find that it takes about 5-8 seconds to open a program, and the access speed is very slow. This problem is mainly because webrick uses the webrick server as the default startup command, webrick is a single process and single thread. It can only process one request at a time. When a request is blocked, it is queued. Therefore, we recommend that you use nginx + Passenger or Mongrel. I will use Mongrel to introduce Mongrel first.
Mongrel is a quick Http server for Ruby, which is specially generated for deploying and releasing the ROR application. Compared with Rails's pure Ruby server Webrick, Mongrel is much faster and supports concurrent access. It is expected to become Ruby's Tomcat. The reason is that the default Remine server webrick needs to parse the host name of the target address.
Now we will introduce how to implement it.

gem install mongrel

If you encounter
ERROR: Error installing mongrel:ERROR: Failed to build gem native extension.
 

Mongrel 1.1.5 is incompatible with Ruby 1.9.x. You can install another version

 
gem install mongrel --pre
 

The installation is complete, but mongrel is not a redmine dependent file. It is not loaded by default when redmine is started. Therefore, add the configuration file. As follows:

Create a fileGemfile. localThe file content is as follows:

 
# Gemfile.localgem "mongrel"
 

Put this file in the root directory of redmine

 
ruby script/rails server mongrel -e production –d
 

In this way, the speed increases significantly when accessing your redmine interface.

This article is from the "Yin-Technical Exchange" blog, please be sure to keep this source http://dl528888.blog.51cto.com/2382721/1228105

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.