def jenkins_download(): script = [] for war in wars.split(","): if war == "bpm-async": script.extend(jenkins._download_bpm(version)) else: script.extend(jenkins._download_war(version, war)) script.extend(self._install_local_wars()) return script
def jenkins_download(): script = [] for war in wars.split(","): script.extend(jenkins._download_war(version, war)) script.extend(self._install_local_wars()) return script
def deploy_api(self, args): """ Deploys and configures custom Abiquo APIs """ parser = OptionParser(usage="scalability deploy-api <options>") parser.add_option('-f', '--file', help='Path to a local api file to deploy', action='store', dest='file') parser.add_option('-j', '--jenkins-version', help='Download the api from the given version from Jenkins', action='store', dest='jenkins') parser.add_option('-d', '--datanode', help='Ip address of the data node (with rabbit, ' 'redis and zookeper)', action='store', dest='datanode') parser.add_option('-b', '--balancer', help='Ip address of the load balancer node', action='store', dest='balancer') parser.add_option('-c', '--count', type="int", default=1, help='Number of nodes to deploy (default 1)', action='store', dest='count') (options, args) = parser.parse_args(args) if options.file and options.jenkins: print "Cannot use -f and -j together" parser.print_help() return if not options.file and not options.jenkins \ or not options.datanode or not options.balancer: parser.print_help() return compute = self._context.getComputeService() try: name = self.__config.get("deploy-api", "template") log.info("Loading template...") vdc, template_options = self._template_options(compute, "deploy-api") template_options.overrideCores( self.__config.getint("deploy-api", "template_cores")) template_options.overrideRam( self.__config.getint("deploy-api", "template_ram")) template = compute.templateBuilder() \ .imageNameMatches(name) \ .locationId(vdc.getId()) \ .options(template_options) \ .build() java_opts = self.__config.get("deploy-api", "tomcat_opts") boundary_org = self.__config.get("deploy-api", "boundary_org") boundary_key = self.__config.get("deploy-api", "boundary_key") newrelic_key = self.__config.get("deploy-api", "newrelic_key") tomcat = TomcatScripts(boundary_org, boundary_key, newrelic_key) log.info("Deploying %s %s nodes to %s..." % (options.count, template.getImage().getName(), vdc.getDescription())) # Due to the IpPoolManagement concurrency issue, we need to deploy # the nodes one by one nodes = [] responses = [] for i in xrange(options.count): node = Iterables.getOnlyElement( compute.createNodesInGroup("kahuna-api", 1, template)) log.info("Created node %s at %s" % (node.getName(), Iterables.getOnlyElement(node.getPublicAddresses()))) if options.file: ssh.upload(self._context, node, "/tmp", options.file) nodes.append(node) log.info("Cooking %s with Chef in the background..." % node.getName()) tomcat_config = { "rabbit": options.datanode, "redis": options.datanode, "zookeeper": options.datanode, "module": "api", "db-host": options.datanode, #"syslog": options.balancer, "ajp_port": 10000 + i, "java-opts": java_opts } bootstrap = [] bootstrap.extend(hostname.configure(node)) bootstrap.append(ntp.install()) if options.jenkins: bootstrap.extend(jenkins._download_war( options.jenkins, "api")) bootstrap.extend(tomcat.install_and_configure(node, tomcat_config, self._install_local_wars)) responses.append(compute.submitScriptOnNode(node.getId(), StatementList(bootstrap), RunScriptOptions.NONE)) log.info("Waiting until all nodes are configured...") for i, future in enumerate(responses): result = future.get() log.info("%s node at %s -> %s" % (nodes[i].getName(), Iterables.getOnlyElement(nodes[i].getPublicAddresses()), "OK" if result.getExitStatus() == 0 else "FAILED")) log.info("Done!") except (AbiquoException, AuthorizationException), ex: print "Error: %s" % ex.getMessage()