public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Make god example file work w/ tcp cluster (port based) 
[michael@glauche.de]
macournoyer (author)
Thu Feb 14 19:50:38 -0800 2008
commit  429ddd75ec6a04d5e520bc6198238bf6c2e68c14
tree    c8dca9434f2379948e2cea3c60ed7eb25a4b130b
parent  f5012ae9b02f2eed32a018a769f11e9439cc0134
...
1
2
3
 
4
5
6
7
8
9
10
11
...
16
17
18
19
 
 
 
 
 
20
21
22
 
23
24
25
26
27
28
29
 
30
31
32
 
33
34
35
 
36
37
38
39
40
 
41
42
43
...
1
2
 
3
4
5
6
7
8
9
10
11
...
16
17
18
 
19
20
21
22
23
24
25
 
26
27
28
29
30
31
32
 
33
34
35
 
36
37
38
 
39
40
41
42
43
 
44
45
46
47
0
@@ -1,6 +1,6 @@
0
 # == God config file
0
 # http://god.rubyforge.org/
0
-# Author: Gump
0
+# Authors: Gump and michael@glauche.de
0
 #
0
 # Config file for god that configures watches for each instance of a thin server for
0
 # each thin configuration file found in /etc/thin.
0
0
0
0
0
0
@@ -16,28 +16,32 @@
0
   config = YAML.load_file(file)
0
   num_servers = config["servers"] ||= 1
0
 
0
- for i in 0...num_servers
0
+ (0...num_servers).each do |i|
0
+ # UNIX socket cluster use number 0 to 2 (for 3 servers)
0
+ # and tcp cluster use port number 3000 to 3002.
0
+ number = config['socket'] ? i : (config['port'] + i)
0
+
0
     God.watch do |w|
0
       w.group = "thin-" + File.basename(file, ".yml")
0
- w.name = w.group + "-#{i}"
0
+ w.name = w.group + "-#{number}"
0
       
0
       w.interval = 30.seconds
0
       
0
       w.uid = config["user"]
0
       w.gid = config["group"]
0
       
0
- w.start = "thin start -C #{file} -o #{i}"
0
+ w.start = "thin start -C #{file} -o #{number}"
0
       w.start_grace = 10.seconds
0
       
0
- w.stop = "thin stop -C #{file} -o #{i}"
0
+ w.stop = "thin stop -C #{file} -o #{number}"
0
       w.stop_grace = 10.seconds
0
       
0
- w.restart = "thin restart -C #{file} -o #{i}"
0
+ w.restart = "thin restart -C #{file} -o #{number}"
0
 
0
       pid_path = config["chdir"] + "/" + config["pid"]
0
       ext = File.extname(pid_path)
0
 
0
- w.pid_file = pid_path.gsub(/#{ext}$/, ".#{i}#{ext}")
0
+ w.pid_file = pid_path.gsub(/#{ext}$/, ".#{number}#{ext}")
0
       
0
       w.behavior(:clean_pid_file)
0
 

Comments

    No one has commented yet.