Пример #1
0
def setup_sentry_for_falcon(app):
    sentry_url = get_ship_config().get('sentry_url')
    if sentry_url:
        sentry_client = setup_sentry()
        error_handler = FalconErrorHandler(sentry_client)
        app.add_error_handler(Exception, error_handler)
    return app
Пример #2
0
 def _create_host_config(self, docker_api, resource_limits, binds, port_bindings):
     resource_limits = resource_limits or {}
     privileged = get_ship_config().get('privileged', 'false').lower() == 'true'
     host_config = docker_api.create_host_config(
         privileged=privileged,
         publish_all_ports=True,
         binds=binds,
         port_bindings=port_bindings,
         mem_limit=resource_limits.get('memory'),
         memswap_limit=resource_limits.get('memory_swap'),
         cgroup_parent=resource_limits.get('cgroup_parent'),
     )
     host_config['CpuShares'] = resource_limits.get('cpu_shares')
     return host_config
Пример #3
0
 def _create_host_config(self, docker_api, resource_limits, binds, port_bindings):
     resource_limits = resource_limits or {}
     privileged = get_ship_config().get('privileged', 'false').lower() == 'true'
     host_config = docker_api.create_host_config(
         privileged=privileged,
         publish_all_ports=True,
         binds=binds,
         port_bindings=port_bindings,
         mem_limit=resource_limits.get('memory'),
         memswap_limit=resource_limits.get('memory_swap'),
         cgroup_parent=resource_limits.get('cgroup_parent'),
     )
     host_config['CpuShares'] = resource_limits.get('cpu_shares')
     return host_config
Пример #4
0
def create_host_config(docker_api, resource_limits, binds, port_bindings):
    resource_limits = resource_limits or {}
    privileged = get_ship_config().get('privileged', 'false').lower() == 'true'
    params = {
        'privileged': privileged,
        'publish_all_ports': True,
        'binds': binds,
        'port_bindings': port_bindings,
        'mem_limit': resource_limits.get('memory'),
        'memswap_limit': resource_limits.get('memory_swap'),
        'cgroup_parent': resource_limits.get('cgroup_parent'),
        'cpu_shares': resource_limits.get('cpu_shares'),
    }

    return HostConfig(DOCKER_API_VERSION, **params)
Пример #5
0
def setup_sentry():
    sentry_url = get_ship_config().get('sentry_url', '')

    tags = {'ship_IP': get_external_ip()}

    sentry_client = Client(sentry_url,
                           include_paths=sentry_include_path,
                           release=__version__,
                           auto_log_stacks=True,
                           ignore_exceptions=sentry_ignore_exceptions,
                           tags=tags)

    handler = SentryHandler(sentry_client, level=logging.WARNING)
    setup_logging(handler)

    return sentry_client
Пример #6
0
def setup_sentry(is_web=False):
    sentry_url = get_ship_config().get('sentry_url', '')

    client_class = WebSentryClient if is_web else Client
    tags = {'ship_IP': get_external_ip()}

    sentry_client = client_class(sentry_url,
                                 include_paths=sentry_include_path,
                                 release=__version__,
                                 auto_log_stacks=True,
                                 ignore_exceptions=sentry_ignore_exceptions,
                                 tags=tags)

    handler = SentryHandler(sentry_client, level=logging.WARNING)
    setup_logging(handler)

    return sentry_client
Пример #7
0
def _get_default_container_memory_limit():
    return get_ship_config().get('DEFAULT_CONTAINER_MEMORY_LIMIT')
Пример #8
0
def _check_for_updates():
    config = get_ship_config()
    try:
        return int(config.get('check_updates', 1))
    except ValueError:
        return 1
Пример #9
0
def _get_default_container_memory_limit():
    return get_ship_config().get('DEFAULT_CONTAINER_MEMORY_LIMIT')
Пример #10
0
def _check_for_updates():
    config = get_ship_config()
    try:
        return int(config.get('check_updates', 1))
    except ValueError:
        return 1