Exemple #1
0
def start_up():
    try:
        config.init_config()
    except config.cfg.ConfigFilesNotFoundError as ex:
        _LOG.exception(ex.message)

    conf = config.get_config()

    application = api = falcon.API()
    api.add_route('/', VersionResource())

    #http correlation endpoint
    api.add_route('/v1/tenant/{tenant_id}/publish', PublishMessageResource())

    #syslog correlation endpoint
    server = SyslogServer(("0.0.0.0", 5140), syslog.MessageHandler(conf))
    server.start()

    syslog_server_proc = Process(target=start_io)
    syslog_server_proc.start()
    _LOG.info('Syslog server started as process: {}'.format(
        syslog_server_proc.pid))

    celery.conf.CELERYBEAT_SCHEDULE = {
        'worker_stats': {
            'task': 'stats.publish',
            'schedule': timedelta(seconds=publish_stats.WORKER_STATUS_INTERVAL)
        },
    }

    #include blank argument to celery in order for beat to start correctly
    celery_proc = Process(target=celery.worker_main, args=[['', '--beat']])
    celery_proc.start()
    _LOG.info('Celery started as process: {}'.format(celery_proc.pid))
    return application
Exemple #2
0
def start_up():
    try:
        config.init_config()
    except config.cfg.ConfigFilesNotFoundError as ex:
        _LOG.exception(ex.message)

    conf = config.get_config()

    application = api = falcon.API()
    api.add_route('/', VersionResource())

    #http correlation endpoint
    api.add_route('/v1/tenant/{tenant_id}/publish', PublishMessageResource())

    #syslog correlation endpoint
    server = SyslogServer(
        ("0.0.0.0", 5140), syslog.MessageHandler(conf))
    server.start()

    syslog_server_proc = Process(target=start_io)
    syslog_server_proc.start()
    _LOG.info(
        'Syslog server started as process: {}'.format(syslog_server_proc.pid)
    )

    celery.conf.CELERYBEAT_SCHEDULE = {
        'worker_stats': {
            'task': 'stats.publish',
            'schedule': timedelta(seconds=publish_stats.WORKER_STATUS_INTERVAL)
        },
    }

    #include blank argument to celery in order for beat to start correctly
    #celery_proc = Process(target=celery.worker_main, args=[['', '--beat']])
    celery_proc = Process(target=celery.worker_main)
    celery_proc.start()
    _LOG.info(
        'Celery started as process: {}'.format(celery_proc.pid)
    )
    return application
Exemple #3
0
_LOG = get_logger(__name__)

if __name__ == '__main__':
    # Set up the zmq message caster
    caster = ZeroMQCaster(config.core.zmq_bind_host)

    ssl_options = None

    cert_file = config.ssl.cert_file
    key_file = config.ssl.key_file

    if None not in (cert_file, key_file):
        ssl_options = dict()
        ssl_options['certfile'] = cert_file
        ssl_options['keyfile'] = key_file

        _LOG.debug('SSL enabled: {}'.format(ssl_options))

    # Set up the syslog server
    syslog_server = SyslogServer(config.core.syslog_bind_host,
                                 SyslogToZeroMQHandler(caster), ssl_options)
    syslog_server.start()

    # Take over SIGTERM and SIGINT
    signal.signal(signal.SIGTERM, stop)
    signal.signal(signal.SIGINT, stop)

    # Start I/O
    start_io()
Exemple #4
0
_LOG = get_logger(__name__)


if __name__ == "__main__":
    # Set up the zmq message caster
    caster = ZeroMQCaster(config.core.zmq_bind_host)

    ssl_options = None

    cert_file = config.ssl.cert_file
    key_file = config.ssl.key_file

    if None not in (cert_file, key_file):
        ssl_options = dict()
        ssl_options["certfile"] = cert_file
        ssl_options["keyfile"] = key_file

        _LOG.debug("SSL enabled: {}".format(ssl_options))

    # Set up the syslog server
    syslog_server = SyslogServer(config.core.syslog_bind_host, SyslogToZeroMQHandler(caster), ssl_options)
    syslog_server.start()

    # Take over SIGTERM and SIGINT
    signal.signal(signal.SIGTERM, stop)
    signal.signal(signal.SIGINT, stop)

    # Start I/O
    start_io()