def omni_deploy(hostname, local_path = None): ssh = deployers.get_ssh(hostname) deployers.print_host(hostname, "deploying mysql...") db.mysql_deploy(hostname) deployers.print_host(hostname, "deployed mysql") deployers.print_host(hostname, "setting users...") deployers.mysql_add_user(ssh, config.OMNI_DB_USERNAME, config.OMNI_DB_PASSWORD) deployers.print_host(hostname, "transferring file...") deployers.put(ssh, local_path, "/tmp/omni_deploy.tar.gz", remove = False) deployers.print_host(hostname, "creating '%s' database..." % config.OMNI_DB_NAME) deployers.mysql_create_database( ssh, config.OMNI_DB_NAME, username = config.OMNI_DB_USERNAME, password = config.OMNI_DB_PASSWORD ) deployers.print_host(hostname, "created database") deployers.print_host(hostname, "loading database...") deployers.mysql_load( ssh, database = config.OMNI_DB_NAME, path = "/tmp/omni_deploy.tar.gz", username = config.OMNI_DB_USERNAME, password = config.OMNI_DB_PASSWORD ) deployers.print_host(hostname, "loaded database") deployers.print_host(hostname, "removing temporary files...") deployers.rm(ssh, "/tmp/omni_deploy.tar") deployers.rm(ssh, "/tmp/omni_deploy.tar.gz") deployers.print_host(hostname, "removed temporary files")
def mysql_deploy(hostname, username = None, password = None, bind = "0.0.0.0"): ssh = deployers.get_ssh(hostname) deployers.install_apt(ssh, "mysql-server") deployers.mysql_open(ssh, bind) username and password and deployers.mysql_add_user(ssh, username, password) deployers.restart_service(ssh, "mysql")