Project

General

Profile

RedmineUpgrade » History » Version 56

Etienne Massip, 2012-05-29 19:50
Statement about the target Redmine version

1 1 Jean-Philippe Lang
h1. Upgrading
2
3 56 Etienne Massip
The documentation below is based on Redmine 2.x. You can view a previous version for Redmine 1.x "here":/projects/redmine/wiki/RedmineUpgrade?version=53.
4
5 15 Eric Davis
{{>toc}}
6 1 Jean-Philippe Lang
7 15 Eric Davis
h2. Step 1 - Check requirements
8 1 Jean-Philippe Lang
9 15 Eric Davis
The first step to upgrading Redmine is to check that you meet the [[RedmineInstall#Requirements|requirements]] for the version you're about to install.
10
11
h2. Step 2 - Backup
12
13
It is recommended that you backup your database and file uploads.  Most upgrades are safe but it never hurts to have a backup just in case.
14
15
h3. Backing up the files
16
17 37 Ed Ruder
All file uploads are stored to the @files/@ directory.  You can copy the contents of this directory to another location to easily back it up.
18 15 Eric Davis
19
h3. MySQL database
20
21 38 T. Hauptman
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file. For example:
22
<pre>
23
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
24
</pre>
25
26 15 Eric Davis
27
h3. SQLite database
28
29
SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.
30
31
h3. PostgreSQL
32
33 39 Anonymous
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file. Here is an example:
34
<pre>
35
/usr/bin/pg_dump -U <username> -Fc --file=redmine.sqlc <redmine_database>
36
</pre>
37
A decent blog (self plug) can be found here: http://www.commandprompt.com/blogs/joshua_drake/2010/07/a_better_backup_with_postgresql_using_pg_dump/
38 15 Eric Davis
39
h2. Step 3 - Perform the upgrade
40
41 36 digi byte
Now it's time to perform the actual upgrade.  This process is different depending on how you downloaded Redmine.  You only need to perform *one* of the following options.
42 15 Eric Davis
43 40 Cyber Sprocket
h3. Option 1 - [[Download|Downloaded release]] (tar.gz or zip file)
44 15 Eric Davis
45
1. Uncompress the new program archive in a new directory.
46
47 51 Jean-Philippe Lang
2. 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`.
48 15 Eric Davis
49 48 Etienne Massip
3a. Copy your base configuration settings-file @config/configuration.yml@ into the new @config@ directory.
50
51
3b. Or, *if upgrading from version older than 1.2.0*, copy your email settings from your @config/email.yml@ into the new @config/configuration.yml@ file that can be created by copying the available @configuration.yml.example@ file.
52 15 Eric Davis
53 46 Etienne Massip
4. Copy the @files@ directory content into your new installation.
54 15 Eric Davis
55 54 Etienne Massip
5. Copy the folders of your *custom* installed plugins from your @vendor/plugins@ directory (if upgrading from a version prior to version:2.0.0) or @plugins@ directory (else, upgrading from a version >= version:2.0.0) into new installation @plugins@ directory. Make sure that you copy only plugins that are were not initially bundled with your previous Redmine setup.
56 19 Jean-Philippe Lang
57 46 Etienne Massip
6. Run the following command from your new Redmine root directory:
58 29 Jean-Philippe Lang
59
  rake config/initializers/session_store.rb
60
61 31 Thanos Kyritsis
If you're using a newer version of Redmine, the above file will no longer exist. On these versions, run
62
63
  rake generate_session_store
64
65 29 Jean-Philippe Lang
This will generate a file (@config/initializers/session_store.rb@) with a random secret used to secure session data.
66 22 Brad Langhorst
67 46 Etienne Massip
7. Check for any themes that you may have installed in the @public/themes@ directory. You can copy them over but checking for updated version is ideal.
68 26 salt racer
69 19 Jean-Philippe Lang
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
70 17 Erick Pérez Castellanos
71 16 Eric Davis
h3. Option 2 - Upgrading from a SVN [[CheckingoutRedmine|checkout]]
72 15 Eric Davis
73 2 Jean-Philippe Lang
1. Go to the Redmine root directory and run the following command:
74 1 Jean-Philippe Lang
<pre>
75
svn update
76
</pre>
77
78 25 Mischa The Evil
2. If you are upgrading from an older version to 0.8.7+ or from the trunk version of Redmine to r2493 or above, you must generate a secret for cookie store.  See the note at the bottom about generating a @session_store@.
79 15 Eric Davis
80
h2. Step 4 - Update the database
81
82
This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:
83
84 1 Jean-Philippe Lang
<pre>
85 28 rafael mascayano
rake db:migrate RAILS_ENV=production 
86 1 Jean-Philippe Lang
</pre>
87
88 55 Etienne Massip
If you have installed any plugins, you should also run their database migrations:
89 18 Ethan Fremen
90
<pre>
91 55 Etienne Massip
rake db:plugins:migrate RAILS_ENV=production 
92 1 Jean-Philippe Lang
</pre>
93
94 15 Eric Davis
h2. Step 5 - Clean up
95 1 Jean-Philippe Lang
96 15 Eric Davis
1. You should clear the cache and the existing sessions:
97 1 Jean-Philippe Lang
<pre>
98
rake tmp:cache:clear
99 10 Azamat Hackimov
rake tmp:sessions:clear
100 3 Jean-Philippe Lang
</pre>
101 12 Mischa The Evil
102 15 Eric Davis
2. Restart the application server (e.g. mongrel, thin, passenger)
103 12 Mischa The Evil
104 15 Eric Davis
3. Finally go to _"Admin -> Roles & permissions"_ to check/set permissions for the new features, if any.
105 1 Jean-Philippe Lang
106 15 Eric Davis
h2. Common issues
107 10 Azamat Hackimov
108 30 Zach Gardner
h3. Errors with repository management
109
110
There were several new features added to the reposman.rb file, make sure you have a group specified if you're having issues ( --group=groupnamehere).  Also, make sure you follow the instructions [[Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl|here]] again if you only copied your Redmine.pm, and update your Apache configuration as the recommended configuration has changed.
111
112 53 Etienne Massip
h3. Generating a new @session_store.rb@ / @secret_token.rb@
113 1 Jean-Philippe Lang
114 52 Etienne Massip
Before version:2.0.0, an @session_store.rb@ file needs to be generated in Redmine's @config@ directory for the cookie based sessions to work. Just run the following command and Redmine will create one for you:
115 1 Jean-Philippe Lang
116 52 Etienne Massip
 @rake generate_session_store@
117
118
Starting from version:2.0.0, it has been replaced by the following command that will generate the @secret_token.rb@ file:
119
120
 @rake generate_secret_token@
121
122
_Note: The code repository for Redmine does not contain the config/initializers/session_store.rb file, it is created by the above rake command.  If the above command does not work, make sure you are running Ruby 1.8.7 and have Rails 2.3.x(see Error about the Rails version below)._
123 15 Eric Davis
124
h3. Errors about a missing session_store.rb
125
126
If you see any errors about a missing @session_store.rb@ file, run the command above to create a new one.
127 1 Jean-Philippe Lang
128
h3. Error about the Rails version
129
130 50 Etienne Massip
Remember to install the Ruby on Rails gem version required by the new Redmine version (1.2.x uses Rails 2.3.11, 1.3.x uses 2.3.14 etc.).
131
132
You might need to upgrade your Ruby on Rails gem, e.g.:
133 15 Eric Davis
<pre>
134 49 Etienne Massip
gem install rails -v=2.3.14
135 15 Eric Davis
</pre>
136 33 Cyber Sprocket
137
h3. Error about member_roles
138
139
If you have had a failed upgrade/migration in the past then you may have a member_roles and/or group_users table already created.  The db migration noted above will fail.  Simply rename the tables by logging into MySQL command line and executing the rename table command:
140
141
@mysql> rename table member_roles to member_roles_saved
142 34 Cyber Sprocket
mysql> rename table groups_users to groups_users_saved
143 33 Cyber Sprocket
@
144 32 Szymon Połom
145 35 Cyber Sprocket
146 32 Szymon Połom
h3. Error about "undefined method `add_frozen_gem_path'"
147
148
If you see this error, check if the directory @vendor/rails@ exists and remove or rename it if it does, it might have an old RoR version.
149 35 Cyber Sprocket
150
h3. Related Resources 
151
152
These resources may help you with your Redmine upgrade:
153
154 45 Jean-Philippe Lang
* "mod_fcgid for Apache2":http://httpd.apache.org/mod_fcgid/ helped us get Rails running on Apache 2
155 35 Cyber Sprocket
* "Running Redmine on Apache":http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine
156 41 Cyber Sprocket
* "Notes about our 0.8.6 to 0.9.3 upgrade issues and how to resolve them":http://www.cybersprocket.com/2010/project-management/upgrading-redmine-from-8-6-to-9-3/ --cybersprocket (2010-04-25)
157
* "Notes about our 0.9.6 to 1.0(RC) upgrade process":http://www.cybersprocket.com/2010/tips-tricks/upgrading-redmine-from-0-9-6-to-1-0-0/ --cybersprocket (2010-08-14)