Project

General

Profile

RedmineUpgrade » History » Version 70

Jean-Philippe Lang, 2014-11-11 22:07
Cleanup

1 1 Jean-Philippe Lang
h1. Upgrading
2
3 70 Jean-Philippe Lang
The documentation below is based on upgrading to Redmine 2.x and higher. You can view a previous version for upgrading to Redmine 1.x "here":/projects/redmine/wiki/RedmineUpgrade?version=53.
4 56 Etienne Massip
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 64 Jean-Philippe Lang
38 15 Eric Davis
39
h2. Step 3 - Perform the upgrade
40
41 1 Jean-Philippe Lang
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
43 70 Jean-Philippe Lang
h3. Option 1 - Download a stable release
44 15 Eric Davis
45 70 Jean-Philippe Lang
1. [[Download]] the release in either tar.gz or zip format and uncompress the new program archive in a new directory.
46 15 Eric Davis
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 1 Jean-Philippe Lang
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 67 Jean-Philippe Lang
4. Copy the @files@ directory content into your new installation (this directory contains all your uploaded files).
54 15 Eric Davis
55 70 Jean-Philippe Lang
5. Copy the folders of your *custom* plugins from your @plugins@ directory (or @vendor/plugins@ directory if upgrading from a 1.x version) into new installation @plugins@ directory. Make sure that you copy only plugins that are were not initially bundled with your previous Redmine setup.
56 1 Jean-Philippe Lang
57 68 Toshi MARUYAMA
6. Install the required gems by running:
58 1 Jean-Philippe Lang
59 68 Toshi MARUYAMA
  bundle install --without development test
60
61 70 Jean-Philippe Lang
If ImageMagick is not installed on your system, you should skip the installation of the rmagick gem using:
62 68 Toshi MARUYAMA
63 70 Jean-Philippe Lang
  bundle install --without development test rmagick
64 68 Toshi MARUYAMA
65 70 Jean-Philippe Lang
Only the gems that are needed by the adapters you've specified in your database configuration file are actually installed (eg. if your config/database.yml uses the 'mysql2' adapter, then only the mysql2 gem will be installed). Don't forget to re-run `bundle install` when you change config/database.yml for using other database adapters.
66 68 Toshi MARUYAMA
67 70 Jean-Philippe Lang
If you need to load some gems that are not required by Redmine core (eg. fcgi), you can create a file named Gemfile.local at the root of your redmine directory. It will be loaded automatically when running `bundle install`.
68 68 Toshi MARUYAMA
69 1 Jean-Philippe Lang
7. Run the following command from your new Redmine root directory:
70 68 Toshi MARUYAMA
71 70 Jean-Philippe Lang
  rake generate_secret_token
72 31 Thanos Kyritsis
73 63 Etienne Massip
This will generate a file (@config/initializers/secret_token.rb@) with a random secret used to secure session data.
74 1 Jean-Philippe Lang
75 22 Brad Langhorst
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.
76 68 Toshi MARUYAMA
77 26 salt racer
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
78 1 Jean-Philippe Lang
79 65 Jean-Philippe Lang
h3. Option 2 - Upgrading from a SVN checkout
80 1 Jean-Philippe Lang
81
1. Go to the Redmine root directory and run the following command:
82
<pre>
83
svn update
84 69 Toshi MARUYAMA
</pre>
85
86 70 Jean-Philippe Lang
2. Install the required gems by running the following command:
87 15 Eric Davis
88
  bundle update
89
90 1 Jean-Philippe Lang
h2. Step 4 - Update the database
91 28 rafael mascayano
92 1 Jean-Philippe Lang
This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:
93
94 70 Jean-Philippe Lang
  rake db:migrate RAILS_ENV=production 
95 18 Ethan Fremen
96
If you have installed any plugins, you should also run their database migrations:
97 60 Etienne Massip
98 70 Jean-Philippe Lang
  rake redmine:plugins:migrate RAILS_ENV=production 
99 1 Jean-Philippe Lang
100 15 Eric Davis
h2. Step 5 - Clean up
101 1 Jean-Philippe Lang
102 15 Eric Davis
1. You should clear the cache and the existing sessions:
103 1 Jean-Philippe Lang
<pre>
104
rake tmp:cache:clear
105 10 Azamat Hackimov
rake tmp:sessions:clear
106 3 Jean-Philippe Lang
</pre>
107 12 Mischa The Evil
108 62 Etienne Massip
2. Restart the application server (e.g. puma, thin, passenger)
109 12 Mischa The Evil
110 15 Eric Davis
3. Finally go to _"Admin -> Roles & permissions"_ to check/set permissions for the new features, if any.
111 1 Jean-Philippe Lang
112 15 Eric Davis
h2. Common issues
113 10 Azamat Hackimov
114 30 Zach Gardner
h3. Errors with repository management
115 33 Cyber Sprocket
116
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.
117
118
h3. Generating a new @secret_token.rb@
119
120 34 Cyber Sprocket
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.
121 33 Cyber Sprocket
122 32 Szymon Połom
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:
123 35 Cyber Sprocket
124 32 Szymon Połom
 @rake generate_secret_token@
125
126
_Note: The code repository for Redmine does not contain the config/initializers/secret_token.rb file, it is created by the above rake command._
127 35 Cyber Sprocket
128
h3. Related Resources 
129
130
These resources may help you with your Redmine upgrade:
131
132 66 Jean-Philippe Lang
* Error while browsing the wiki history after upgrading from Redmine 1.x with SQLite: see #12501
133 45 Jean-Philippe Lang
* "mod_fcgid for Apache2":http://httpd.apache.org/mod_fcgid/ helped us get Rails running on Apache 2
134 35 Cyber Sprocket
* "Running Redmine on Apache":http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine
135 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)
136
* "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)