def push_manager_private_ip(eb_environment_name): ip = get_manager_private_ip(eb_environment_name) command = "printf {ip} > {manager_ip}".format(ip=ip, manager_ip=path_join( REMOTE_HOME_DIR, "manager_ip")) run(command)
def push_manager_private_ip_and_password(eb_environment_name): ip = get_manager_private_ip(eb_environment_name) + ":" + str( RABBIT_MQ_PORT) password = get_rabbit_mq_password(eb_environment_name) # echo puts a new line at the end of the output run(f"echo {ip} > {REMOTE_RABBIT_MQ_PASSWORD_FILE_PATH}") run(f"printf {password} >> {REMOTE_RABBIT_MQ_PASSWORD_FILE_PATH}")
def push_manager_private_ip_and_password(eb_environment_name): ip = get_manager_private_ip(eb_environment_name) + ":" + str( RABBIT_MQ_PORT) password = get_rabbit_mq_password() filename = path_join(REMOTE_HOME_DIR, "manager_ip") # echo puts a new line at the end of the output run("echo {text} > {filename}".format(text=ip, filename=filename)) run("printf {text} >> {filename}".format(text=password, filename=filename))
def do_create_worker(): name = prompt_for_extant_eb_environment_name() do_fail_if_environment_does_not_exist(name) manager_instance = get_manager_instance_by_eb_environment_name(name) if manager_instance is None: log.error( "There is no manager server for the %s cluster, cannot deploy a worker until there is." % name) EXIT(1) if manager_instance['State']['Name'] != 'running': log.error( "There is a manager server for the %s cluster, but it is not in the running state (%s)." % (name, manager_instance['State']['Name'])) EXIT(1) manager_public_ip = get_manager_public_ip(name) manager_private_ip = get_manager_private_ip(name) try: settings = get_server_configuration_file(name) except Exception as e: log.error("could not read settings file") log.error(e) EXIT(1) log.info("creating worker server for %s..." % name) try: instance = create_processing_server( name, settings["MANAGER_SERVER_INSTANCE_TYPE"]) except Exception as e: log.error(e) EXIT(1) instance_ip = instance['NetworkInterfaces'][0]['PrivateIpAddresses'][0][ 'Association']['PublicIp'] # TODO: fabric up the worker with the celery/supervisord and ensure it can connect to manager. configure_fabric(name, instance_ip) push_files() apt_installs() load_git_repo() setup_python() push_beiwe_configuration(name) push_manager_private_ip(name) setup_celery_worker() setup_worker_cron()