Thanks Railscasts!
<% flash.each do |key, msg| %>
<%= content_tag :div, msg, :id => “flash_#{key}” %>
<% end %>
Though I do love OSWD, I keep going back to freecsstemplates.org for really good looking stuff. Take a look.
Did you know that you can deploy your rails app with just the deploy.rb file?
Download your deploy.rb file and hit it:
[sbarber@awhpbl01 onlinerss]$ ls
deploy.rb
[sbarber@awhpbl01 onlinerss]$ RAILS_ENV=qa cap -f ./deploy.rb deploy
* executing task deploy
* executing task update
…
Yeah - cap rocks.
I just ran across an alternative to Pound / Pen for Mongrel balancing…
PLB.
Just registered for the Mountain West Ruby Conference to be held back in SLC, UT in March. See you there.
It all started with faulty power at one of our hosting areas. I use the term “hosting area” as lightly as possible. Servers would stop responding and we’d get the call. “Wait… is that in building 2?”, we’d ask ourselves. If the answer was yes then we’d get in the car and head on down to physically restart the server. Now - before you go off about what a piece of crap setup we have and how it reflects badly on me as a Senior SysAdmin - just wait. I have nothing to do with the current situation. All those boxen were supposed to be transfered to a VM eons ago. We’ve tried all in our power to fix it. As my fellow sysadmin likes to say, “My Care is Broken.” We just laugh and go on working with things we can fix.
All of the “servers” in said building 2 are supposed to be Dev / QA only. How can one expect to run production code in a lousy place like that? For reasons I have yet to understand, a nice little Rails app was pushed into production without a production server to put it on. “We’ll just run it on the QA box, right?” uhh… yeah, whatever. I found out about only after the fact, so I said, “I’ll do the best I can to keep pound and the mongrel cluster up, but no promises there.”
It got to be a an issue - having to restart pound and mongrel on the box - but I was busy with other projects to fix it right away. I’ve now learned my lesson: Throw monit on there right away and be done with it.
FYI: Our setup looks something like lighttpd -> pound -> mongrel_cluster. It’s not the final setup we’ll be using for prod, but it’s great for now.
After a 1/2 day of tweaking and experimenting here’s my /etc/monitrc:
(some names have been changed to protect the innocent)
set daemon 120
set logfile syslog facility log_daemon
## Little monit webserver
set httpd port 2812 and
allow 10.0.0.0/8
allow localhost
allow admin:[super secret password here]
###### Pound #######
check process pound with pidfile /var/run/pound.pid
start program = “/etc/init.d/pound start”
stop program = “/etc/init.d/pound stop”
if failed host 127.0.0.1 port 88 protocol http
with timeout 10 seconds
then restart
###### 411 App ######
# Mongrel-4000
check process mongrel-4000 with pidfile /home/[user dir]/apps/411/current/log/mongrel.4000.pid
group mongrel-411
start program = ” /usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e qa -p 4000 -a 127.0.0.1 -P /home/[user dir]/apps/411/current/log/mongrel.4000.pid -c /home/[user dir]/apps/411/current/” as uid and
stop program = ” /usr/local/bin/ruby /usr/local/bin/mongrel_rails stop -p 4000 -P /home/[user dir]/apps/411/current/log/mongrel.4000.pid -c /home/[user dir]/apps/411/current/” as uid [user] and gid [group]
if failed host 127.0.0.1 port 4000 protocol http
with timeout 10 seconds
then restart
# (Repeat for other mongrels in the cluster… 4001, etc)
I threw monit in the inittab for those nasty restarts:
# Run monit in standard run-levels
mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc
Apple iPhone: Will it run Ruby? Leopard will have it
Once again I’ve falled in love my MythTV. I’ve been running it for about 5 months solid now. no reboots, or big issues to deal with. A few recent tweaks: Added my ROM collection over a remote share for MythGame. New favorite mythtv theme: blootube. I transcode any new recordings to XviD (with commercial skip) and then move them to my NAS video share for future viewing.
Recent change of heart: Fav Desktop OS -> OSX. Still really love Ubuntu for servers, etc.
This time of year I love living in Arizona. Did you get snow recently? Gee… that’s too bad. I think we’re looking at 68 today. LOL!
Working on some street cred in the community. See me at: Working With Rails: People
It’s like MySpace for Rails folks
Hey - I almost presented during the lighting talks in RubyConf.
During RubyConf I had a chance to sit next to John Long of RadintCMS fame. He’s a cool guy and Radiant is awesome for simple websites. I’m using Radiant for a few of my customers simple websites.
Not to be outdone in the coding arena, here are my important contributions to RadiantCMS. I call this collection of code “Inappropriate Text Filters.”
Markdown? Textile? You got nothing on me:
Filter #1: piglatin_filter.rb
class PigLatinFilter < TextFilter::Base
register 'PigLatin'
def filter(text)
text.split.collect{|word| pig(word)}.join(" ")
end
def pig(word)
leadingCap = word =~ /^A-Z/
word.downcase!
res = case word
when /^aeiouy/
word+"way"
when /^([^aeiouy]+)(.*)/
$2+$1+"ay"
else
word
end
leadingCap ? res.capitalize : res
end
end
Filter #2: crypt_filter.rb
class CryptoFilter < TextFilter::Base
register 'Crypto'
def filter(text)
text.crypt("da_salt_")
end
end
Filter #3: reverse_filter.rb
class ReverseFilter < TextFilter::Base
register 'Reverse'
def filter(text)
text.split.collect{|word| word.reverse!}.join(" ")
end
end
Very interesting concept. I’m wondering what the reaction will be from other Rails developers and the core team. I’m excited to try it out on my next project…
Unspace - HAML: HTML Abstraction Markup Language