def complete_start_procedure_safe_to_use_for_restart(m2ee):
    display_java_version()
    util.mkdir_p("model/lib/userlib")
    logs.set_up_logging_file()
    start_app(m2ee)
    security.create_admin_user(m2ee, util.is_development_mode())
    logs.update_config(m2ee)
    display_running_version(m2ee)
    configure_debugger(m2ee)
Beispiel #2
0
def _set_runtime_config(m2ee, metadata, vcap_data):
    scheduled_event_execution, my_scheduled_events = _get_scheduled_events(
        metadata)

    app_config = {
        "ApplicationRootUrl": _get_application_root_url(vcap_data),
        "MicroflowConstants": _get_constants(metadata),
        "ScheduledEventExecution": scheduled_event_execution,
    }

    if my_scheduled_events is not None:
        app_config["MyScheduledEvents"] = my_scheduled_events

    if util.is_development_mode():
        logging.warning(
            'Runtime is being started in Development mode. Set \'DEVELOPMENT_MODE to "false" (currently "true") to set it to Production mode.'
        )
        app_config["DTAPMode"] = "D"

    if get_runtime_version() >= 7 and not util.is_cluster_leader():
        app_config["com.mendix.core.isClusterSlave"] = "true"
    elif (get_runtime_version() >= 6
          and os.getenv("ENABLE_STICKY_SESSIONS", "false").lower() == "true"):
        logging.info("Enabling sticky sessions")
        app_config["com.mendix.core.SessionIdCookieName"] = "JSESSIONID"

    util.mkdir_p(os.path.join(os.getcwd(), "model", "resources"))
    util.upsert_custom_runtime_settings(m2ee,
                                        app_config,
                                        overwrite=True,
                                        append=True)
    util.upsert_custom_runtime_settings(
        m2ee,
        security.get_certificate_authorities(),
        overwrite=True,
        append=True,
    )
    util.upsert_custom_runtime_settings(
        m2ee,
        security.get_client_certificates(get_runtime_version()),
        overwrite=True,
        append=True,
    )
    util.upsert_custom_runtime_settings(m2ee,
                                        _get_custom_settings(metadata),
                                        overwrite=False,
                                        append=True)
    util.upsert_custom_runtime_settings(m2ee,
                                        _get_license_subscription(),
                                        overwrite=True,
                                        append=True)
    util.upsert_custom_runtime_settings(m2ee,
                                        _get_custom_runtime_settings(),
                                        overwrite=True,
                                        append=True)
def set_runtime_config(metadata, mxruntime_config, vcap_data, m2ee):
    scheduled_event_execution, my_scheduled_events = get_scheduled_events(
        metadata
    )

    app_config = {
        "ApplicationRootUrl": get_application_root_url(vcap_data),
        "MicroflowConstants": get_constants(metadata),
        "ScheduledEventExecution": scheduled_event_execution,
    }

    if my_scheduled_events is not None:
        app_config["MyScheduledEvents"] = my_scheduled_events

    if util.is_development_mode():
        logging.warning(
            "Runtime is being started in Development Mode. Set "
            'DEVELOPMENT_MODE to "false" (currently "true") to '
            "set it to production."
        )
        app_config["DTAPMode"] = "D"

    if (
        m2ee.config.get_runtime_version() >= 7
        and not util.i_am_primary_instance()
    ):
        app_config["com.mendix.core.isClusterSlave"] = "true"
    elif (
        m2ee.config.get_runtime_version() >= 6
        and os.getenv("ENABLE_STICKY_SESSIONS", "false").lower() == "true"
    ):
        logging.info("Enabling sticky sessions")
        app_config["com.mendix.core.SessionIdCookieName"] = "JSESSIONID"

    util.mkdir_p(os.path.join(os.getcwd(), "model", "resources"))
    mxruntime_config.update(app_config)

    # db configuration might be None, database should then be set up with
    # MXRUNTIME_Database... custom runtime settings.
    runtime_db_config = database.get_config()
    if runtime_db_config:
        mxruntime_config.update(runtime_db_config)

    mxruntime_config.update(storage.get_config(m2ee))
    mxruntime_config.update(security.get_certificate_authorities())
    mxruntime_config.update(
        security.get_client_certificates(m2ee.config.get_runtime_version())
    )
    mxruntime_config.update(get_custom_settings(metadata, mxruntime_config))
    mxruntime_config.update(get_license_subscription())
    mxruntime_config.update(get_custom_runtime_settings())
Beispiel #4
0
def run(m2ee, loglevels):
    # Shutdown handler; called on exit(0) or exit(1)
    def _terminate():
        if m2ee:
            stop(m2ee)

    atexit.register(_terminate)

    _display_java_version()
    util.mkdir_p("model/lib/userlib")
    _start_app(m2ee)
    security.create_admin_user(m2ee, util.is_development_mode())
    _display_running_model_version(m2ee)
    _configure_debugger(m2ee)
    _set_loglevels(m2ee, loglevels)