RedmineUpgrade » History » Version 68

Toshi MARUYAMA, 2014-02-20 00:36
copy "bundle install" from doc/UPGRADING

1 1 Jean-Philippe Lang
h1. Upgrading
2 1 Jean-Philippe Lang
3 59 Etienne Massip
p{color:red}. The documentation below is based on upgrading to Redmine 2.x.
4 59 Etienne Massip
You can view a previous version for upgrading to Redmine 1.x "here":/projects/redmine/wiki/RedmineUpgrade?version=53.
5 56 Etienne Massip
6 15 Eric Davis
{{>toc}}
7 1 Jean-Philippe Lang
8 15 Eric Davis
h2. Step 1 - Check requirements
9 1 Jean-Philippe Lang
10 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.
11 15 Eric Davis
12 15 Eric Davis
h2. Step 2 - Backup
13 15 Eric Davis
14 15 Eric Davis
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.
15 15 Eric Davis
16 15 Eric Davis
h3. Backing up the files
17 15 Eric Davis
18 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.
19 15 Eric Davis
20 15 Eric Davis
h3. MySQL database
21 15 Eric Davis
22 38 T. Hauptman
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file. For example:
23 38 T. Hauptman
<pre>
24 38 T. Hauptman
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
25 38 T. Hauptman
</pre>
26 38 T. Hauptman
27 15 Eric Davis
28 15 Eric Davis
h3. SQLite database
29 15 Eric Davis
30 15 Eric Davis
SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.
31 15 Eric Davis
32 15 Eric Davis
h3. PostgreSQL
33 15 Eric Davis
34 39 Joshua Drake
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file. Here is an example:
35 39 Joshua Drake
<pre>
36 39 Joshua Drake
/usr/bin/pg_dump -U <username> -Fc --file=redmine.sqlc <redmine_database>
37 39 Joshua Drake
</pre>
38 64 Jean-Philippe Lang
39 15 Eric Davis
40 15 Eric Davis
h2. Step 3 - Perform the upgrade
41 15 Eric Davis
42 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.
43 15 Eric Davis
44 40 Cyber Sprocket
h3. Option 1 - [[Download|Downloaded release]] (tar.gz or zip file)
45 15 Eric Davis
46 15 Eric Davis
1. Uncompress the new program archive in a new directory.
47 15 Eric Davis
48 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`.
49 15 Eric Davis
50 48 Etienne Massip
3a. Copy your base configuration settings-file @config/configuration.yml@ into the new @config@ directory.
51 48 Etienne Massip
52 48 Etienne Massip
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.
53 15 Eric Davis
54 67 Jean-Philippe Lang
4. Copy the @files@ directory content into your new installation (this directory contains all your uploaded files).
55 15 Eric Davis
56 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.
57 19 Jean-Philippe Lang
58 68 Toshi MARUYAMA
6. Install the required gems by running:
59 1 Jean-Philippe Lang
60 68 Toshi MARUYAMA
  bundle install --without development test
61 68 Toshi MARUYAMA
62 68 Toshi MARUYAMA
If ImageMagick is not installed on your system, you should skip the installation
63 68 Toshi MARUYAMA
of the rmagick gem using:
64 68 Toshi MARUYAMA
65 68 Toshi MARUYAMA
     bundle install --without development test rmagick
66 68 Toshi MARUYAMA
67 68 Toshi MARUYAMA
Only the gems that are needed by the adapters you've specified in your database
68 68 Toshi MARUYAMA
configuration file are actually installed (eg. if your config/database.yml
69 68 Toshi MARUYAMA
uses the 'mysql2' adapter, then only the mysql2 gem will be installed). Don't
70 68 Toshi MARUYAMA
forget to re-run `bundle install` when you change config/database.yml for using
71 68 Toshi MARUYAMA
other database adapters.
72 68 Toshi MARUYAMA
73 68 Toshi MARUYAMA
If you need to load some gems that are not required by Redmine core (eg. fcgi),
74 68 Toshi MARUYAMA
you can create a file named Gemfile.local at the root of your redmine directory.
75 68 Toshi MARUYAMA
It will be loaded automatically when running `bundle install`.
76 68 Toshi MARUYAMA
77 68 Toshi MARUYAMA
7. Run the following command from your new Redmine root directory:
78 68 Toshi MARUYAMA
79 31 Thanos Kyritsis
 rake generate_secret_token
80 63 Etienne Massip
81 1 Jean-Philippe Lang
This will generate a file (@config/initializers/secret_token.rb@) with a random secret used to secure session data.
82 22 Brad Langhorst
83 68 Toshi MARUYAMA
8. 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.
84 26 salt racer
85 19 Jean-Philippe Lang
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
86 17 Erick Pérez Castellanos
87 65 Jean-Philippe Lang
h3. Option 2 - Upgrading from a SVN checkout
88 15 Eric Davis
89 2 Jean-Philippe Lang
1. Go to the Redmine root directory and run the following command:
90 1 Jean-Philippe Lang
<pre>
91 1 Jean-Philippe Lang
svn update
92 1 Jean-Philippe Lang
</pre>
93 1 Jean-Philippe Lang
94 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@.
95 15 Eric Davis
96 15 Eric Davis
h2. Step 4 - Update the database
97 15 Eric Davis
98 15 Eric Davis
This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:
99 15 Eric Davis
100 1 Jean-Philippe Lang
<pre>
101 28 rafael mascayano
rake db:migrate RAILS_ENV=production 
102 1 Jean-Philippe Lang
</pre>
103 1 Jean-Philippe Lang
104 55 Etienne Massip
If you have installed any plugins, you should also run their database migrations:
105 18 Ethan Fremen
106 18 Ethan Fremen
<pre>
107 60 Etienne Massip
rake redmine:plugins:migrate RAILS_ENV=production 
108 1 Jean-Philippe Lang
</pre>
109 1 Jean-Philippe Lang
110 15 Eric Davis
h2. Step 5 - Clean up
111 1 Jean-Philippe Lang
112 15 Eric Davis
1. You should clear the cache and the existing sessions:
113 1 Jean-Philippe Lang
<pre>
114 1 Jean-Philippe Lang
rake tmp:cache:clear
115 10 Azamat Hackimov
rake tmp:sessions:clear
116 3 Jean-Philippe Lang
</pre>
117 12 Mischa The Evil
118 62 Etienne Massip
2. Restart the application server (e.g. puma, thin, passenger)
119 12 Mischa The Evil
120 15 Eric Davis
3. Finally go to _"Admin -> Roles & permissions"_ to check/set permissions for the new features, if any.
121 1 Jean-Philippe Lang
122 15 Eric Davis
h2. Common issues
123 10 Azamat Hackimov
124 30 Zach Gardner
h3. Errors with repository management
125 30 Zach Gardner
126 30 Zach Gardner
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.
127 30 Zach Gardner
128 58 Etienne Massip
h3. Generating a new @secret_token.rb@
129 1 Jean-Philippe Lang
130 58 Etienne Massip
Before version:2.0.0, a @session_store.rb@ file needed to be generated in Redmine's @config@ directory for the cookie based sessions to work.
131 1 Jean-Philippe Lang
132 58 Etienne Massip
Starting from version:2.0.0, the @session_store.rb@ file should not exist. Instead, the following command will generate the @secret_token.rb@ file:
133 52 Etienne Massip
134 52 Etienne Massip
 @rake generate_secret_token@
135 52 Etienne Massip
136 58 Etienne Massip
_Note: The code repository for Redmine does not contain the config/initializers/secret_token.rb file, it is created by the above rake command._
137 15 Eric Davis
138 33 Cyber Sprocket
h3. Error about member_roles
139 33 Cyber Sprocket
140 33 Cyber Sprocket
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:
141 33 Cyber Sprocket
142 33 Cyber Sprocket
@mysql> rename table member_roles to member_roles_saved
143 34 Cyber Sprocket
mysql> rename table groups_users to groups_users_saved
144 33 Cyber Sprocket
@
145 32 Szymon Połom
146 35 Cyber Sprocket
147 32 Szymon Połom
h3. Error about "undefined method `add_frozen_gem_path'"
148 32 Szymon Połom
149 32 Szymon Połom
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.
150 35 Cyber Sprocket
151 35 Cyber Sprocket
h3. Related Resources 
152 35 Cyber Sprocket
153 35 Cyber Sprocket
These resources may help you with your Redmine upgrade:
154 35 Cyber Sprocket
155 66 Jean-Philippe Lang
* Error while browsing the wiki history after upgrading from Redmine 1.x with SQLite: see #12501
156 45 Jean-Philippe Lang
* "mod_fcgid for Apache2":http://httpd.apache.org/mod_fcgid/ helped us get Rails running on Apache 2
157 35 Cyber Sprocket
* "Running Redmine on Apache":http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine
158 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)
159 41 Cyber Sprocket
* "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)