OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is govered 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 """Defines settings for monorail.""" |
| 7 |
| 8 import os |
| 9 import re |
| 10 |
| 11 from google.appengine.api import app_identity |
| 12 |
| 13 from proto import project_pb2 |
| 14 from proto import site_pb2 |
| 15 |
| 16 |
| 17 # This file is divided into the following parts: |
| 18 # 1. Settings you must edit before deploying your site. |
| 19 # 2. Settings you would edit on certainoccasions while maintaining your site. |
| 20 # 3. Settings enable specific features. |
| 21 # 4. Settings that you can usually leave as-is. |
| 22 |
| 23 # TODO(jrobbins): Store these settings in the database and implement |
| 24 # servlets for domain admins to edit them without needing to redeploy the |
| 25 # app. |
| 26 |
| 27 |
| 28 #### |
| 29 # Part 1: settings that you must edit before deploying your site. |
| 30 |
| 31 # Email address that is offered to users who might need help using the tool. |
| 32 feedback_email = 'jrobbins+monorail.feedback@chromium.org' |
| 33 |
| 34 # For debugging when running in staging: send all outbound |
| 35 # email to this address rather than to the actual address that |
| 36 # it would normally be sent to. |
| 37 send_all_email_to = 'jrobbins+all+%(user)s+%(domain)s@chromium.org' |
| 38 |
| 39 # For debugging when running the dev server locally: send all outbound |
| 40 # email to this address rather than to the actual address that |
| 41 # it would normally be sent to. |
| 42 send_dev_email_to = (send_all_email_to or |
| 43 'jrobbins+dev+%(user)s+%(domain)s@chromium.org') |
| 44 |
| 45 # User to send emails from Monorail as. The reply_to sections of emails will be |
| 46 # set to appspotmail addresses. |
| 47 # Note: If configuring a new monorail instance without DNS records and reserved |
| 48 # email addresses then setting these values to |
| 49 # 'reply@${app_id}.appspotmail.com' and 'noreply@{app_id}.appspotmail.com' |
| 50 # is likely the best option. |
| 51 send_email_as = 'monorail@chromium.org' |
| 52 send_noreply_email_as = 'monorail+noreply@chromium.org' |
| 53 |
| 54 # The default is to look for a database named "monorail" in replicas |
| 55 # named "replica-00" .. "replica-09" |
| 56 db_database_name = 'monorail' |
| 57 db_replica_prefix = 'replica-' |
| 58 |
| 59 # The number of logical database shards used. Each replica is complete copy |
| 60 # of the master, so any replica DB can answer queries about any logical shard. |
| 61 num_logical_shards = 10 |
| 62 |
| 63 # "Learn more" link for the site home page |
| 64 # TODO(agable): Update this when we have publicly visible documentation. |
| 65 learn_more_link = None |
| 66 |
| 67 # Site name, displayed above the search box on the site home page. |
| 68 site_name = 'Monorail' |
| 69 |
| 70 # Who is allowed to create new projects? Set to ANYONE or ADMIN_ONLY. |
| 71 project_creation_restriction = site_pb2.UserTypeRestriction.ADMIN_ONLY |
| 72 |
| 73 # Default access level when creating a new project. |
| 74 default_access_level = project_pb2.ProjectAccess.ANYONE |
| 75 |
| 76 # Possible access levels to offer when creating a new project. |
| 77 allowed_access_levels = [ |
| 78 project_pb2.ProjectAccess.ANYONE, |
| 79 project_pb2.ProjectAccess.MEMBERS_ONLY] |
| 80 |
| 81 # Who is allowed to create user groups? Set to ANYONE or ADMIN_ONLY. |
| 82 group_creation_restriction = site_pb2.UserTypeRestriction.ADMIN_ONLY |
| 83 |
| 84 #### |
| 85 # Part 2: Settings you would edit on certain occasions. |
| 86 |
| 87 # Read-only mode prevents changes while we make server-side changes. |
| 88 read_only = False |
| 89 |
| 90 # Timestamp used to notify users when the read only mode or other status |
| 91 # described in the banner message takes effect. It is |
| 92 # expressed as a 5-tuple of ints: (year, month, day, hour, minute), |
| 93 # e.g. (2009, 3, 20, 21, 45) represents March 20 2009 9:45PM. |
| 94 banner_time = None |
| 95 |
| 96 # Display a site maintenance banner on every monorail page. |
| 97 banner_message = '' |
| 98 |
| 99 # User accounts with email addresses at these domains are all banned. |
| 100 banned_user_domains = [] |
| 101 |
| 102 |
| 103 #### |
| 104 # Part 3: Settings that enable specific features |
| 105 |
| 106 # Enables "My projects" drop down menu |
| 107 enable_my_projects_menu = True |
| 108 |
| 109 # Enables stars in the UI for projects |
| 110 enable_project_stars = True |
| 111 |
| 112 # Enables stars in the UI for users |
| 113 enable_user_stars = True |
| 114 |
| 115 # Enable quick edit mode in issue peek dialog and show dialog on hover |
| 116 enable_quick_edit = True |
| 117 |
| 118 |
| 119 #### |
| 120 # Part 4: Settings that you can usually leave as-is. |
| 121 |
| 122 # dev_mode makes the server slower and more dynamic for easier debugging. |
| 123 # E.g., template files are reloaded on each request. |
| 124 dev_mode = os.environ['SERVER_SOFTWARE'].startswith('Development') |
| 125 unit_test_mode = os.environ['SERVER_SOFTWARE'].startswith('test') |
| 126 |
| 127 # If we assume 1KB each, then this would be 400 MB for this cache in frontends |
| 128 # that have only 1024 MB total. |
| 129 issue_cache_max_size = 400 * 1000 |
| 130 |
| 131 # 150K users should be enough for all the frequent daily users plus the |
| 132 # occasional users that are mentioned on any popular pages. |
| 133 user_cache_max_size = 150 * 1000 |
| 134 |
| 135 # Recompute derived issue fields via work items rather than while |
| 136 # the user is waiting for a page to load. |
| 137 recompute_derived_fields_in_worker = True |
| 138 |
| 139 # The issue search SQL queries have a LIMIT clause with this amount. |
| 140 search_limit_per_shard = 10 * 1000 # This is more than all open in chromium. |
| 141 |
| 142 # The GAE search feature is slow, so don't request too many results. |
| 143 fulltext_limit_per_shard = 1 * 1000 |
| 144 |
| 145 # Retrieve at most this many issues from the DB when showing an issue grid. |
| 146 max_issues_in_grid = 6000 |
| 147 # This is the most tiles that we show in grid view. If the number of results |
| 148 # is larger than this, we display IDs instead. |
| 149 max_tiles_in_grid = 1000 |
| 150 |
| 151 # Maximum number of project results to display on a single pagination page |
| 152 max_project_search_results_per_page = 100 |
| 153 |
| 154 # Maxium number of results per pagination page, regardless of what |
| 155 # the user specified in his/her request. This exists to prevent someone |
| 156 # from doing a DoS attack that makes our servers do a huge amount of work. |
| 157 max_artifact_search_results_per_page = 1000 |
| 158 |
| 159 # Maximum number of comments to display on a single pagination page |
| 160 max_comments_per_page = 500 |
| 161 |
| 162 # Max number of issue starrers to notify via email. Issues with more |
| 163 # that this many starrers will only notify the last N of them after a |
| 164 # comment from a project member. |
| 165 max_starrers_to_notify = 4000 |
| 166 |
| 167 # In projects that have more than this many issues the next and prev |
| 168 # links on the issue detail page will not be shown when the user comes |
| 169 # directly to an issue without specifying any query terms. |
| 170 threshold_to_suppress_prev_next = 10000 |
| 171 |
| 172 # Format string for the name of the FTS index shards for issues. |
| 173 search_index_name_format = 'issues%02d' |
| 174 |
| 175 # Name of the FTS index for projects (not sharded). |
| 176 project_search_index_name = 'projects' |
| 177 |
| 178 # Each backend has this many seconds to respond, otherwise frontend gives up |
| 179 # on that shard. |
| 180 backend_deadline = 45 |
| 181 |
| 182 # If the initial call to a backend fails, try again this many times. |
| 183 # Initial backend calls are failfast, meaning that they fail immediately rather |
| 184 # than queue behind other requests. The last 2 retries will wait in queue. |
| 185 backend_retries = 3 |
| 186 |
| 187 # Do various extra logging at INFO level. |
| 188 enable_profiler_logging = False |
| 189 |
| 190 # Mail sending domain. Normally set this to None and it will be computed |
| 191 # automatically from your AppEngine APP_ID. But, it can be overridden below. |
| 192 mail_domain = None |
| 193 |
| 194 # URL format to browse source code revisions. This can be overridden |
| 195 # in specific projects by setting project.revision_url_format. |
| 196 # The format string may include "{revnum}" for the revision number. |
| 197 revision_url_format = 'https://crrev.com/{revnum}' |
| 198 |
| 199 # Users with emails in the priviledged domains see unobscured email addresses. |
| 200 priviledged_user_domains = [ |
| 201 'google.com', 'chromium.org', 'webrtc.org', |
| 202 ] |
| 203 |
| 204 # Names of projects on code.google.com which we allow cross-linking to. |
| 205 recognized_codesite_projects = [ |
| 206 'chromium-os', |
| 207 'chrome-os-partner', |
| 208 ] |
| 209 |
| 210 ### |
| 211 # Part 5: Instance-specific settings that override lines above. |
| 212 |
| 213 # We usually use a DB instance named "master" for writes. |
| 214 db_master_name = 'master' |
| 215 # This ID is for -staging and other misc deployments. Prod is defined below. |
| 216 analytics_id = 'UA-55762617-20' |
| 217 |
| 218 if unit_test_mode: |
| 219 db_cloud_project = '' # No real database is used during unit testing. |
| 220 else: |
| 221 app_id = app_identity.get_application_id() |
| 222 |
| 223 if app_id == 'monorail-staging': |
| 224 site_name = 'Monorail Staging' |
| 225 banner_message = 'This staging site does not send emails.' |
| 226 # The Google Cloud SQL databases to use. |
| 227 db_cloud_project = app_id |
| 228 db_replica_prefix = 'replica-7-' |
| 229 |
| 230 elif app_id == 'monorail-prod': |
| 231 send_all_email_to = None # Deliver it to the intended users. |
| 232 # The Google Cloud SQL databases to use. |
| 233 db_cloud_project = app_id |
| 234 analytics_id = 'UA-55762617-14' |
| 235 |
| 236 if dev_mode: |
| 237 site_name = 'Monorail Dev' |
| 238 num_logical_shards = 10 |
| 239 |
| 240 # Combine the customized info above to make the name of the master DB instance. |
| 241 db_instance = db_cloud_project + ':' + db_master_name |
| 242 |
| 243 # Format string for the name of the physical database replicas. |
| 244 physical_db_name_format = db_cloud_project + ':' + db_replica_prefix + '%02d' |
| 245 |
| 246 # preferred domains to display |
| 247 preferred_domains = { |
| 248 'monorail-prod.appspot.com': 'bugs.chromium.org', |
| 249 'monorail-staging.appspot.com': 'bugs-staging.chromium.org'} |
| 250 |
| 251 # Borg robot service account |
| 252 borg_service_account = 'chrome-infra-prod-borg@system.gserviceaccount.com' |
| 253 |
| 254 # Prediction API params. |
| 255 classifier_project_id = 'project-id-testing-only' |
| 256 |
| 257 # Necessary for tests. |
| 258 if 'APPLICATION_ID' not in os.environ: |
| 259 os.environ['APPLICATION_ID'] = 'testing app' |
| 260 |
| 261 if dev_mode: |
| 262 # This is monorail-staging. There is no local stub for Cloud Prediction. |
| 263 classifier_project_id = '52759169022' |
| 264 else: |
| 265 classifier_project_id = app_identity.get_application_id() |
| 266 |
| 267 classifier_model_id = 'spam' |
| 268 |
| 269 # Number of distinct users who have to flag an issue before it |
| 270 # is autmatically removed as spam. |
| 271 # 5 is an arbitrarily chosen value. Set it to something really high |
| 272 # to effectively disable spam flag threshhold checking. |
| 273 spam_flag_thresh = 5 |
| 274 |
| 275 # If the classifier's confidence is less than this value, the |
| 276 # item will show up in the spam moderation queue for manual |
| 277 # review. |
| 278 classifier_moderation_thresh = 1.0 |
| 279 |
| 280 # If the classifier's confidence is greater than this value, |
| 281 # and the label is 'spam', the item will automatically be created |
| 282 # with is_spam=True, and will be filtered out from search results. |
| 283 classifier_spam_thresh = 1.0 |
| 284 |
| 285 ratelimiting_enabled = False |
| 286 |
| 287 # Enable cost-based rate limiting. This only applies if |
| 288 # ratelimiting_enabled = True |
| 289 ratelimiting_cost_enabled = True |
| 290 |
| 291 # Requests that take longer than this are hit with extra |
| 292 # counts added to their bucket at the end of the request. |
| 293 ratelimiting_cost_thresh_ms = 2000 |
| 294 |
| 295 # Requests that hit ratelimiting_cost_thresh_sec get this |
| 296 # extra amount added to their bucket at the end of the request. |
| 297 ratelimiting_cost_penalty = 1 |
OLD | NEW |