CategoryDevelopment

seesaw gem configuration

I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons.

I will publish my configurations in case they are helpfull to some one.

guda@guda-desktop:~/system3/config$ cat seesaw.yml 
--- 
restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
config_symlink: http_cluster/cluster.conf
mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml
config_path: /home/mongrel/system3/current/config
config_files: 
  all: cluster_all.conf
  1: cluster_1.conf
  2: cluster_2.conf
symlink_cmd: ln -sf

here is where my nginx conf link points

guda@guda-desktop:~/system3/config/http_cluster$ ls -l
total 16
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_1.conf
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_2.conf
-rw-r--r-- 1 guda guda 277 2008-11-07 17:17 cluster_all.conf
lrwxrwxrwx 1 guda guda  66 2008-11-08 01:30 cluster.conf -> /home/mongrel/system3/current/config/http_cluster/cluster_all.conf

and in deploy.rb I have this task rewritten.

set :seesaw_conf, "#{current_path}/config/seesaw.yml"
namespace :deploy do
  desc <<-DESC
  Restart the Mongrel processes on the app server using seesaw
  DESC
  task :restart, :roles => :app do
    run <<-CMD
      cd #{current_path} ; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}
    CMD
#    send(run_method, "cd #{current_path}; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}")
  end
end

I am not sure that this is the perfect way of configurating the seesaw. I think that I have some mistakes in the path configurations, and because of that I have to patch the capistrano restart task.

Installing notes for Rails on Debian/Ubunto

Debian Etch with backports

Add this line in sources.list to get rails > 1.8.5 in rails etch

deb http://www.backports.org/debian etch-backports main contrib non-free
# deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free
apt-get install debian-backports-keyring
aptitude update

# some ruby stuff
aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8

# some system utils/libs
aptitude install apt-utils build-essential mysql-server mysql-common mysql-client memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop  openssl

aptitude install -t etch-backports libopenssl-ruby

# gems
gem install rails mongrel mongrel_cluster -y

check this step-by-step

Image magick linux howto – http://rmagick.rubyforge.org/install2-linux.html

aptitude install libmagick9-dev  imagemagick librmagick-ruby1.8 imagemagick librmagick-ruby-doc  libmagick9-dev ruby1.8-dev


# for version 1 of imagemagick we use this rmagick, else try it without the -v
gem install rmagick -v 1.15.12 

# lets test it
> irb
require 'rubygems'
require 'RMagick'
Magick::CenterGravity
puts Magick::Long_version

# or with 

ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;" 

I love this tutorial on rubyinside

Postgres vs MySQL

http://mysqldatabaseadministration.blogspot.com/2007_01_01_archive.html

links

iptables configuration script firewall – http://tje.ssllink.net/firewall/

test driven development website: http://www.testdriven.com/modules/news/

strace – why I havent discovered this tool earliear!

This blog here describes some very usefull usages of strace:

http://www.hokstad.com/5-simple-ways-to-troubleshoot-using-strace.html

Find out which config files a program reads on startup

strace php 2>&1 | grep php.ini

Why does this program not open my file?

strace -e open,access 2>&1 | grep your-filename

What is that process doing RIGHT NOW?

strace -p 15427

What is taking time?

strace -c -p 11084
You can also run this "start to finish", here with "ls":
race -c >/dev/null ls

Why the **** can’t I connect to that server?

strace -e poll,select,connect,recvfrom,sendto nc www.news.com 80

Everyday SVN

I am happy that I have worked enough with the svn to see its drawbacks.

One of the drawbacks is the speeds of commits.

The second one is that my repository starts to break often. here is how I repair it when this happends:

svnadmin repair /var/lib/subversion/public/payak

then don’t forget to change the rights

chown -R  www-data:www-data /var/lib/subversion/public/payak/

Switching and merging with HEAD from some branch

Create branch:

svn copy https://svn.spider.bg/public/payak/system3/trunk \
         https://svn.spider.bg/public/payak/system3/date_sorting/ \
         -m "Creating stable branch for the date sorting."
Delete branch:
svn delete https://svn.spider.bg/public/payak/system3/BRANCHES/new_solr/ -m "get rid of the new_solr branch"

svn switch https://svn.spider.bg/public/payak/system3/trunk .

svn switch https://svn.spider.bg/public/payak/system3/BRANCHES/new_solr/ .

svn merge https://svn.spider.bg/public/payak/system3/trunk https://svn.spider.bg/public/payak/system3/BRANCHES/new_solr

svn ci -m “Merge new solr branch with trunk”

Capistrano and Branches/Tags

I have found this snipplet for capistrano, in my case it is little bit changed so here it is:

cat config/deploy/staging.rb
set :application, "system3"
set :repository, "https://svn.spider.bg/public/payak/#{application}"

set :latest_tag, "trunk"
namespace :deploy do

  desc "Asks the user for the tag to deploy"
  task :before_update_code do
    set :tag, Proc.new { CLI.ui.ask "Branch to deploy (relative to #{repository}) or just hit enter to deploy latest: "}
    set :tag, "#{latest_tag}" if "#{tag}".strip.empty?
    set :repository, "#{repository}/#{tag}"
  end
end

Ignoring rails files/folders

svn propset svn:ignore "*.log" log/

svn propset svn:ignore "*" tmp/

svn propset svn:ignore "*" public/photos public/services

Cool websites on Internet

  • http://www.artofadambetts.com/weblog/?cat=7
    • Orignal idea
    • Nice graphics
    • Perfect scroll in the middle (check the mouse scroller)
    • Some desktop wallpapers
    • Photoshop tutorials

Chunks for the String method.

If you want to generate some sort of chunks from a large strings you can use the following method.
You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position.


class String

def String.random_alphanumeric(size=16)
(1..size).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join end def chunkanize(parts = [[0,4], [48, 52], [95, 100]]) return [self] if self.size <= 1 # working with words terms_array = self.split(/ /) join_type = " " # working with letters if terms_array.size <= 100 terms_array = self.split(//) join_type = "" end one_percent = terms_array.size.to_f / 100 parts.collect do |part| start = part[0] stop = part[1] terms_array[(start * one_percent)..(stop * one_percent)].join(join_type) end end end

Dagens PS and PS Spy

We have launched the website PS Spy. It is a news monitoring website. The website is written using Ruby on Rails, MySQL and Python code and a little bit Java on some key parts.

I am very pround of the webhunter and the accuracy with which we find and deliver news.

Maybe it is good idea to launch a toolbar, we have developed many toolbars for our clients and we have a lot experience in this field, there are free solutions on Internet also.

Here is what the internet says :)

http://www.ifra.de/website/news.nsf/wuis/2247F329A7D9498AC12574BE0049E98E?OpenDocument&0&E&

Benchmarking web application

Load test with tsung – a erlang project. The nice stuff is that the test can be runned on multi machines which will do the tests. Works with proxy. I think it is very nice idea to test it on my next load test.

http://tsung.erlang-projects.org/

© 2024 Gudasoft

Theme by Anders NorénUp ↑