blob: 6d89472d74913a8eb0ca2a544d1138ca9e3807d8 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Main program for Monorail.
7
8Monorail is an issue tracking tool that is based on the code.google.com
9issue tracker, but it has been ported to Google AppEngine and Google Cloud SQL.
10"""
11from __future__ import print_function
12from __future__ import division
13from __future__ import absolute_import
14
15import logging
16import webapp2
17
18from components import endpoints_webapp2
19
20import gae_ts_mon
21
22import registerpages
23from framework import sorting
24from services import api_svc_v1
25from services import service_manager
26
27
28services = service_manager.set_up_services()
29sorting.InitializeArtValues(services)
30registry = registerpages.ServletRegistry()
31app_routes = registry.Register(services)
32app = webapp2.WSGIApplication(
33 app_routes, config={'services': services})
34gae_ts_mon.initialize(app)
35
36endpoints = endpoints_webapp2.api_server(
37 [api_svc_v1.MonorailApi, api_svc_v1.ClientConfigApi])
38
39# TODO(crbug/monorail/8221): Remove this code during this milestone.
40# It only serves as a safe way to begin connecting to redis without risking
41# user facing problems.
42try:
43 logging.info('Starting initial redis connection verification.')
44 from framework import redis_utils
45 redis_utils.AsyncVerifyRedisConnection()
46except: # pylint: disable=bare-except
47 logging.exception('Exception when instantiating redis connection.')