

Published on 2008-4-9 1:22:00 by
After being one week on the road, I'm finally back home again. Last week I presented at RubyFools Copenhagen and Scotland on Rails and therefore traveled a lot.
This was my first time in Copenhagen and it seemed like a very nice city. The conference venue was very nice, a brand new university building with a big hall. My talk about Rails on AWS was well received. I've added some information about the new EC2 features like elastic IPs and availability zones. A video of the presentation should hopefully soon be available. After the sessions I've spend some time chatting with Matz about Ruby/JRuby/Rubinius and his work in Japan.
Next I traveled to Edinburgh for Scotland on Rails. Edinburgh feels like my second home town as I've studied and worked there for a while. The conference was very good organized and had a different Ruby crew there. Most of the RubyFools Copenhagen folks went straight to RubyFools Oslo, so there were many new faces in Edinburgh.
I gave a presentation about Rails Patterns, typical problems of real-life Rails production sites and solutions/patterns. Afterwards I had a couple of nice conversations with other developers and their experiences with similar situations.
Apart from the great conference, I had a chance to spend some time in Edinburgh and catch-up with some people there.
My slides can be found here:
RubyFools Copenhagen: Rails on AWS (PDF)
Scotland on Rails: Rails Patterns (PDF)
RubyFools Copenhagen: Rails on AWS (PDF)
Scotland on Rails: Rails Patterns (PDF)

Published on 2008-3-25 19:31:00 by
Next week I'm going to present Rails Patterns at the Scotland on Rails conference. The idea is to talk about common pitfalls and problems that I've encountered in many of the Rails projects I've been involved with and describe a solution or best practice.
I've already assembled several scenarios like async media processing, handling massive user data or deployment setups. I'm also curious what kind of problems you have encountered in your Rails past so that I can include them.
So if you have any suggestion to a common mistake that you see (like throwing plugins at random problems just because it seems easier) or a useful pattern that you use (like following "vendor everything" or how you handle background jobs), please send them too me. You can post a comment here in the blog, email me or use twitter.

Published on 2008-3-22 7:16:00 by
If you ever got an error like this while testing your code in production
ActionView::TemplateError (private method `chomp' called for nil:NilClass) in ... <%= stylesheet_link_merged :styles %> <%= javascript_include_merged :libs %>
then you forgot to create your packed JavaScript and CSS assets:
rake asset:packager:build_all

Published on 2008-3-12 20:27:00 by
Just a small note for people using Capistrano/Webistrano and the remote_cache deployment strategy.
set :deploy_via, :remote_cache
The remote_cache strategy creates a cached-copy directory in your #{deploy_to}/shared base. It then checks out the coe once and in contrast to the default deployment strategy. After the initial checkout subsequent deployments will do a `svn up` and copy the result over to #{deplot_to}/releases/.
Using remote_cache your deployments are usually a bit faster but there is a catch. If you ever change the repository variable, e.g. because you switch to another tag of move the stable branch, your deployments will either fail or do not completely update.
This is due to the fact, that the new deployment does a
$ svn up -rYOUR_REV http://svn.example.com/svn/branches/my_new_branch
on the cached copy. With a different branch or tag than the one the `svn checkout` command was executed with, this will not work. In order to fix it, just delete the cached-copy directory. It will be re-created on the next deployment.
$ rm -rf /path/to/deploy/shared/cached-copy

Published on 2008-2-17 3:58:00 by
The conference season is starting again for me and I wanted to note where I will be/speak during the next couple of weeks.
|
First, there is Ruby Fools Copenhagen (April 1st and 2nd) where I will speak in the Ruby Performance track about Rails on AWS and how to leverage EC2, S3, and SQS in your application. The lineup at Ruby Fools looks really good with speakers like Glenn Vanderburg, Michael Koziarski, Evan Phoenix, Dr. Nic Williams, Dave Thomas, and Matz himself. Unfortunately I will not have too much time in Copenhagen as I have to leave early for Scotland on Rails in Edinburgh. |
|
I'm really looking forward to be in Edinburgh again. After living, studying, and working there it feels like a second home. At Scotland on Rails (April 4th and 5th) I will talk about Rails Patterns: typical problems and scenarios in Rails applications like asynchronous operations (image processing, calculations, ..), authentication or deployment and common solutions and best practices. |
In Mai I will be at Linuxtag 2008 in Berlin and hopefully talk about Ruby on Rails Security, but this talk has not been confirmed yet. Further, there is a chance that I will be speaking a the iX Cebit Forum 2008 about our internal Software Development Process and Agile Development.

Published on 2008-2-5 2:35:00 by
|
Design Patterns in Ruby by Russ Olsen is an introduction to Design Patterns. It covers 14 out of the 23 patterns of the GoF Design Patters: Elements of Reusable Object-Oriented Software book and adds three Ruby-related patterns. The book examines each pattern in general, shows how it applies to a dynamic language like Ruby and explains when to use or not use the pattern. The fact that the book is written in an informal style with lots of examples makes it really easy to read and follow. I really liked the format of the pattern examination and find it an excellent overview of and introduction to Design Patterns. The covered GoF patterns (Template Method, Strategy, Observer, Composite, Iterator, Command, Adapter, Proxy, Decorator, Singleton, Factory Method, Abstract Factory Method, Builder, and Interpreter) are the most important ones and are easy to apply in Ruby. Especially the chapter on Interpreter made a very good job of explaining a widely under-utilized pattern. It even showed how to build a parser and didn't stop at the AST. |
Apart from those classic patterns, the book introduces Internal Domain-Specific Languages, Meta-Programming, and Convention Over Configuration as newer patterns that are closely related to dynamic languages like Ruby. Those chapters cover nothing new to Rails programmers but are a nice addition to a general Ruby Patterns book. In my opinion the discussion of Meta-Programming could be a bit longer as it only covers class_eval and Ruby has more to offer.
In general, Design Patterns in Ruby is a very good overview of Design Patterns in the modern, dynamic world of Ruby. The book makes sure that the reader understands where a pattern arises and is very good in explaining its usage by example. Further, I cannot praise enough the fact that the author also tells you when NOT to use a pattern and warns about over-usage of inheritance or patterns.
With 338 pages of informal, easy to read examples and explanations, the book is easy to read in two or three afternoons. If you look for an introduction to Design Patterns or want to know how they apply in Ruby, I really recommend Design Patterns in Ruby.

Published on 2008-1-4 4:32:00 by
The slides and a video of my Ruby on Rails Security session are now online. The 24C3 was a lot of fun, unfortunately I couldn't spend all 4 days there.
My talk covered most of the common web application vulnerabilities like Cross Site Scripting and Cross Site Request Forgery, SQL and Code injection, and deployment security and how they apply to Rails. Further Ruby on Rails specific issues like Rails plugin security, JavaScript/Ajax security, and Rails configuration were be examined and best practice solutions were introduced.
The is also a Google video version: Ruby on Rails Security.
<embed src="http://video.google.com/googleplayer.swf?docId=3972597293246812066&hl=en" type="application/x-shockwave-flash" id="VideoPlayback" flashvars="" style="width:400px; height:326px;"> </embed>Get the slides (PDF - 1.6 MB) or the video (mkv - 95 MB). Other formats are available from the official mirrors or the torrent site.

Published on 2007-11-8 3:16:00 by
I'm just back from today's Web 2.0 Expo sessions and I'm not sure I will attend tomorrow. Many have written about this before, but the creative, social atmosphere is missing due to the conference labyrinth halls. Boy, I'm happy I haven't spend > 1.000 Euros on this. No real food, a lot of product presentations, not enough room for socializing and to many suits for my taste.
Still, I had some nice conversations and met some interesting people.
I did again a session on scaling with Amazon EC2 and S3, the slides can be found here.
This time a also talked a bit about how we use S3 and EC2 to drive our Webmail Portal product, PeritorMail at Peritor.
| ViewAlso nice the AWS announcement of S3 being available in EU data centers. Now I'm only waiting for EC2 in the EU...

Published on 2007-10-17 19:56:00 by
Webistrano 1.2 is out. You can get it at the Peritor Labs project page.
Version 1.2 brings the following changes and enhancements:
- Fixes a bug in the execution of tasks with sudo
- Highlight recipe syntax with the syntax gem
- Include Capistrano 2.1.0 and git support
- Add experimental support for ssh_keys and ssh_ports as normal configuration parameter (currently only one SSH key is supported)
Although Capistrano 2.1.0 is included, Webistrano will by default allocate a pty for each SSH command as the new Capistrano default of now doing so seems problematic on some hosts.
Further there where some minor fixes and UI enhancements. All available configuration parameter are now documented in the wiki.
Upgrading is done with a `RAILS_ENV=production rake db:migrate`, more information on how to upgrade can be found here.
With version 1.2 out of the door I will focus on bringing authorization to Webistrano so that deployment permissions can be tight to individual users and groups.
Get version 1.2 either from the download page or directly here: webistrano-1.2.zip

Published on 2007-10-16 16:30:00 by
Amazon EC2 gets two new types of instances, large and extra large EC2 instances. Basically a large instance that has 4 times the capacity (CPU, RAM, HDD) of the old, now default small instance type while the extra large instance type has 8 times the capacity.
Small Instance (default)
1.7 GB memory 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit) 160 GB instance storage (150 GB plus 10 GB root partition) 32-bit platform I/O Performance: Moderate Price: $0.10 per instance hour
Large Instance
7.5 GB memory 4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each) 850 GB instance storage (2 x 420 GB plus 10 GB root partition) 64-bit platform I/O Performance: High Price: $0.40 per instance hour
Extra Large Instance
15 GB memory 8 EC2 Compute Units (4 virtual cores with 2 EC2 Compute Units each) 1,690 GB instance storage (4 x 420 GB plus 10 GB root partition) 64-bit platform I/O Performance: High Price: $0.80 per instance hour
The idea is that you specify the instance type in the RunInstances API call. All old tools that do not specify this parameter start a default instance type.
Very nice to see this so fast after the recent S3 SLAs.
If they would now allow to run EC2 instances in Europe there are no excuses left not to run nearly all applications on EC2.

Published on 2007-10-12 2:35:00 by
Capistrano (and thereby Webistrano) is very flexible and there are a lot of variables that can change its default behaviour.
Unfortunately there is no one public list of all parameter to tweak. As the question about all of those comes up every now and then I decided to create a probably incomplete list of all configuration parameter for Webistrano and Capistrano.
The list can be found on the Webistrano project page.
If you have any additions or corrections, please tell me or use the project page directly to submit corrections.

Published on 2007-10-9 4:54:00 by
Basically, we commit to 99.9% uptime, measured on a monthly basis. If an S3 call fails (by returning a ServiceUnavailable or InternalError result) this counts against the uptime. If the resulting uptime is less than 99%, you can apply for a service credit of 25% of your total S3 charges for the month. If the uptime is 99% but less than 99.9%, you can apply for a service credit of 10% of your S3 charges.
Very nice to see this shortly after the AWS presentation by Jeff Barr at the Berlin Ruby User Group. But I guess that for many people in big corporate settings this is not enough. But still, it's a start. And it makes selling AWS S3 as part of our solutions easier.
I'n now waiting for a EC2 SLA.
Get the details here.

Published on 2007-9-29 3:11:00 by
A common question about Capistrano tasks is how to capture the output of a task. By default Capistrano will just execute your command and ignore any output.
But sometimes you want to capture and log the output. There is no easy command to do this right now, you have to use the SSH channels:
run "cat /etc/passwd " do |ch, stream, data|
if stream == :err
logger.debug "capured output on STDERR: #{data}"
else # stream == :out
logger.debug "capured output on STDOUT: #{data}"
end
end
You can even send data back depending on the captured output:
run "mysql -u root my_database -p < /tmp/dump.sql" do |ch, stream, data|
if data =~ /password:/
ch.send_data(root_password)
end
end
Using this technique you can store command output in the Webistrano log or just print it if you are using stock Capistrano.

Published on 2007-9-28 21:04:00 by
Webistrano 1.1 is finally out. Webistrano is a Web UI for managing Capistrano deployments. It lets you manage projects and their stages like test, production, and staging with different settings.
It took a little longer because we got some feedback at Rails Conf Europe that we incorporated.
Further Webistrano now has its new home and own Trac/Wiki/Ticketsystem at the Peritor Labs. Peritor Labs is the place where we are going to release inhouse projects like Webistrano under the BSD license. At the moment there is only Webistrano but more will follow.
This means that the Subversion URL also changed. If you tracked Webistrano through svn, please switch to new URL:
svn switch --relocate http://webistrano.rubyforge.org/svn/trunk/ \ http://webistrano.rubyforge.org/svn/trunk http://labs.peritor.com/svn/webistrano/trunk
The major change in version 1.1 is a new shiny UI by the curtsy of Marcus Lamer.
Check out some new screenshots.
Further recipes are now associated to stages and not projects anymore so that different stages of a project can have different recipes. Webistrano now also set two variables inside recipes by default. Those two variables ( :webistrano_project and :webistrano_stage) are set to the project and stage name and can be used to do some decision making inside your recipes.
Upgrading from 1.0 is quite easy, just download the new version, copy your configuration files over and upgrade the database:
RAILS_ENV=production rake db:migrate
The roadmap for the next versions includes some basic monitoring capabilities and some form of permission management that lets you manage which user can deploy which projects and so on. The screencasts have not been updated yet but the content they provide is still valid, the only change is that recipes now belong to stages.
If you have any feedback, please comment here or use the Wiki.
Direct download link: webistrano-1.1.zip or at the Peritor Labs project page.

Published on 2007-9-23 20:03:00 by
If you ever get such a wonderful verbose error message like this while running a Ruby script that uses sockets:
/usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
Look for problems in /etc/hosts. In my case I wanted to use the Ferret drb-server and /etc/hosts was completely empty on a fresh EC2 node.
Just add a
127.0.0.1 localhost
And the problem goes away.








BlogFish

