RedmineUpgrade » History » Version 29

Jean-Philippe Lang, 2010-01-30 13:32
explanations about session_store

1 1 Jean-Philippe Lang
h1. Upgrading
2 1 Jean-Philippe Lang
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 15 Eric Davis
9 15 Eric Davis
h2. Step 2 - Backup
10 15 Eric Davis
11 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.
12 15 Eric Davis
13 15 Eric Davis
h3. Backing up the files
14 15 Eric Davis
15 15 Eric Davis
All file uploads are stored to the @files/@ directory.  You can copy the contents of this directory to a another location to easily back it up.
16 15 Eric Davis
17 15 Eric Davis
h3. MySQL database
18 15 Eric Davis
19 15 Eric Davis
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file.
20 15 Eric Davis
21 15 Eric Davis
h3. SQLite database
22 15 Eric Davis
23 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.
24 15 Eric Davis
25 15 Eric Davis
h3. PostgreSQL
26 15 Eric Davis
27 15 Eric Davis
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file.
28 15 Eric Davis
29 15 Eric Davis
h2. Step 3 - Perform the upgrade
30 15 Eric Davis
31 16 Eric Davis
Now it's time to perform the actual upgrade.  This process if different depending on how you downloaded Redmine.  You only need to perform *one* of the following options.
32 15 Eric Davis
33 16 Eric Davis
h3. Option 1 - Downloaded release (tar.gz or zip file)
34 15 Eric Davis
35 15 Eric Davis
1. Uncompress the new program archive in a new directory.
36 15 Eric Davis
37 15 Eric Davis
2. Copy your database settings-file @config/database.yml@ into the new @config@ directory.
38 15 Eric Davis
39 19 Jean-Philippe Lang
3. Copy your email settings-file @config/email.yml@ into the new @config@ directory.
40 15 Eric Davis
41 15 Eric Davis
4. Copy the @RAILS_ROOT/files@ directory content into your new installation.
42 15 Eric Davis
43 1 Jean-Philippe Lang
5. Copy the folders of your installed plugins into new installation directory
44 19 Jean-Philippe Lang
45 29 Jean-Philippe Lang
6. Run the following command from your Redmine root directory:
46 29 Jean-Philippe Lang
47 29 Jean-Philippe Lang
  rake config/initializers/session_store.rb
48 29 Jean-Philippe Lang
49 29 Jean-Philippe Lang
This will generate a file (@config/initializers/session_store.rb@) with a random secret used to secure session data.
50 22 Brad Langhorst
51 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.
52 26 salt racer
53 19 Jean-Philippe Lang
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
54 17 Erick Pérez Castellanos
55 16 Eric Davis
h3. Option 2 - Upgrading from a SVN [[CheckingoutRedmine|checkout]]
56 15 Eric Davis
57 2 Jean-Philippe Lang
1. Go to the Redmine root directory and run the following command:
58 1 Jean-Philippe Lang
<pre>
59 1 Jean-Philippe Lang
svn update
60 1 Jean-Philippe Lang
</pre>
61 1 Jean-Philippe Lang
62 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@.
63 15 Eric Davis
64 15 Eric Davis
h2. Step 4 - Update the database
65 15 Eric Davis
66 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:
67 15 Eric Davis
68 1 Jean-Philippe Lang
<pre>
69 28 rafael mascayano
rake db:migrate RAILS_ENV=production 
70 1 Jean-Philippe Lang
</pre>
71 1 Jean-Philippe Lang
72 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:
73 18 Ethan Fremen
74 1 Jean-Philippe Lang
<pre>
75 28 rafael mascayano
rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
76 18 Ethan Fremen
</pre>
77 18 Ethan Fremen
78 18 Ethan Fremen
<pre>
79 28 rafael mascayano
rake db:migrate_plugins RAILS_ENV=production 
80 1 Jean-Philippe Lang
</pre>
81 1 Jean-Philippe Lang
82 15 Eric Davis
h2. Step 5 - Clean up
83 1 Jean-Philippe Lang
84 15 Eric Davis
1. You should clear the cache and the existing sessions:
85 1 Jean-Philippe Lang
<pre>
86 1 Jean-Philippe Lang
rake tmp:cache:clear
87 10 Azamat Hackimov
rake tmp:sessions:clear
88 3 Jean-Philippe Lang
</pre>
89 12 Mischa The Evil
90 15 Eric Davis
2. Restart the application server (e.g. mongrel, thin, passenger)
91 12 Mischa The Evil
92 15 Eric Davis
3. Finally go to _"Admin -> Roles & permissions"_ to check/set permissions for the new features, if any.
93 1 Jean-Philippe Lang
94 15 Eric Davis
h2. Common issues
95 10 Azamat Hackimov
96 15 Eric Davis
h3. Generating a session_store.rb
97 1 Jean-Philippe Lang
98 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:
99 10 Azamat Hackimov
<pre>
100 10 Azamat Hackimov
rake config/initializers/session_store.rb
101 10 Azamat Hackimov
</pre>
102 10 Azamat Hackimov
103 15 Eric Davis
104 15 Eric Davis
h3. Errors about a missing session_store.rb
105 15 Eric Davis
106 15 Eric Davis
If you see any errors about a missing @session_store.rb@ file, run the command above to create a new one.
107 1 Jean-Philippe Lang
108 1 Jean-Philippe Lang
h3. Error about the Rails version
109 1 Jean-Philippe Lang
110 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:
111 15 Eric Davis
<pre>
112 27 Ikawe Saeem
gem install rails -v=2.3.5
113 15 Eric Davis
</pre>