def _prod_deployment_helper(config_dir, package_zip_paths, deploy_go=True, deploy_appengine=True): """Helper for production deployment.""" config = local_config.Config() deployment_bucket = config.get('project.deployment.bucket') gae_config = config.sub_config(local_config.GAE_CONFIG_PATH) gae_deployment = gae_config.sub_config('deployment') project = gae_config.get('application_id') print('Deploying %s to prod.' % project) yaml_paths = gae_deployment.get_absolute_path('prod') yaml_paths = appengine.filter_yaml_paths(yaml_paths, deploy_go) if deploy_appengine: _update_pubsub_queues(project) _update_alerts(project) _update_bigquery(project) _deploy_app_prod( project, deployment_bucket, yaml_paths, package_zip_paths, deploy_appengine=deploy_appengine) if deploy_appengine: common.execute('python butler.py run setup --config-dir {config_dir} ' '--non-dry-run'.format(config_dir=config_dir)) print('Production deployment finished.')
def _get_region_counts(): """Get region instance counts.""" counts = {} regions = local_config.MonitoringRegionsConfig() clusters = local_config.Config(local_config.GCE_CLUSTERS_PATH).get() def get_region(name): """Get the region.""" for pattern in regions.get('patterns'): if re.match(pattern['pattern'], name + '-0000'): return pattern['name'] return None # Compute expected bot counts per region. for config in clusters.values(): for name, cluster in config['clusters'].items(): region = get_region(name) if not region: continue counts.setdefault(region, 0) counts[region] += cluster['instance_count'] return counts
def _staging_deployment_helper(deploy_go): """Helper for staging deployment.""" config = local_config.Config(local_config.GAE_CONFIG_PATH) project = config.get('application_id') print('Deploying %s to staging.' % project) deployment_config = config.sub_config('deployment') yaml_paths = deployment_config.get_absolute_path('staging') yaml_paths = appengine.filter_yaml_paths(yaml_paths, deploy_go) _deploy_app_staging(project, yaml_paths) print('Staging deployment finished.')
def _staging_deployment_helper(python3=True): """Helper for staging deployment.""" config = local_config.Config(local_config.GAE_CONFIG_PATH) project = config.get('application_id') print('Deploying %s to staging.' % project) deployment_config = config.sub_config('deployment') if python3: path = 'staging3' else: path = 'staging' yaml_paths = deployment_config.get_absolute_path(path) _deploy_app_staging(project, yaml_paths) print('Staging deployment finished.')