Missing Mephisto Upgrade Guide: 0.7.3 to 0.8
April 25th, 2008
My Mephisto install was 0.7.3- 0.8 doesn’t have any huge feature changes but there are some bugfixes and small enhancements, as well as a performance boost (speed, memory use) from using rails 2.0. My install was from a tarball, and I don’t want to move my production server to a git checkout (yet?). Like other Mephisto users I’ve got theme customizations and maybe even some things in the public directory.
I need to upgrade, not reinstall. The Mephisto folks didn’t write a real upgrade guide, but this is Rails and it’s not too hard to figure out. Almost any rails app could be updated this way:
- Back Everything Up
- Create & Apply A Patch
- Stop Your Server & Clean Up
- Patch Code & Migrate The Database
- Crack Open A Beer
Back Everything Up
Back up the current code and database.
1 2 |
cp -a my_blog my_blog.bck mysqldump -uroot --opt mephisto_production > pre0.8.sql |
There’s your safety net.
Create A Patch
The trick here is to create a patch between the version of Mephisto you’re currently running and 0.8. For me that was 0.7.3, so that’s what I’ll use below. Fetch the 0.7.3 and the 0.8 source:
1 2 |
wget http://s3.amazonaws.com/mephisto-blog/mephisto-0.7.3.tar.gz wget http://github.com/technoweenie/mephisto/tarball/master.tar.gz |
And this is weird right here. Justin has linked the 0.8 release from the Mephisto download page as the git master tarball. This means you don’t know what rev of git you will actually get when you click on it.
So there isn’t even really an 0.8 release, there’s just a link to a dynamic current master. Bad form.
I ended up with 9072b487bf45c5e41e33c66b32d94aea84732d1b, you might get something else. You could get the rev I used by fetching it directly:
1 |
wget http://github.com/tarballs/technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b.tar.gz |
Now untar the two packages. You get a nice “mephisto-0.7.3” directory for 0.7.3, and something messy like “technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b” for 0.8. Make a diff between the two:
1 |
diff -Nur mephisto-0.7.3 technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b > ~/mephisto-0.7.3_to_0.8.patch |
Or you can download the 0.7.3 to 0.8 patch from me, it weighs in at a hefty 4.9M.
Stop Your Server & Clean Up
Everyone has a custom Rails setup, so just stop your server the proper way. After that give it a good:
1 |
rake tmp:clear |
To flush out the caches and such.
Patch Code & Migrate The Database
Now that the server is turned off and cache is cleared, try patching.
1 2 |
cd /var/ww/my_blog patch -p1 < ~/mephisto-0.7.3_to_0.8.patch |
Mostly you’ll just see “patching file ….” flying by, but you may get a changed file question like this:
1 2 |
patching file public/.htaccess Reversed (or previously applied) patch detected! Assume -R? [n] |
You can likely answer “n” to both the Assume and the Apply question:
1 2 3 4 5 6 7 |
patching file public/.htaccess Reversed (or previously applied) patch detected! Assume -R? [n] n Apply anyway? [n] n Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file public/.htaccess.rej patching file public/install.html ... |
I also had some custom filters added to environment.rb, and got this:
1 2 3 4 5 |
patching file config/environment.rb Hunk #3 FAILED at 44. 1 out of 3 hunks FAILED -- saving rejects to file config/environment.rb.rej patching file config/environments/development.rb ... |
A failed hunk means patching that file didn’t work, usually because you have local modifications. In case the solution is easy: You want to use the version of config/environment.rb that came with 0.8, and put your customizations into config/initializers/custom.rb. Copy the good config/environment.rb from the 0.8 tarball you extracted earlier right over the local file. You can still find your customizations in config/environment.rb.orig and copy them from there to the new file for environment customizations, config/initializers/custom.rb.
Install Gems (Well, I Had To)
Before I could migrate I had to install tzinfo.
1 |
sudo gem install tzinfo |
Maybe you will too.
Migrate The Database
Compared to applying the patch this is easy:
1 2 |
cd /var/www/my_blog RAILS_ENV=production rake db:migrate |
My database updated with no problems at all.
Crack Open A Beer
Start up your mongrel, thin, eventd_mongrel or other server and crack open that frosty brew. You’ve just upgraded yourself to the best release of the self-proclaimed best blogging system ever.
So what kind of beer are you enjoying today?
Hi Matt,
Do we need any extra gems, when we upgrade to 0.8 version ?
Well, i have lot of data in my DB and few files in mephisto 0.7.3 has been customized. I have patched the 0.8 with my production data.
When i start webrick, i get the following error, Pls help me out in fixing it.
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:13: warning: already initialized constant OPTIONS D:/Mephisto/technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/config/../lib/mephisto/plugin_about_patch.rb:10:in `initialize_without_about_info’: stack level too deep (SystemStackError) from D:/Mephisto/technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/config/../lib/mephisto/plugin_about_p atch.rb:10:in `initialize_without_about_info’ from D:/Mephisto/technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/lib/mephisto/plugin_about_patch.rb:10 :in `initialize’
Thanks, Naresh.
Thanks for you Mephisto Upgrade Guide. It has helped me alot.
I fixed my problem, i was missing salesforce-active-adapter gem. :)
- Naresh.
Hello,
Thanks for the guide Matt. I tried a step by step approach. I had an issue with rails version, I erased the vendor/rails directory and afterwards rake aborded with another error.
Rails gives me hard time since day one. Anyway thank you for the tutorial, I’ll try it out again when I have more time.
ps. I’m hosted in dreamhost, apparently they have already installed all the needed gems.
I’m at the step, “Patch Code & Migrate The Database”. Running the “patch” command does appear to patch a bunch of files, but immediately following the “iff
Nur mephisto-0.7.3/config/database.example.yml” file, it stops and sits at a “File to Patch:” prompt. Pressing “Enter” results in a “No file found-skip this patch? [n]” prompt. Entering “n” brings me back to the “File to Patch” prompt. Any idea what’s going on? Did the patch succeed?Thank you.
Nice Site! http://google.com