[CalendarServer-changes] [12870] CalendarServer/trunk/calendarserver/webadmin
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 10 15:58:24 PDT 2014
Revision: 12870
http://trac.calendarserver.org//changeset/12870
Author: wsanchez at apple.com
Date: 2014-03-10 15:58:24 -0700 (Mon, 10 Mar 2014)
Log Message:
-----------
Add server configuration page.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/webadmin/landing.py
CalendarServer/trunk/calendarserver/webadmin/landing.xhtml
Added Paths:
-----------
CalendarServer/trunk/calendarserver/webadmin/config.py
CalendarServer/trunk/calendarserver/webadmin/config.xhtml
Added: CalendarServer/trunk/calendarserver/webadmin/config.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/config.py (rev 0)
+++ CalendarServer/trunk/calendarserver/webadmin/config.py 2014-03-10 22:58:24 UTC (rev 12870)
@@ -0,0 +1,132 @@
+# -*- test-case-name: calendarserver.webadmin.test.test_landing -*-
+##
+# Copyright (c) 2009-2014 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Calendar Server Configuration UI.
+"""
+
+__all__ = [
+ "ConfigurationResource",
+]
+
+from twisted.web.template import renderer, tags as html
+
+from .resource import PageElement, TemplateResource
+
+
+
+class ConfigurationPageElement(PageElement):
+ """
+ Configuration management page element.
+ """
+
+ def __init__(self, configuration):
+ PageElement.__init__(self, u"config")
+
+ self.configuration = configuration
+
+
+ def pageSlots(self):
+ slots = {
+ u"title": u"Server Configuration",
+ }
+
+ for key in (
+ "ServerHostName",
+ "HTTPPort",
+ "SSLPort",
+ "BindAddresses",
+ "BindHTTPPorts",
+ "BindSSLPorts",
+ "EnableSSL",
+ "RedirectHTTPToHTTPS",
+ "SSLCertificate",
+ "SSLPrivateKey",
+ "SSLAuthorityChain",
+ "SSLMethod",
+ "SSLCiphers",
+ "EnableCalDAV",
+ "EnableCardDAV",
+ "ServerRoot",
+ "EnableSSL",
+ "UserQuota",
+ "MaxCollectionsPerHome",
+ "MaxResourcesPerCollection",
+ "MaxResourceSize",
+ "UserName",
+ "GroupName",
+ "ProcessType",
+ "MultiProcess.MinProcessCount",
+ "MultiProcess.ProcessCount",
+ "MaxRequests",
+ ):
+ value = self.configuration
+
+ for key in key.split("."):
+ value = getattr(value, key)
+
+ def describe(value):
+ if value == u"":
+ return u"(empty string)"
+
+ if value is None:
+ return u"(no value)"
+
+ return html.code(unicode(value))
+
+ if isinstance(value, list):
+ result = []
+ for item in value:
+ result.append(describe(item))
+ result.append(html.br())
+ result.pop()
+
+ else:
+ result = describe(value)
+
+ slots[key] = result
+
+ return slots
+
+
+ @renderer
+ def log_level_row(self, request, tag):
+ def rowsForNamespaces(namespaces):
+ for namespace in namespaces:
+ yield tag.clone().fillSlots(
+ log_level_name="** name **",
+ log_level_value="** value **",
+ )
+
+ namespaces = ()
+
+ return rowsForNamespaces(namespaces)
+
+
+
+class ConfigurationResource(TemplateResource):
+ """
+ Configuration management page resource.
+ """
+
+ addSlash = False
+
+
+ def __init__(self, configuration):
+ TemplateResource.__init__(
+ self, lambda: ConfigurationPageElement(configuration)
+ )
Added: CalendarServer/trunk/calendarserver/webadmin/config.xhtml
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/config.xhtml (rev 0)
+++ CalendarServer/trunk/calendarserver/webadmin/config.xhtml 2014-03-10 22:58:24 UTC (rev 12870)
@@ -0,0 +1,261 @@
+<!DOCTYPE html>
+<html
+ xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
+ t:render="main"
+>
+
+ <head>
+ <title><t:slot name="title" /></title>
+ <link t:render="stylesheet" />
+
+ <style>
+
+ .config_key {
+ width: 20%;
+ }
+ .config_value {
+ width: 40%;
+ }
+
+ </style>
+
+ </head>
+
+ <body>
+
+ <h1><t:slot name="title" /></h1>
+
+
+ <h2>Public Network Address Information</h2>
+
+ <table>
+ <caption>
+ These settings determine how one accesses the server on the Internet.
+ This may or may not be the same address that the server listens to itself.
+ This may, for example, be the address for a load balancer which forwards requests to the server.
+ </caption>
+ <tbody>
+ <tr>
+ <th class="config_key">Host Name</th>
+ <td class="config_value"><t:slot name="ServerHostName" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">HTTP Port</th>
+ <td class="config_value"><t:slot name="HTTPPort" /></td>
+ <td class="comment">
+ For most servers, this should be <code>80</code>.
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">HTTPS (TLS) Port</th>
+ <td class="config_value"><t:slot name="SSLPort" /></td>
+ <td class="comment">
+ For most servers, this should be <code>443</code>.
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Bound Network Address Information</h2>
+
+ <table>
+ <caption>
+ These settings determine the actual network address that the server binds to.
+ By default, this is the same as the public network address information provided above.
+ </caption>
+ <tbody>
+ <tr>
+ <th class="config_key">IP Addresses</th>
+ <td class="config_value"><t:slot name="BindAddresses" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">HTTP Ports</th>
+ <td class="config_value"><t:slot name="BindHTTPPorts" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">TLS Ports</th>
+ <td class="config_value"><t:slot name="BindSSLPorts" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Transport Layer Security (TLS) Settings</h2>
+
+ <table>
+ <caption>
+ These settings determine how one accesses the server on the Internet.
+ This may or may not be the same address that the server listens to itself.
+ This may, for example, be the address for a load balancer which forwards requests to the server.
+ </caption>
+ <tbody>
+ <tr>
+ <th class="config_key">Enable HTTPS (TLS)</th>
+ <td class="config_value"><t:slot name="EnableSSL" /></td>
+ <td class="comment">
+ It is strongly advised that TLS is enabled on production servers.
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">Redirect To HTTPS</th>
+ <td class="config_value"><t:slot name="RedirectHTTPToHTTPS" /></td>
+ <td class="comment">
+ Redirect clients to the secure port (recommended).
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">TLS Certificate</th>
+ <td class="config_value"><t:slot name="SSLCertificate" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">TLS Private Key</th>
+ <td class="config_value"><t:slot name="SSLPrivateKey" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">TLS Authority Chain</th>
+ <td class="config_value"><t:slot name="SSLAuthorityChain" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">TLS Methods</th>
+ <td class="config_value"><t:slot name="SSLMethod" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">TLS Ciphers</th>
+ <td class="config_value"><t:slot name="SSLCiphers" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Service Settings</h2>
+
+ <table>
+ <caption />
+ <tbody>
+ <tr>
+ <th class="config_key">Enable CalDAV</th>
+ <td class="config_value"><t:slot name="EnableCalDAV" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Enable CardDAV</th>
+ <td class="config_value"><t:slot name="EnableCardDAV" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Data Store</h2>
+
+ <table>
+ <caption />
+ <tbody>
+ <tr>
+ <th class="config_key">Server Root</th>
+ <td class="config_value"><t:slot name="ServerRoot" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Data Source Name</th>
+ <td class="config_value"><t:slot name="EnableSSL" /></td>
+ <td class="comment">
+ Database connection string.
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">Attachment Quota (Bytes)</th>
+ <td class="config_value"><t:slot name="UserQuota" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Max # Collections Per Account</th>
+ <td class="config_value"><t:slot name="MaxCollectionsPerHome" /></td>
+ <td class="comment">
+ Collections include calendars and address books.
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">Max # Objects Per Collection</th>
+ <td class="config_value"><t:slot name="MaxResourcesPerCollection" /></td>
+ <td class="comment">
+ Objects include events, to-dos and contacts.
+ </td>
+ </tr>
+ <tr>
+ <th class="config_key">Max Object Size</th>
+ <td class="config_value"><t:slot name="MaxResourceSize" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Logging</h2>
+
+ <table>
+ <caption />
+ <tbody>
+ <tr t:render="log_level_row">
+ <th class="config_key"><t:slot name="log_level_name" /></th>
+ <td class="config_value"><t:slot name="log_level_value" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ <h2>Process Management</h2>
+
+ <table>
+ <caption />
+ <tbody>
+ <tr>
+ <th class="config_key">User Name</th>
+ <td class="config_value"><t:slot name="UserName" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Group Name</th>
+ <td class="config_value"><t:slot name="GroupName" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Process Type</th>
+ <td class="config_value"><t:slot name="ProcessType" /></td>
+ <td class="comment" />
+ </tr>
+<!--
+ <tr>
+ <th class="config_key">Min Process Count</th>
+ <td class="config_value"><t:slot name="MultiProcess.MinProcessCount" /></td>
+ <td class="comment" />
+ </tr>
+ <tr>
+ <th class="config_key">Max Process Count</th>
+ <td class="config_value"><t:slot name="MultiProcess.ProcessCount" /></td>
+ <td class="comment" />
+ </tr>
+ -->
+ <tr>
+ <th class="config_key">Max Requests Per Process</th>
+ <td class="config_value"><t:slot name="MaxRequests" /></td>
+ <td class="comment" />
+ </tr>
+ </tbody>
+ </table>
+
+
+ </body>
+
+</html>
Modified: CalendarServer/trunk/calendarserver/webadmin/landing.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/landing.py 2014-03-10 22:58:02 UTC (rev 12869)
+++ CalendarServer/trunk/calendarserver/webadmin/landing.py 2014-03-10 22:58:24 UTC (rev 12870)
@@ -26,14 +26,9 @@
# from twisted.web.template import renderer
from .resource import PageElement, TemplateResource
-from .logs import LogsResource
-from .principals import PrincipalsResource
-from .work import WorkMonitorResource
-from . import logs, principals, work
-
class WebAdminLandingPageElement(PageElement):
"""
Web administration langing page element.
@@ -61,14 +56,25 @@
def __init__(self, path, root, directory, store, principalCollections=()):
TemplateResource.__init__(self, WebAdminLandingPageElement)
+ from twistedcaldav.config import config as configuration
+
+ self.configuration = configuration
self.directory = directory
self.store = store
# self._path = path
# self._root = root
# self._principalCollections = principalCollections
+ from .config import ConfigurationResource
+ self.putChild(u"config", ConfigurationResource(configuration))
+
+ from .principals import PrincipalsResource
+ self.putChild(u"principals", PrincipalsResource(directory))
+
+ from .logs import LogsResource
self.putChild(u"logs", LogsResource())
- self.putChild(u"principals", PrincipalsResource(directory))
+
+ from .work import WorkMonitorResource
self.putChild(u"work", WorkMonitorResource(store))
@@ -85,14 +91,20 @@
# re-loaded for each request.
#
- if name == u"logs":
- reload(logs)
- return logs.LogsResource()
+ from . import config, principals, logs, work
+ if name == u"config":
+ reload(config)
+ return config.ConfigurationResource(self.configuration)
+
elif name == u"principals":
reload(principals)
return principals.PrincipalsResource(self.directory)
+ elif name == u"logs":
+ reload(logs)
+ return logs.LogsResource()
+
elif name == u"work":
reload(work)
return work.WorkMonitorResource(self.store)
Modified: CalendarServer/trunk/calendarserver/webadmin/landing.xhtml
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/landing.xhtml 2014-03-10 22:58:02 UTC (rev 12869)
+++ CalendarServer/trunk/calendarserver/webadmin/landing.xhtml 2014-03-10 22:58:24 UTC (rev 12870)
@@ -11,8 +11,12 @@
<h1><t:slot name="title" /></h1>
<ul>
+ <li><a href="config">Server Configuration</a></li>
+ <li><a href="principals">Principal Management</a></li>
+ </ul>
+
+ <ul>
<li><a href="logs">Server Logs</a></li>
- <li><a href="principals">Principal Management</a></li>
<li><a href="work">Workload Monitor</a></li>
</ul>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140310/b71c0575/attachment-0001.html>
More information about the calendarserver-changes
mailing list