Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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 | |
| 8 | Monorail is an issue tracking tool that is based on the code.google.com |
| 9 | issue tracker, but it has been ported to Google AppEngine and Google Cloud SQL. |
| 10 | """ |
| 11 | from __future__ import print_function |
| 12 | from __future__ import division |
| 13 | from __future__ import absolute_import |
| 14 | |
| 15 | import logging |
| 16 | import webapp2 |
| 17 | |
| 18 | from components import endpoints_webapp2 |
| 19 | |
| 20 | import gae_ts_mon |
| 21 | |
| 22 | import registerpages |
| 23 | from framework import sorting |
| 24 | from services import api_svc_v1 |
| 25 | from services import service_manager |
| 26 | |
| 27 | |
| 28 | services = service_manager.set_up_services() |
| 29 | sorting.InitializeArtValues(services) |
| 30 | registry = registerpages.ServletRegistry() |
| 31 | app_routes = registry.Register(services) |
| 32 | app = webapp2.WSGIApplication( |
| 33 | app_routes, config={'services': services}) |
| 34 | gae_ts_mon.initialize(app) |
| 35 | |
| 36 | endpoints = 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. |
| 42 | try: |
| 43 | logging.info('Starting initial redis connection verification.') |
| 44 | from framework import redis_utils |
| 45 | redis_utils.AsyncVerifyRedisConnection() |
| 46 | except: # pylint: disable=bare-except |
| 47 | logging.exception('Exception when instantiating redis connection.') |