templates/nginx/config/rubber/role/web_tools/tools-index.html in rubber-2.0.8 vs templates/nginx/config/rubber/role/web_tools/tools-index.html in rubber-2.1.0
- old
+ new
@@ -1,7 +1,8 @@
<%
@path = "/var/www/index.html"
+ tools_host = rubber_instances.for_role('web_tools').first
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
@@ -9,27 +10,28 @@
</head>
<body>
<h1>Rubber Admin Tools</h1>
<ul>
- <% if File.exist?("/var/www/munin") %>
- <li><a href="/munin/">Munin</a></li>
+ <%
+ tools_html_path = "/var/www"
+ tools_html_prefix = "#{tools_html_path}/rubber-web-tools-"
+ Dir["#{tools_html_prefix}*.html"].each do |tools_file|
+ tool_path = tools_file.gsub(tools_html_path, '')
+ tool_name = tools_file.gsub(tools_html_prefix, '').split('.').first
+ tool_name = tool_name.capitalize
+ %>
+ <li><a href="<%= tool_path %>"><%= tool_name %></a></li>
<% end %>
- <% if cruise_host = rubber_instances.for_role('cruise').first %>
- <li><a href="http://<%= cruise_host %>/cruise/">CruiseControl</a></li>
- <% end %>
-
- <% rubber_instances.for_role('haproxy').each do |ic| %>
- <li><a href="/haproxy_<%= ic.name %>/">HAProxy <%= ic.name %></a></li>
- <% end %>
-
- <% rubber_instances.each do |ic| %>
- <li><a href="/monit_<%= ic.name %>/">Monit <%= ic.name %></a></li>
- <% end %>
-
- <% if graphite_host = rubber_instances.for_role('graphite_web').first %>
- <li><a href="/graphite/">Graphite</a></li>
+ <%
+ # add the ip aliases for web tools hosts so we can map internal tools
+ # to their own vhost to make proxying easier (rewriting url paths for
+ # proxy is a real pain, e.g. '/graphite/' externally to '/' on the
+ # graphite web app)
+ Array(rubber_env.web_tools_proxies).each do |name, settings|
+ %>
+ <li><a href="https://<%= name %>-<%= tools_host.full_name %>:<%= rubber_env.web_tools_ssl_port %><%= settings.path || '/' %>"><%= name.capitalize %></a></li>
<% end %>
</ul>
</body>
</html>