def _setup_master_service(self): """ Setup lithops necessary packages and files in master VM instance """ logger.debug('Installing Lithops in {}'.format(self.backend.master)) ssh_client = self.backend.master.get_ssh_client() src_proxy = os.path.join(os.path.dirname(__file__), 'worker.py') create_handler_zip(LOCAL_FH_ZIP_LOCATION, src_proxy) current_location = os.path.dirname(os.path.abspath(__file__)) controller_location = os.path.join(current_location, 'master.py') logger.debug('Uploading lithops files to {}'.format(self.backend.master)) files_to_upload = [(LOCAL_FH_ZIP_LOCATION, '/tmp/lithops_standalone.zip'), (controller_location, '/tmp/master.py'.format(STANDALONE_INSTALL_DIR))] ssh_client.upload_multiple_local_files(files_to_upload) os.remove(LOCAL_FH_ZIP_LOCATION) vm_data = {'instance_name': self.backend.master.name, 'ip_address': self.backend.master.ip_address, 'instance_id': self.backend.master.instance_id} script = get_master_setup_script(self.config, vm_data) logger.debug('Executing lithops installation process on {}'.format(self.backend.master)) logger.debug('Be patient, initial installation process may take up to 5 minutes') ssh_client.run_remote_command(script) logger.debug('Lithops installation process completed')
def _setup_master_service(self): """ Setup lithops necessary packages and files in master VM instance """ logger.info(f'Installing Lithops in {self.backend.master}') ssh_client = self.backend.master.get_ssh_client() worker_path = os.path.join(os.path.dirname(__file__), 'worker.py') master_path = os.path.join(os.path.dirname(__file__), 'master.py') create_handler_zip(LOCAL_FH_ZIP_LOCATION, [master_path, worker_path]) logger.debug('Uploading lithops files to {}'.format(self.backend.master)) ssh_client.upload_local_file(LOCAL_FH_ZIP_LOCATION, '/tmp/lithops_standalone.zip') os.remove(LOCAL_FH_ZIP_LOCATION) vm_data = {'name': self.backend.master.name, 'instance_id': self.backend.master.instance_id, 'private_ip': self.backend.master.private_ip, 'delete_on_dismantle': self.backend.master.delete_on_dismantle, 'lithops_version': lithops_version} logger.debug('Executing lithops installation process on {}'.format(self.backend.master)) logger.debug('Be patient, initial installation process may take up to 3 minutes') remote_script = "/tmp/install_lithops.sh" script = get_master_setup_script(self.config, vm_data) ssh_client.upload_data_to_file(script, remote_script) ssh_client.run_remote_command(f"chmod 777 {remote_script}; sudo {remote_script};") try: # Download the master VM public key generated with the installation script # This public key will be used to create to worker ssh_client.download_remote_file( f'{self.backend.master.home_dir}/.ssh/id_rsa.pub', f'{self.backend.cache_dir}/{self.backend.master.name}-id_rsa.pub') except FileNotFoundError: pass