##// END OF EJS Templates
ops: added healthcheck view
super-admin -
r4736:d501e9ec stable
parent child
Show More
@@ -51,6 +51,14 def admin_routes(config):
51 route_name='ops_redirect_test', request_method='GET',
51 route_name='ops_redirect_test', request_method='GET',
52 renderer='json_ext')
52 renderer='json_ext')
53
53
54 config.add_route(
55 name='ops_healthcheck',
56 pattern='/status')
57 config.add_view(
58 OpsView,
59 attr='ops_healthcheck',
60 route_name='ops_healthcheck', request_method='GET',
61 renderer='json_ext')
54
62
55 def includeme(config):
63 def includeme(config):
56 config.include(admin_routes, route_prefix=ADMIN_PREFIX + '/ops')
64 config.include(admin_routes, route_prefix=ADMIN_PREFIX + '/ops')
@@ -72,3 +72,23 class OpsView(BaseAppView):
72 """
72 """
73 redirect_to = self.request.GET.get('to') or h.route_path('home')
73 redirect_to = self.request.GET.get('to') or h.route_path('home')
74 raise HTTPFound(redirect_to)
74 raise HTTPFound(redirect_to)
75
76 def ops_healthcheck(self):
77 from rhodecode.lib.system_info import load_system_info
78
79 vcsserver_info = load_system_info('vcs_server')
80 if vcsserver_info:
81 vcsserver_info = vcsserver_info['human_value']
82
83 db_info = load_system_info('database_info')
84 if db_info:
85 db_info = db_info['human_value']
86
87 health_spec = {
88 'caller_ip': self.request.user.ip_addr,
89 'vcsserver': vcsserver_info,
90 'db': db_info,
91 }
92
93 return {'healthcheck': health_spec}
94
@@ -166,8 +166,9 def detect_vcs_request(environ, backends
166 # static files no detection
166 # static files no detection
167 '_static',
167 '_static',
168
168
169 # skip ops ping
169 # skip ops ping, status
170 '_admin/ops/ping',
170 '_admin/ops/ping',
171 '_admin/ops/status',
171
172
172 # full channelstream connect should be VCS skipped
173 # full channelstream connect should be VCS skipped
173 '_admin/channelstream/connect',
174 '_admin/channelstream/connect',
General Comments 0
You need to be logged in to leave comments. Login now