webroar 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +48 -1
- data/README +11 -14
- data/Rakefile +1 -1
- data/conf/mime_type.yml +172 -166
- data/conf/server_internal_config.yml +30 -8
- data/doc/user-guide.html +294 -153
- data/doc/user-guide.txt +9 -13
- data/lib/command_runner.rb +1 -0
- data/lib/dependencies.rb +18 -15
- data/lib/installer.rb +115 -50
- data/src/admin_panel/app/controllers/admin_controller.rb +1 -15
- data/src/admin_panel/app/controllers/application_controller.rb +2 -2
- data/src/admin_panel/app/controllers/application_specification_controller.rb +2 -1
- data/src/admin_panel/app/controllers/headers_controller.rb +73 -0
- data/src/admin_panel/app/controllers/mail_specification_controller.rb +10 -0
- data/src/admin_panel/app/controllers/server_specification_controller.rb +14 -0
- data/src/admin_panel/app/helpers/admin_helper.rb +0 -85
- data/src/admin_panel/app/models/app.rb +1 -1
- data/src/admin_panel/app/models/application_specification.rb +33 -25
- data/src/admin_panel/app/models/headers.rb +116 -0
- data/src/admin_panel/app/models/mail_specification.rb +20 -5
- data/src/admin_panel/app/models/server_specification.rb +2 -7
- data/src/admin_panel/app/views/admin/configuration.html.erb +10 -5
- data/src/admin_panel/app/views/exceptions/_exception_list_partial.html.erb +4 -4
- data/src/admin_panel/app/views/graph/_graph_page.html.erb +3 -0
- data/src/admin_panel/app/views/headers/_add_expires_text_box.html.erb +35 -0
- data/src/admin_panel/app/views/headers/_expires_by_type_form.html.erb +65 -0
- data/src/admin_panel/app/views/headers/_headers_table.html.erb +113 -0
- data/src/admin_panel/app/views/mail_specification/_current_spec.html.erb +168 -0
- data/src/admin_panel/app/views/{admin → server_specification}/_add_div.html.erb +1 -1
- data/src/admin_panel/config/initializers/application_constants.rb +6 -0
- data/src/admin_panel/lib/control.rb +6 -3
- data/src/admin_panel/lib/scgi.rb +74 -21
- data/src/admin_panel/lib/yaml_writer.rb +51 -17
- data/src/admin_panel/public/javascripts/application.js +20 -1
- data/src/head/wr_access_log.c +2 -2
- data/src/head/wr_application.c +294 -236
- data/src/head/wr_application.h +8 -8
- data/src/head/wr_configurator.c +451 -517
- data/src/head/wr_configurator.h +10 -115
- data/src/head/wr_connection.c +26 -25
- data/src/head/wr_connection.h +2 -3
- data/src/head/wr_controller.c +110 -93
- data/src/head/wr_controller.h +6 -6
- data/src/head/wr_main.c +31 -24
- data/src/head/wr_request.c +70 -93
- data/src/head/wr_request.h +0 -4
- data/src/head/wr_resolver.c +21 -15
- data/src/head/wr_resolver.h +2 -2
- data/src/head/wr_server.c +36 -26
- data/src/head/wr_server.h +5 -5
- data/src/head/wr_worker.c +551 -512
- data/src/head/wr_worker.h +33 -20
- data/src/helper/wr_config.c +316 -0
- data/src/helper/wr_config.h +235 -0
- data/src/helper/wr_helper.h +1 -5
- data/src/helper/wr_logger.c +4 -4
- data/src/helper/wr_scgi.c +3 -4
- data/src/helper/wr_scgi.h +2 -0
- data/src/helper/wr_string.h +2 -2
- data/src/helper/wr_util.c +3 -1
- data/src/helper/wr_util.h +0 -0
- data/src/helper/wr_yaml_parser.c +30 -0
- data/src/helper/wr_yaml_parser.h +1 -0
- data/src/ruby_lib/exception_tracker/instrumentation/action_controller.rb +2 -1
- data/src/ruby_lib/mailer/smtpmail.rb +7 -4
- data/src/ruby_lib/profiler/instrumentation/action_controller.rb +2 -1
- data/src/ruby_lib/profiler/instrumentation/active_record.rb +3 -0
- data/src/ruby_lib/rack/adapter/rails.rb +14 -7
- data/src/ruby_lib/ruby_interface/client.rb +1 -1
- data/src/ruby_lib/ruby_interface/version.rb +2 -2
- data/src/ruby_lib/webroar_app_loader.rb +4 -2
- data/src/worker/wkr_controller.c +200 -140
- data/src/worker/wkr_http.c +14 -28
- data/src/worker/wkr_http.h +4 -4
- data/src/worker/wkr_http_request.c +12 -11
- data/src/worker/wkr_http_request.h +7 -8
- data/src/worker/wkr_http_response.c +10 -14
- data/src/worker/wkr_http_response.h +0 -1
- data/src/worker/wkr_main.c +74 -140
- data/src/worker/wkr_static.c +295 -108
- data/src/worker/wkr_static.h +20 -7
- data/src/worker/worker.c +245 -70
- data/src/worker/worker.h +46 -34
- data/tasks/compile.rake +128 -175
- data/tasks/test.rake +345 -469
- data/test/spec/webroar_command_spec.rb +23 -0
- metadata +173 -43
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/README +0 -34
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/Rakefile +0 -13
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/init.rb +0 -5
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/action_mailer_tls.rb +0 -16
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb +0 -123
- data/src/admin_panel/vendor/plugins/action_mailer_optional_tls/test/tls_test.rb +0 -42
- data/src/head/wr_config.h +0 -165
- data/src/ruby_lib/mailer/action_mailer_tls.rb +0 -16
- data/src/ruby_lib/mailer/smtp_tls.rb +0 -123
data/src/head/wr_config.h
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/* WebROaR - Ruby Application Server - http://webroar.in/
|
|
2
|
-
* Copyright (C) 2009 Goonj LLC
|
|
3
|
-
*
|
|
4
|
-
* This file is part of WebROaR.
|
|
5
|
-
*
|
|
6
|
-
* WebROaR is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* WebROaR is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
-
*/
|
|
19
|
-
#ifndef WR_CONFIG_H_
|
|
20
|
-
#define WR_CONFIG_H_
|
|
21
|
-
|
|
22
|
-
// Default max_worker
|
|
23
|
-
#define WR_MAX_WKR 8
|
|
24
|
-
// Default min_worker
|
|
25
|
-
#define WR_MIN_WKR 4
|
|
26
|
-
// Default request listining port
|
|
27
|
-
#define WR_DEFAULT_SVR_PORT 3000
|
|
28
|
-
|
|
29
|
-
// Maximum value allowed for number of workers
|
|
30
|
-
#define WR_ALLOWED_MAX_WORKERS 20
|
|
31
|
-
|
|
32
|
-
#define WR_MAX_PENDING_WKR 10
|
|
33
|
-
#define WR_MAX_ADD_TIMEOUT_COUNTER 3
|
|
34
|
-
|
|
35
|
-
#ifdef HAVE_GNUTLS
|
|
36
|
-
// Default SSL listining port
|
|
37
|
-
#define WR_DEFAULT_SSL_PORT 443
|
|
38
|
-
#endif
|
|
39
|
-
|
|
40
|
-
// Default application environment
|
|
41
|
-
#define WR_DEFAULT_ENV "production"
|
|
42
|
-
// Admin Panel base uri
|
|
43
|
-
#define WR_ADMIN_PANEL_BASE_URL "/admin-panel"
|
|
44
|
-
// Admin Panel base uri
|
|
45
|
-
#define WR_ADMIN_PANEL_APP_NAME "Admin Panel"
|
|
46
|
-
// Parameter value to enable application analytics
|
|
47
|
-
#define WR_ANALYTICS_ON "enabled"
|
|
48
|
-
|
|
49
|
-
// Appliction to serve static files
|
|
50
|
-
#define WR_STATIC_FILE_SERVER_NAME "static-worker"
|
|
51
|
-
// Minimum number of worker to serve static content
|
|
52
|
-
#define WR_STATIC_SVR_MIN_WKR 4
|
|
53
|
-
// Maximum number of worker to serve static content
|
|
54
|
-
#define WR_STATIC_SVR_MAX_WKR 8
|
|
55
|
-
#define WR_HTTP_FILE_PATH "FILE_PATH"
|
|
56
|
-
#define WR_HTTP_FILE_PATH_LEN 9
|
|
57
|
-
|
|
58
|
-
#define RESP_CODE "RESP_CODE"
|
|
59
|
-
#define RESP_CONTENT_LENGTH "RESP_CONTENT_LEN"
|
|
60
|
-
#define SCGI_CONTENT_LENGTH "CONTENT_LENGTH"
|
|
61
|
-
|
|
62
|
-
/** Folder and file related macros */
|
|
63
|
-
// Server control sock path
|
|
64
|
-
#define WR_CTL_SOCK_PATH "/tmp/webroar_controller_sock"
|
|
65
|
-
// 'webroar-worker' request listining sock path
|
|
66
|
-
#define WR_WKR_SOCK_PATH "/tmp/webroar_worker_sock"
|
|
67
|
-
// Server log file name
|
|
68
|
-
#define WR_LOG_FILE "webroar.log"
|
|
69
|
-
// Server configuration file name
|
|
70
|
-
#define WR_CONF_FILE "config.yml"
|
|
71
|
-
// Path seperator
|
|
72
|
-
#define WR_PATH_SEPARATOR "/"
|
|
73
|
-
// Ruby library folder name
|
|
74
|
-
#define WR_RUBY_LIB_DIR "ruby_lib"
|
|
75
|
-
// Admin Panel folder name
|
|
76
|
-
#define WR_ADMIN_PANEL_DIR "admin_panel"
|
|
77
|
-
// Source folder name
|
|
78
|
-
#define WR_SRC_DIR "src"
|
|
79
|
-
// Executable directory name
|
|
80
|
-
#define WR_BIN_DIR "bin"
|
|
81
|
-
// File to store Server control port or sock path
|
|
82
|
-
#define WR_TMP_SOCK_FILE "/tmp/webroar.sock"
|
|
83
|
-
// File to store process pid having high resident memory
|
|
84
|
-
#define WR_HIGH_RSS_PID_FILE "/var/run/high_rss.pid"
|
|
85
|
-
// Executable file name used to create workers
|
|
86
|
-
#define WR_WKR_BIN "webroar-worker"
|
|
87
|
-
// File to store Server process id
|
|
88
|
-
#define WR_PID_FILE "/var/run/webroar.pid"
|
|
89
|
-
#define WR_SERVER "WebROaR"
|
|
90
|
-
#define WR_VERSION "0.3.1"
|
|
91
|
-
#define WR_MIME_TYPE_PATH "/conf/mime_type.yml"
|
|
92
|
-
#define WR_CONF_PATH "/conf/config.yml"
|
|
93
|
-
#define WR_SERVER_INTERNAL_CONF_PATH "/conf/server_internal_config.yml"
|
|
94
|
-
|
|
95
|
-
/** Private macros */
|
|
96
|
-
/** Application level macros */
|
|
97
|
-
// Pending request queue size
|
|
98
|
-
#define WR_MSG_QUE_SIZE 2048
|
|
99
|
-
// Ratio of pending request and active worker required to add worker
|
|
100
|
-
#define WR_MAX_REQ_RATIO 1
|
|
101
|
-
// Ratio of pending request and active worker required to remove worker
|
|
102
|
-
#define WR_MIN_REQ_RATIO 3
|
|
103
|
-
// Number of seconds with ratio higher than WR_MAX_REQ_RATIO to add worker.
|
|
104
|
-
#define WR_HIGH_LOAD_LIMIT 2.
|
|
105
|
-
// Number of seconds with ratio lower than WR_MIN_REQ_RATIO to remove worker.
|
|
106
|
-
#define WR_LOW_LOAD_LIMIT 600.
|
|
107
|
-
// Number of seconds to wait for add signal from worker after incrementing the active worker count
|
|
108
|
-
#define WR_WKR_ADD_TIMEOUT 25.
|
|
109
|
-
// Number of seconds to wait for response before killing worker.
|
|
110
|
-
#define WR_WKR_KILL_TIMEOUT 10.
|
|
111
|
-
|
|
112
|
-
// Number of seconds worker can remain idle, before sending PING.
|
|
113
|
-
#define WR_WKR_IDLE_TIME 60.
|
|
114
|
-
// Number of seconds head should wait for PING reply.
|
|
115
|
-
#define WR_PING_WAIT_TIME 15.
|
|
116
|
-
// Number of time head should try sending PING before killing worker.
|
|
117
|
-
#define WR_PING_TRIALS 2
|
|
118
|
-
|
|
119
|
-
//Number of seconds head would wait before closing the connection for kepp-alive request
|
|
120
|
-
#define WR_SVR_KEEP_ALIVE 1
|
|
121
|
-
#define WR_SVR_KEEP_ALIVE_TIME 15.
|
|
122
|
-
|
|
123
|
-
// Request body more than this size sholud store in file
|
|
124
|
-
#define WR_REQ_BODY_MAX_SIZE 1024*64
|
|
125
|
-
// Bufffer size to store request headers in 'webroar-worker'
|
|
126
|
-
#define WR_BUF_SIZE (1024 * 10)
|
|
127
|
-
|
|
128
|
-
#define WR_TINY_STR_LEN 16
|
|
129
|
-
#define WR_SHORT_STR_LEN 32
|
|
130
|
-
#define WR_STR_LEN 64
|
|
131
|
-
#define WR_LONG_STR_LEN 128
|
|
132
|
-
#define WR_LONG_LONG_STR_LEN 512
|
|
133
|
-
#define WR_FILE_PATH_LEN 1024
|
|
134
|
-
|
|
135
|
-
#define WR_DEFAULT_PREFIX_HASH 5381
|
|
136
|
-
#define WR_MSG_SIZE 1024
|
|
137
|
-
|
|
138
|
-
#define WR_REQ_CONN_POOL 10
|
|
139
|
-
#define WR_CTL_CONN_POOL 5
|
|
140
|
-
|
|
141
|
-
/** Request size limitation **/
|
|
142
|
-
#define WR_MAX_REQ_URI_LEN 12288 /* 12*1024 */
|
|
143
|
-
#define WR_MAX_REQ_PATH_LEN 1024
|
|
144
|
-
#define WR_MAX_REQ_FRAG_LEN 1024
|
|
145
|
-
#define WR_MAX_REQ_QRY_STR_LEN 10240 /* 10*1024 */
|
|
146
|
-
#define WR_MAX_REQ_FIELD_NAME_LEN 256 /* */
|
|
147
|
-
#define WR_MAX_REQ_FIELD_VALUE_LEN 81920 /* 80*1024 */
|
|
148
|
-
#define WR_MAX_REQ_HEADER_LEN 112640 /* (1024 * (80 + 32)) */
|
|
149
|
-
#define WR_MAX_REQ_HEADER_NO 40
|
|
150
|
-
|
|
151
|
-
#define WR_STACKTRACE_SIZE 50
|
|
152
|
-
|
|
153
|
-
#ifdef L_DEBUG
|
|
154
|
-
#define WR_CONN_ID "CONNECTION_ID"
|
|
155
|
-
#define WR_CONN_ID_LEN 19
|
|
156
|
-
#define WR_REQ_ID "REQ_ID"
|
|
157
|
-
#define WR_REQ_ID_LEN 12
|
|
158
|
-
#endif
|
|
159
|
-
|
|
160
|
-
#define WR_MAX_HOST_NAMES 16
|
|
161
|
-
|
|
162
|
-
#define TRUE 1
|
|
163
|
-
#define FALSE 0
|
|
164
|
-
|
|
165
|
-
#endif /*WR_CONFIG_H_*/
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require "rubygems"
|
|
2
|
-
require "action_mailer"
|
|
3
|
-
|
|
4
|
-
ActionMailer::Base.class_eval do
|
|
5
|
-
private
|
|
6
|
-
def perform_delivery_smtp(mail)
|
|
7
|
-
destinations = mail.destinations
|
|
8
|
-
mail.ready_to_send
|
|
9
|
-
|
|
10
|
-
Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
|
|
11
|
-
smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication],
|
|
12
|
-
smtp_settings[:tls], smtp_settings[:ssl]) do |smtp|
|
|
13
|
-
smtp.sendmail(mail.encoded, mail.from, destinations)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
require "openssl"
|
|
2
|
-
require "net/smtp"
|
|
3
|
-
|
|
4
|
-
Net::SMTP.class_eval do
|
|
5
|
-
|
|
6
|
-
def self.start( address, port = nil,
|
|
7
|
-
helo = 'localhost.localdomain',
|
|
8
|
-
user = nil, secret = nil, authtype = nil, use_tls = false,
|
|
9
|
-
use_ssl = false, &block) # :yield: smtp
|
|
10
|
-
new(address, port).start(helo, user, secret, authtype, use_tls, use_ssl, &block)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def start( helo = 'localhost.localdomain',
|
|
14
|
-
user = nil, secret = nil, authtype = nil, use_tls = false, use_ssl = false ) # :yield: smtp
|
|
15
|
-
start_method = use_tls ? :do_tls_start : use_ssl ? :do_ssl_start : :do_start
|
|
16
|
-
if block_given?
|
|
17
|
-
begin
|
|
18
|
-
send start_method, helo, user, secret, authtype
|
|
19
|
-
return yield(self)
|
|
20
|
-
ensure
|
|
21
|
-
do_finish
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
send start_method, helo, user, secret, authtype
|
|
25
|
-
return self
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def do_tls_start(helodomain, user, secret, authtype)
|
|
32
|
-
raise IOError, 'SMTP session already started' if @started
|
|
33
|
-
|
|
34
|
-
if VERSION == '1.8.6'
|
|
35
|
-
check_auth_args user, secret, authtype if user or secret
|
|
36
|
-
elsif VERSION == '1.8.7'
|
|
37
|
-
check_auth_args user, secret
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
|
|
41
|
-
@socket = Net::InternetMessageIO.new(sock)
|
|
42
|
-
@socket.read_timeout = 60 #@read_timeout
|
|
43
|
-
@socket.debug_output = STDERR #@debug_output
|
|
44
|
-
|
|
45
|
-
check_response(critical { recv_response() })
|
|
46
|
-
do_helo(helodomain)
|
|
47
|
-
|
|
48
|
-
raise 'openssl library not installed' unless defined?(OpenSSL)
|
|
49
|
-
starttls
|
|
50
|
-
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
|
51
|
-
ssl.sync_close = true
|
|
52
|
-
ssl.connect
|
|
53
|
-
@socket = Net::InternetMessageIO.new(ssl)
|
|
54
|
-
@socket.read_timeout = 60 #@read_timeout
|
|
55
|
-
@socket.debug_output = STDERR #@debug_output
|
|
56
|
-
do_helo(helodomain)
|
|
57
|
-
|
|
58
|
-
authenticate user, secret, authtype if user
|
|
59
|
-
@started = true
|
|
60
|
-
ensure
|
|
61
|
-
unless @started
|
|
62
|
-
# authentication failed, cancel connection.
|
|
63
|
-
@socket.close if not @started and @socket and not @socket.closed?
|
|
64
|
-
@socket = nil
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def do_ssl_start(helodomain, user, secret, authtype)
|
|
69
|
-
raise IOError, 'SMTP session already started' if @started
|
|
70
|
-
check_auth_args user, secret, authtype if user or secret
|
|
71
|
-
|
|
72
|
-
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
|
|
73
|
-
raise 'openssl library not installed' unless defined?(OpenSSL)
|
|
74
|
-
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
|
75
|
-
ssl.sync_close = true
|
|
76
|
-
ssl.connect
|
|
77
|
-
@socket = Net::InternetMessageIO.new(ssl)
|
|
78
|
-
@socket.read_timeout = 60 #@read_timeout
|
|
79
|
-
@socket.debug_output = STDERR #@debug_output
|
|
80
|
-
|
|
81
|
-
check_response(critical { recv_response() })
|
|
82
|
-
do_helo(helodomain)
|
|
83
|
-
|
|
84
|
-
do_helo(helodomain)
|
|
85
|
-
|
|
86
|
-
authenticate user, secret, authtype if user
|
|
87
|
-
@started = true
|
|
88
|
-
ensure
|
|
89
|
-
unless @started
|
|
90
|
-
# authentication failed, cancel connection.
|
|
91
|
-
@socket.close if not @started and @socket and not @socket.closed?
|
|
92
|
-
@socket = nil
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def do_helo(helodomain)
|
|
97
|
-
begin
|
|
98
|
-
if @esmtp
|
|
99
|
-
ehlo helodomain
|
|
100
|
-
else
|
|
101
|
-
helo helodomain
|
|
102
|
-
end
|
|
103
|
-
rescue Net::ProtocolError
|
|
104
|
-
if @esmtp
|
|
105
|
-
@esmtp = false
|
|
106
|
-
@error_occured = false
|
|
107
|
-
retry
|
|
108
|
-
end
|
|
109
|
-
raise
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def starttls
|
|
114
|
-
getok('STARTTLS')
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def quit
|
|
118
|
-
begin
|
|
119
|
-
getok('QUIT')
|
|
120
|
-
rescue EOFError, OpenSSL::SSL::SSLError
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|