Project

General

Profile

RedmineUpgrade » History » Version 38

T. Hauptman, 2010-08-13 14:02
Show example mysqldump command so people don't have to search elsewhere...

1 1 Jean-Philippe Lang
h1. Upgrading
2
3 15 Eric Davis
{{>toc}}
4 1 Jean-Philippe Lang
5 15 Eric Davis
h2. Step 1 - Check requirements
6 1 Jean-Philippe Lang
7 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.
8
9
h2. Step 2 - Backup
10
11
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.
12
13
h3. Backing up the files
14
15 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.
16 15 Eric Davis
17
h3. MySQL database
18
19 38 T. Hauptman
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file. For example:
20
<pre>
21
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
22
</pre>
23
24 15 Eric Davis
25
h3. SQLite database
26
27
SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.
28
29
h3. PostgreSQL
30
31
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file.
32
33
h2. Step 3 - Perform the upgrade
34
35 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.
36 15 Eric Davis
37 16 Eric Davis
h3. Option 1 - Downloaded release (tar.gz or zip file)
38 15 Eric Davis
39
1. Uncompress the new program archive in a new directory.
40
41
2. Copy your database settings-file @config/database.yml@ into the new @config@ directory.
42
43 19 Jean-Philippe Lang
3. Copy your email settings-file @config/email.yml@ into the new @config@ directory.
44 15 Eric Davis
45
4. Copy the @RAILS_ROOT/files@ directory content into your new installation.
46
47 1 Jean-Philippe Lang
5. Copy the folders of your installed plugins into new installation directory
48 19 Jean-Philippe Lang
49 29 Jean-Philippe Lang
6. Run the following command from your Redmine root directory:
50
51
  rake config/initializers/session_store.rb
52
53 31 Thanos Kyritsis
If you're using a newer version of Redmine, the above file will no longer exist. On these versions, run
54
55
  rake generate_session_store
56
57 29 Jean-Philippe Lang
This will generate a file (@config/initializers/session_store.rb@) with a random secret used to secure session data.
58 22 Brad Langhorst
59 26 salt racer
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.
60
61 19 Jean-Philippe Lang
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
62 17 Erick Pérez Castellanos
63 16 Eric Davis
h3. Option 2 - Upgrading from a SVN [[CheckingoutRedmine|checkout]]
64 15 Eric Davis
65 2 Jean-Philippe Lang
1. Go to the Redmine root directory and run the following command:
66 1 Jean-Philippe Lang
<pre>
67
svn update
68
</pre>
69
70 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@.
71 15 Eric Davis
72
h2. Step 4 - Update the database
73
74
This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:
75
76 1 Jean-Philippe Lang
<pre>
77 28 rafael mascayano
rake db:migrate RAILS_ENV=production 
78 1 Jean-Philippe Lang
</pre>
79
80 18 Ethan Fremen
If you have installed any plugins, you should also run their database migrations. If you are upgrading to Rails 2.2.2 as part of this migration, you need to upgrade the plugin migrations first:
81
82 1 Jean-Philippe Lang
<pre>
83 28 rafael mascayano
rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
84 18 Ethan Fremen
</pre>
85
86
<pre>
87 28 rafael mascayano
rake db:migrate_plugins RAILS_ENV=production 
88 1 Jean-Philippe Lang
</pre>
89
90 15 Eric Davis
h2. Step 5 - Clean up
91 1 Jean-Philippe Lang
92 15 Eric Davis
1. You should clear the cache and the existing sessions:
93 1 Jean-Philippe Lang
<pre>
94
rake tmp:cache:clear
95 10 Azamat Hackimov
rake tmp:sessions:clear
96 3 Jean-Philippe Lang
</pre>
97 12 Mischa The Evil
98 15 Eric Davis
2. Restart the application server (e.g. mongrel, thin, passenger)
99 12 Mischa The Evil
100 15 Eric Davis
3. Finally go to _"Admin -> Roles & permissions"_ to check/set permissions for the new features, if any.
101 1 Jean-Philippe Lang
102 15 Eric Davis
h2. Common issues
103 10 Azamat Hackimov
104 30 Zach Gardner
h3. Errors with repository management
105
106
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.
107
108 15 Eric Davis
h3. Generating a session_store.rb
109 1 Jean-Philippe Lang
110 15 Eric Davis
An unique @session_store.rb@ file needs to be generated for Redmine for the new cookie based sessions to work.  This is required on the trunk version of Redmine at r2493 or above.  Just run the following command and Redmine will create one for you:
111 10 Azamat Hackimov
<pre>
112
rake config/initializers/session_store.rb
113
</pre>
114
115 33 Cyber Sprocket
_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.5 (see Error about the Rails version below)._ 
116 15 Eric Davis
117
h3. Errors about a missing session_store.rb
118
119
If you see any errors about a missing @session_store.rb@ file, run the command above to create a new one.
120 1 Jean-Philippe Lang
121
h3. Error about the Rails version
122
123 27 Ikawe Saeem
Also remember that the trunk version of Redmine after r2886 uses Rails 2.3.5, so you will need to upgrade your Ruby on Rails gem:
124 15 Eric Davis
<pre>
125 27 Ikawe Saeem
gem install rails -v=2.3.5
126 15 Eric Davis
</pre>
127 33 Cyber Sprocket
128
h3. Error about member_roles
129
130
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:
131
132
@mysql> rename table member_roles to member_roles_saved
133 34 Cyber Sprocket
mysql> rename table groups_users to groups_users_saved
134 33 Cyber Sprocket
@
135 32 Szymon Połom
136 35 Cyber Sprocket
137 32 Szymon Połom
h3. Error about "undefined method `add_frozen_gem_path'"
138
139
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.
140 35 Cyber Sprocket
141
h3. Related Resources 
142
143
These resources may help you with your Redmine upgrade:
144
145
* "mod_fcgid for Apache2":http://httpd.apache.org/mod_fcgid/ helped us get Rails 2.3.5 running on Apache 2
146
* "Running Redmine on Apache":http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine
147
* "Notes about our 8.6 to 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)