コード例 #1
0
    logging.info(
        "Started Mendix Cloud Foundry Buildpack v%s [commit:%s]",
        BUILDPACK_VERSION,
        commit,
    )

    try:
        if os.getenv("CF_INSTANCE_INDEX") is None:
            logging.warning(
                "CF_INSTANCE_INDEX environment variable not found. Assuming "
                "responsibility for scheduled events execution and database "
                "synchronization commands.")
        pre_process_m2ee_yaml()
        runtime.activate_license()

        m2ee = set_up_m2ee_client(util.get_vcap_data())

        def sigterm_handler(_signo, _stack_frame):
            m2ee.stop()
            sys.exit(0)

        def sigusr_handler(_signo, _stack_frame):
            if _signo == signal.SIGUSR1:
                emit(jvm={"errors": 1.0})
            elif _signo == signal.SIGUSR2:
                emit(jvm={"ooms": 1.0})
            else:
                # Should not happen
                pass
            m2ee.stop()
            sys.exit(1)
コード例 #2
0
    )

    logging.info(
        "Mendix Cloud Foundry Buildpack %s [%s] starting...",
        util.get_buildpack_version(),
        util.get_current_buildpack_commit(),
    )

    try:
        if os.getenv("CF_INSTANCE_INDEX") is None:
            logging.warning(
                "CF_INSTANCE_INDEX environment variable not found, assuming cluster leader responsibility..."
            )

        # Initialize the runtime
        m2ee = runtime.setup(util.get_vcap_data())

        # Get versions and names
        runtime_version = runtime.get_runtime_version()
        model_version = runtime.get_model_version()
        application_name = util.get_vcap_data()["application_name"]

        # Update runtime configuration based on component configuration
        database.update_config(m2ee)
        storage.update_config(m2ee)
        java.update_config(m2ee, util.get_vcap_data(), runtime_version)
        newrelic.update_config(m2ee, application_name)
        appdynamics.update_config(m2ee)
        dynatrace.update_config(m2ee, application_name)
        mx_java_agent.update_config(m2ee)
        telegraf.update_config(m2ee, application_name)
コード例 #3
0
    logging.info(
        "Mendix Cloud Foundry Buildpack %s [%s] starting...",
        util.get_buildpack_version(),
        util.get_current_buildpack_commit(),
    )

    try:
        if os.getenv("CF_INSTANCE_INDEX") is None:
            logging.warning(
                "CF_INSTANCE_INDEX environment variable not found. Assuming "
                "responsibility for scheduled events execution and database "
                "synchronization commands.")
        runtime.pre_process_m2ee_yaml()
        runtime.activate_license()

        m2ee = runtime.set_up_m2ee_client(util.get_vcap_data())

        java_version = runtime.get_java_version(
            m2ee.config.get_runtime_version())["version"]
        java.update_config(m2ee.config._conf["m2ee"], util.get_vcap_data(),
                           java_version)

        newrelic.update_config(m2ee, util.get_vcap_data()["application_name"])
        appdynamics.update_config(m2ee,
                                  util.get_vcap_data()["application_name"])
        dynatrace.update_config(m2ee, util.get_vcap_data()["application_name"])
        mx_java_agent.update_config(m2ee)
        telegraf.update_config(m2ee, util.get_vcap_data()["application_name"])
        (
            databroker_jmx_instance_cfg,
            databroker_jmx_config_files,
コード例 #4
0
from distutils.util import strtobool
from buildpack import util

APPDYNAMICS_INSTALL_PATH = os.path.abspath(".local/appdynamics/")
APPDYNAMICS_JAVAAGENT_PATH = os.path.join(APPDYNAMICS_INSTALL_PATH,
                                          "javaagent.jar")

APPDYNAMICS_MACHINE_AGENT_PATH = os.path.join(
    APPDYNAMICS_INSTALL_PATH,
    "machineagent",
    "bin",
    "machine-agent",
)

CF_APPLICATION_INDEX = os.getenv("CF_INSTANCE_INDEX", default=0)
CF_APPLICATION_NAME = util.get_vcap_data()["application_name"]

APPDYNAMICS_ENV_VARS = {
    "APPDYNAMICS_AGENT_APPLICATION_NAME":
    os.getenv(
        "APPDYNAMICS_AGENT_APPLICATION_NAME",
        default=util.get_app_from_domain(),
    ),
    "APPDYNAMICS_AGENT_NODE_NAME":
    "{}-{}".format(
        os.getenv("APPDYNAMICS_AGENT_NODE_NAME", default="node"),
        CF_APPLICATION_INDEX,
    ),
    "APPDYNAMICS_AGENT_TIER_NAME":
    os.getenv("APPDYNAMICS_AGENT_TIER_NAME", default=CF_APPLICATION_NAME),
    "APPDYNAMICS_CONTROLLER_PORT":