[Cherokee-commits] [4275] cherokee/branches/adminctk/admin: Implements the "Advanced" section.
SVN at cherokee-project.com
SVN at cherokee-project.com
Fri Feb 19 12:03:19 CET 2010
Revision: 4275
http://svn.cherokee-project.com/changeset/4275
Author: alo
Date: 2010-02-19 12:03:19 +0100 (Fri, 19 Feb 2010)
Log Message:
-----------
Implements the "Advanced" section.
Modified Paths:
--------------
cherokee/branches/adminctk/admin/Cherokee.py
cherokee/branches/adminctk/admin/PageGeneral.py
cherokee/branches/adminctk/admin/server.py
Added Paths:
-----------
cherokee/branches/adminctk/admin/PageAdvanced.py
Modified: cherokee/branches/adminctk/admin/Cherokee.py
===================================================================
--- cherokee/branches/adminctk/admin/Cherokee.py 2010-02-19 09:59:33 UTC (rev 4274)
+++ cherokee/branches/adminctk/admin/Cherokee.py 2010-02-19 11:03:19 UTC (rev 4275)
@@ -161,7 +161,7 @@
return None
-class Modules:
+class Support:
def __init__ (self):
# Get server info
try:
@@ -195,6 +195,15 @@
def has_polling_method (self, name):
return name in self.get_info_section("Polling methods")
+ def filter_polling_methods (self, methods_list):
+ polling_methods = []
+
+ for name, desc in methods_list:
+ if not name or self.has_polling_method(name):
+ polling_methods.append((name, desc))
+
+ return polling_methods
+
def filter_available (self, module_list):
new_module_list = []
@@ -215,7 +224,7 @@
#
pid = PID()
server = Server()
-modules = Modules()
+support = Support()
#
Added: cherokee/branches/adminctk/admin/PageAdvanced.py
===================================================================
--- cherokee/branches/adminctk/admin/PageAdvanced.py (rev 0)
+++ cherokee/branches/adminctk/admin/PageAdvanced.py 2010-02-19 11:03:19 UTC (rev 4275)
@@ -0,0 +1,178 @@
+# -*- coding: utf-8 -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro at alobbs.com>
+#
+# Copyright (C) 2001-2010 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+import Page
+import Cherokee
+import validations
+
+from consts import *
+from configured import *
+
+URL_BASE = '/advanced'
+URL_APPLY = '/advanced/apply'
+
+VALIDATIONS = [
+ ("server!fdlimit", validations.is_positive_int),
+ ("server!pid_file", (validations.parent_is_dir, 'cfg')),
+ ("server!sendfile_min", validations.is_positive_int),
+ ("server!sendfile_max", validations.is_positive_int),
+ ('server!panic_action', (validations.is_local_file_exists, 'cfg')),
+ ('server!listen_queue', validations.is_positive_int),
+ ('server!max_connection_reuse', validations.is_positive_int),
+ ('server!log_flush_lapse', validations.is_positive_int),
+ ('server!keepalive_max_requests', validations.is_positive_int),
+ ("server!keepalive$", validations.is_boolean),
+ ("server!thread_number", validations.is_positive_int),
+ ("server!nonces_cleanup_lapse", validations.is_positive_int),
+ ("server!iocache$", validations.is_boolean),
+ ("server!iocache!max_size", validations.is_positive_int),
+ ("server!iocache!min_file_size", validations.is_positive_int),
+ ("server!iocache!max_file_size", validations.is_positive_int),
+ ("server!iocache!lasting_stat", validations.is_positive_int),
+ ("server!iocache!lasting_mmap", validations.is_positive_int),
+ ("server!tls!dh_param512", (validations.is_local_file_exists, 'cfg')),
+ ("server!tls!dh_param1024", (validations.is_local_file_exists, 'cfg')),
+ ("server!tls!dh_param2048", (validations.is_local_file_exists, 'cfg')),
+ ("server!tls!dh_param4096", (validations.is_local_file_exists, 'cfg'))
+]
+
+WARNING = N_("""<p><b>WARNING</b>: This section contains advanced
+configuration parameters. Changing things is not recommended unless
+you really know what you are doing.</p>""")
+
+NOTE_THREAD = N_('Defines which thread policy the OS should apply to the server.')
+NOTE_THREAD_NUM = N_('If empty, Cherokee will calculate a default number.')
+NOTE_FD_NUM = N_('It defines how many file descriptors the server should handle. Default is the number showed by ulimit -n')
+NOTE_POLLING = N_('Allows to choose the internal file descriptor polling method.')
+NOTE_SENDFILE_MIN = N_('Minimum size of a file to use sendfile(). Default: 32768 Bytes.')
+NOTE_SENDFILE_MAX = N_('Maximum size of a file to use sendfile(). Default: 2 GB.')
+NOTE_PANIC_ACTION = N_('Name a program that will be called if, by some reason, the server fails. Default: <em>cherokee-panic</em>.')
+NOTE_PID_FILE = N_('Path of the PID file. If empty, the file will not be created.')
+NOTE_LISTEN_Q = N_('Max. length of the incoming connection queue.')
+NOTE_REUSE_CONNS = N_('Set the number of how many internal connections can be held for reuse by each thread. Default 20.')
+NOTE_FLUSH_TIME = N_('Sets the number of seconds between log consolidations (flushes). Default: 10 seconds.')
+NOTE_NONCES_TIME = N_('Time lapse (in seconds) between Nonce cache clean ups.')
+NOTE_KEEPALIVE = N_('Enables the server-wide keep-alive support. It increases the performance. It is usually set on.')
+NOTE_KEEPALIVE_RS = N_('Maximum number of HTTP requests that can be served by each keepalive connection.')
+NOTE_CHUNKED = N_('Allows the server to use Chunked encoding to try to keep Keep-Alive enabled.')
+NOTE_IO_ENABLED = N_('Activate or deactivate the I/O cache globally.')
+NOTE_IO_SIZE = N_('Number of pages that the cache should handle.')
+NOTE_IO_MIN_SIZE = N_('Files under this size will not be cached.')
+NOTE_IO_MAX_SIZE = N_('Files over this size will not be cached.')
+NOTE_IO_LAST_STAT = N_('How long (in seconds) the file information should last cached without refreshing it.')
+NOTE_IO_LAST_MMAP = N_('How long (in seconds) the file content should last cached.')
+NOTE_DH512 = N_('Path to a Diffie Hellman (DH) parameters PEM file: 512 bits.')
+NOTE_DH1024 = N_('Path to a Diffie Hellman (DH) parameters PEM file: 1024 bits.')
+NOTE_DH2048 = N_('Path to a Diffie Hellman (DH) parameters PEM file: 2048 bits.')
+NOTE_DH4096 = N_('Path to a Diffie Hellman (DH) parameters PEM file: 4096 bits.')
+
+HELPS = [('config_advanced', N_('Advanced'))]
+
+def apply():
+ # Modifications
+ for k in CTK.post:
+ CTK.cfg[k] = CTK.post[k]
+ return {'ret': 'ok'}
+
+
+class ConnectionsWidget (CTK.Container):
+ def __init__ (self):
+ CTK.Container.__init__ (self)
+
+ table = CTK.PropsAuto(URL_APPLY)
+ self += table
+ table.Add (_('Keep Alive'), CTK.CheckCfg('server!keepalive', True), _(NOTE_KEEPALIVE))
+ table.Add (_('Max keepalive reqs'), CTK.TextCfg('server!keepalive_max_requests'), _(NOTE_KEEPALIVE_RS))
+ table.Add (_('Chunked Encoding'), CTK.CheckCfg('server!chunked_encoding', True), _(NOTE_CHUNKED))
+ table.Add (_('Polling Method'), CTK.ComboCfg('server!poll_method', Cherokee.support.filter_polling_methods(POLL_METHODS)), _(NOTE_POLLING))
+ table.Add (_('Sendfile min size'), CTK.TextCfg('server!sendfile_min', True), _(NOTE_SENDFILE_MIN))
+ table.Add (_('Sendfile max size'), CTK.TextCfg('server!sendfile_max', True), _(NOTE_SENDFILE_MAX))
+
+class ResourcesWidget (CTK.Container):
+ def __init__ (self):
+ CTK.Container.__init__ (self)
+
+ table = CTK.PropsAuto(URL_APPLY)
+ self += table
+ table.Add (_('Thread Number'), CTK.TextCfg('server!thread_number', True), _(NOTE_THREAD_NUM))
+ table.Add (_('Thread Policy'), CTK.ComboCfg('server!thread_policy', THREAD_POLICY), _(NOTE_THREAD))
+ table.Add (_('File descriptors'), CTK.TextCfg('server!fdlimit', True), _(NOTE_FD_NUM))
+ table.Add (_('Listening queue length'), CTK.TextCfg('server!listen_queue', True), _(NOTE_LISTEN_Q))
+ table.Add (_('Reuse connections'), CTK.TextCfg('server!max_connection_reuse', True), _(NOTE_REUSE_CONNS))
+ table.Add (_('Log flush time'), CTK.TextCfg('server!log_flush_lapse', True), _(NOTE_FLUSH_TIME))
+ table.Add (_('Nonces clean up time'), CTK.TextCfg('server!nonces_cleanup_lapse', True), _(NOTE_NONCES_TIME))
+
+class IOCacheWidget (CTK.Container):
+ def __init__ (self):
+ CTK.Container.__init__ (self)
+
+ table = CTK.PropsAuto(URL_APPLY)
+ self += table
+ table.Add (_('Status'), CTK.CheckCfg('server!iocache', True), _(NOTE_IO_ENABLED))
+ table.Add (_('Max pages'), CTK.TextCfg('server!iocache!max_size', True), _(NOTE_IO_SIZE))
+ table.Add (_('File Min Size'), CTK.TextCfg('server!iocache!min_file_size', True), _(NOTE_IO_MIN_SIZE))
+ table.Add (_('File Max Size'), CTK.TextCfg('server!iocache!max_file_size', True), _(NOTE_IO_MAX_SIZE))
+ table.Add (_('Lasting: stat'), CTK.TextCfg('server!iocache!lasting_stat', True), _(NOTE_IO_LAST_STAT))
+ table.Add (_('Lasting: mmap'), CTK.TextCfg('server!iocache!lasting_mmap', True), _(NOTE_IO_LAST_MMAP))
+
+class SpecialFilesWidget (CTK.Container):
+ def __init__ (self):
+ CTK.Container.__init__ (self)
+
+ table = CTK.PropsAuto(URL_APPLY)
+ self += table
+ table.Add (_('Panic action'), CTK.TextCfg('server!panic_action', True), _(NOTE_PANIC_ACTION))
+ table.Add (_('PID file'), CTK.TextCfg('server!pid_file', True), _(NOTE_PID_FILE))
+
+class TLSWidget (CTK.Container):
+ def __init__ (self):
+ CTK.Container.__init__ (self)
+
+ table = CTK.PropsAuto(URL_APPLY)
+ self += table
+ table.Add (_('DH parameters: 512 bits'), CTK.TextCfg('server!tls!dh_param512', True), _(NOTE_DH512))
+ table.Add (_('DH parameters: 1024 bits'), CTK.TextCfg('server!tls!dh_param1024', True), _(NOTE_DH1024))
+ table.Add (_('DH parameters: 2048 bits'), CTK.TextCfg('server!tls!dh_param2048', True), _(NOTE_DH2048))
+ table.Add (_('DH parameters: 4096 bits'), CTK.TextCfg('server!tls!dh_param4096', True), _(NOTE_DH4096))
+
+
+class Render():
+ def __call__ (self):
+ tabs = CTK.Tab()
+ tabs.Add (_('Connections'), ConnectionsWidget())
+ tabs.Add (_('Resources'), ResourcesWidget())
+ tabs.Add (_('I/O cache'), IOCacheWidget())
+ tabs.Add (_('Special Files'), SpecialFilesWidget())
+ tabs.Add (_('TLS'), TLSWidget())
+
+ page = Page.Base(_('Advanced'), helps=HELPS)
+ page += CTK.RawHTML("<h1>%s</h1>" %(_('General Settings')))
+ page += tabs
+
+ return page.Render()
+
+
+CTK.publish ('^%s'%(URL_BASE), Render)
+CTK.publish ('^%s'%(URL_APPLY), apply, validation=VALIDATIONS, method="POST")
Modified: cherokee/branches/adminctk/admin/PageGeneral.py
===================================================================
--- cherokee/branches/adminctk/admin/PageGeneral.py 2010-02-19 09:59:33 UTC (rev 4274)
+++ cherokee/branches/adminctk/admin/PageGeneral.py 2010-02-19 11:03:19 UTC (rev 4275)
@@ -79,7 +79,7 @@
table = CTK.PropsAuto (URL_APPLY)
table.Add (_('IPv6'), CTK.CheckCfg('server!ipv6', True), _(NOTE_IPV6))
- table.Add (_('SSL/TLS back-end'), CTK.ComboCfg('server!tls', Cherokee.modules.filter_available(CRYPTORS)), _(NOTE_TLS))
+ table.Add (_('SSL/TLS back-end'), CTK.ComboCfg('server!tls', Cherokee.support.filter_available(CRYPTORS)), _(NOTE_TLS))
self += CTK.RawHTML ("<h2>%s</h2>" %(_('Support')))
self += CTK.Indenter(table)
@@ -90,14 +90,14 @@
self += CTK.Indenter(table)
table = CTK.PropsAuto (URL_APPLY)
- modul = CTK.PluginSelector('server!collector', Cherokee.modules.filter_available(COLLECTORS))
+ modul = CTK.PluginSelector('server!collector', Cherokee.support.filter_available(COLLECTORS))
table.Add (_('Graphs Type'), modul.selector_widget, _(NOTE_COLLECTORS), False)
self += CTK.RawHTML ("<h2>%s</h2>" %(_('Information Collector')))
self += CTK.Indenter(table)
self += CTK.Indenter(modul)
table = CTK.PropsAuto (URL_APPLY)
- modul = CTK.PluginSelector('server!post_track', Cherokee.modules.filter_available(POST_TRACKERS))
+ modul = CTK.PluginSelector('server!post_track', Cherokee.support.filter_available(POST_TRACKERS))
table.Add (_('Upload Tracking'), modul.selector_widget, _(NOTE_POST_TRACKS), False)
self += CTK.RawHTML ("<h2>%s</h2>" %(_('Upload Tracking')))
self += CTK.Indenter(table)
Modified: cherokee/branches/adminctk/admin/server.py
===================================================================
--- cherokee/branches/adminctk/admin/server.py 2010-02-19 09:59:33 UTC (rev 4274)
+++ cherokee/branches/adminctk/admin/server.py 2010-02-19 11:03:19 UTC (rev 4275)
@@ -97,6 +97,7 @@
# Import the Pages
import PageIndex
import PageGeneral
+ import PageAdvanced
# Run
run (scgi_port)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.octality.com/pipermail/cherokee-commits/attachments/20100219/3d34125a/attachment-0001.htm
More information about the Cherokee-commits
mailing list