Upgrade instructions

Version 9 (Brian Gupta, 12/02/2011 03:48 am)

1 1
h1. Upgrading
2 1
3 1
{{>toc}}
4 1
5 1
h2. Step 1 - Backup
6 1
7 1
It is recommended that you backup your database and modifications to Foreman files(config/settings.yaml, unattended installations etc).  Most upgrades are safe but it never hurts to have a backup just in case.
8 1
9 1
h3. MySQL database
10 1
11 1
The @mysqldump@ command can be used to backup the contents of your MySQL database to a text file.
12 1
13 1
h3. SQLite database
14 1
15 1
SQLite databases are all contained in a single file, so you can back them up by copying the file to another location.
16 1
17 1
h3. PostgreSQL
18 1
19 1
The @pg_dump@ command can be used to backup the contents of a PostgreSQL database to a text file.
20 1
21 1
h2. Step 2 - Perform the upgrade
22 1
23 1
Now it's time to perform the actual upgrade.  This process if different depending on how you downloaded Foreman.  You only need to perform *one* of the following options.
24 1
25 2 Ohad Levy
h3. Option 1 - Downloaded release (tar.bz2)
26 1
27 1
# Uncompress the new program archive in a *new directory*.
28 1
# Copy your database settings-file @config/database.yml@ into the new @config@ directory.
29 1
if your database is a simple file (e.g. SQLite), don't forget to make it available in the new directory.
30 1
31 1
VERY IMPORTANT: do NOT overwrite @config/settings.yml@ with the old one.
32 1
33 8 Ohad Levy
h3. Option 2 - Upgrading from git 
34 8 Ohad Levy
35 8 Ohad Levy
*Please note* now that the development branch has moved to Rails 3, you MUST take care to select a branch and make sure you get the correct one.
36 1
37 1
1. Go to the Foreman root directory and run the following command:
38 1
39 5 Brian Gupta
For staying on the stable branch:
40 5 Brian Gupta
<pre><code>
41 7 Brian Gupta
git checkout 0.4-stable
42 5 Brian Gupta
git pull
43 1
git submodule init
44 1
git submodule update
45 1
</code></pre>
46 1
47 1
> *Or if you have to access github through a proxy using the HTTP urls*
48 4 Matt Mencel
<pre>
49 7 Brian Gupta
git checkout 0.4-stable
50 4 Matt Mencel
git pull
51 4 Matt Mencel
sed -i 's/git:\/\//http:\/\//g' .gitmodules
52 4 Matt Mencel
git submodule init
53 1
git submodule update
54 1
</pre>
55 5 Brian Gupta
56 5 Brian Gupta
For upgrading to the Rails 3 based "develop" branch:
57 5 Brian Gupta
<pre><code>
58 6 Brian Gupta
create a new directory
59 6 Brian Gupta
checkout a new copy of the code in the new directory using [[Installing_latest_code_]]
60 6 Brian Gupta
manually copy relevant config files
61 5 Brian Gupta
</code></pre>
62 5 Brian Gupta
63 5 Brian Gupta
For upgrading within the Rails 3 develop branch:
64 5 Brian Gupta
<pre><code>
65 9 Brian Gupta
git checkout develop
66 5 Brian Gupta
git pull
67 5 Brian Gupta
</code></pre>
68 4 Matt Mencel
69 3 Ohad Levy
h3. Option 3 - Upgrading from a package (RPM, DEB)
70 3 Ohad Levy
71 3 Ohad Levy
Simply update your package via your normally, and you can skip Step 4
72 3 Ohad Levy
73 1
h2. Step 4 - Update the database
74 1
75 1
This step is the one that could change the contents of your database. Go to your new Foreman directory (or the git dir), then migrate your database:
76 1
77 1
<pre>
78 1
rake db:migrate RAILS_ENV="production"
79 1
</pre>
80 1
81 1
h2. Step 5 - Clean up
82 1
83 1
1. You should clear the cache and the existing sessions:
84 1
<pre>
85 1
rake tmp:cache:clear
86 1
rake tmp:sessions:clear
87 1
</pre>
88 1
89 1
2. Restart the application server (e.g. mongrel, thin, passenger)
90 1
91 1
h2. Common issues 
92 1
93 1
see [[Troubleshooting]]