Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

thin_cluster runlevel script

#31

Thin needs support of a runlevel script for managing thin clusters. This is in the vein of mongrel_cluster. My proposed solution (or at least a starting point) consists of a shell script (/etc/init.d/thin_cluster) which calls a ruby script (/usr/bin/thin_cluster.rb) which starts thin clusters based on configuration files located in /etc/thin_cluster. Take a look at the attached file. This solution has been tested on Ubuntu against Thin 0.6.2 Rambo.

Reported by Gump · February 1st, 2008 @ 11:50 PM

State: resolved
Milestone: 0.6.3
Assigned to: macournoyer macournoyer

Activity

  1. macournoyer
    macournoyer
    • State changed from new to open
    • Milestone set to 0.6.3

    February 1st, 2008 @ 11:55 PM

  2. DAddYE
    DAddYE

    Can you change this:

    1. Loop through thin cluster folder and execute the command

    Dir["#{thin_cluster_folder}/*"].each do |file|

    puts "Processing #{file} ...\n\n"

    system "#{thin} -C #{file} #{$*[0]}"

    puts "\n\n"

    end

    in this

    1. Loop through thin cluster folder and execute the command

    Dir["#{thin_cluster_folder}/*"].each do |file|

    puts "Processing #{file} ...\n\n"

    system "#{thin} -C #{file} #{$*[0]}"

    puts "-"

    end

    Output are more clean.

    Thanks!

    February 2nd, 2008 @ 08:01 AM

  3. macournoyer
    macournoyer

    I just commited something based on your patch:

    http://github.com/macournoyer/th...

    I had to remove the PATH variable in your bash script to make it work for me. And I've integrated your thin_cluster.rb script into the thin script.

    Check it out and let me know what you think.

    Setup your cluster to start at startup like this:

    thin config -C myapp.yml --servers 3 ...other options...
    sudo thin install -C myapp.yml
    

    This will install the boot script under /etc/init.d/thin and symlink the config file under /etc/thin/myapp.yml.

    I need to test it on my server before I close this ticket.

    February 3rd, 2008 @ 12:17 AM

  4. DAddYE
    DAddYE

    I only ask a question.

    The symlink option is good for people that store config in app path but for me that I've many many site I prefer to store it directly in /etc/myconfig path with a config like that

    thin config -d -s 3 -p 4360 -e production -a

    127.0.0.1 -c /var/www/apps/mysite/current -C /etc/thin_cluster/

    Why dont make some more simple like:

    thin install service -p /path/of/my/config/dir

    this because I prefer to store in /etc/thin_cluster

    and for other people that want all managed can do

    thin install config ...

    only for create symlinks

    Thanks!

    February 3rd, 2008 @ 08:04 AM

  5. macournoyer
    macournoyer

    I'm not sure I understand your question.

    I think symlinking is better cause you can put your config file under version control w/ all your other project files.

    You think making this 2 steps is simpler then one step? It sure is less configurable, but less configurable is always simpler.

    February 3rd, 2008 @ 08:26 AM

  6. DAddYE
    DAddYE

    Yes I prefer 2 step, or 3

    1) a command for create the service

    2) a command for create symlink (for people that like this way)

    3) a command that run both 1 and 2 step (linke now)

    This way can be beautifull, no?

    Think person about me, If I want only install the service? I need to create a symlink that then I need to remove.

    Is also important (if is possible) configure the path of the config and also the name of the service.

    In this way is simpler but also high configurable

    February 3rd, 2008 @ 08:32 AM

  7. DAddYE
    DAddYE

    3 command like

    thin install service [optional -p /path/of/the/config -n service_name]

    thin install symlink -c /config/thin.yml [optional -p /path/of/the/config]

    thin install config (like now) [optional -p /path/of/the/config -n service_name]

    February 3rd, 2008 @ 08:55 AM

  8. macournoyer
    macournoyer

    After some more thoughts on this and following your advices, here's what I propose:

    thin install /etc/thin
    

    This will install the runlevel script under /etc/init.d/thin and configure it to check for config files under /etc/thin (could be configured in the previous command).

    Then instead of symlinking it'd just output instructions:

    To configure thin to start at system boot:
    on RedHat like systems:
      sudo /sbin/chkconfig --level 345 thin on
    on Debian like systems (Ubuntu):
      sudo /usr/sbin/update-rc.d -f thin defaults
    
    Then put your config files in /etc/thin.
    

    Also I think the default path should be /etc/thin since /etc/thin_cluster id legacy from mongrel_cluster which is named like this because it's a separate gem.

    plz let me know your thoughts!

    February 3rd, 2008 @ 03:51 PM

  9. DAddYE
    DAddYE

    Is perfect also for me!

    Super Thanks!

    February 3rd, 2008 @ 04:16 PM

  10. macournoyer

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.