示例#1
0
 def run_int_service(self):
     inst = self.app().inst
     service_id = "%s-int" % inst.instid
     srv = mg.SingleApplicationWebService(self.app(), service_id, "int",
                                          "int")
     srv.serve_any_port()
     self.call("cluster.register-service", srv)
示例#2
0
 def register_mysql(self):
     inst = self.app().inst
     # Register service
     int_app = inst.int_app
     srv = mg.SingleApplicationWebService(self.app(),
                                          "%s-mysql" % inst.instid, "mysql",
                                          "mysql")
     srv.serve_any_port()
     int_app.call("cluster.register-service", srv)
示例#3
0
 def register_cassandra(self):
     inst = self.app().inst
     # Register service
     int_app = inst.int_app
     srv = mg.SingleApplicationWebService(self.app(),
                                          "%s-cassandra" % inst.instid,
                                          "cassandra", "cass")
     srv.serve_any_port()
     int_app.call("cluster.register-service", srv)
示例#4
0
 def tasklet(self):
     "This tasklet is being run from the main application"
     # Register service
     inst = self.app().inst
     int_app = inst.int_app
     srv = mg.SingleApplicationWebService(self.app(), "realplexor",
                                          "realplexor", "rpl")
     srv.set("webbackend", "realplexor")
     srv.set("webbackendport", 8088)
     srv.serve_any_port()
     int_app.call("cluster.register-service", srv)
     Tasklet.new(self.loop)()
示例#5
0
 def register_nginx(self):
     inst = self.app().inst
     # Load nginx configuration
     self.nginx_config = inst.conf("nginx", "conffile",
                                   "/etc/nginx/nginx-metagam.conf")
     self.nginx_upstreams = set()
     self.nginx_backends = None
     self.nginx_nextcheck = ""
     try:
         with open(self.nginx_config, "r") as f:
             for line in f:
                 m = re_class.match(line)
                 if m:
                     cls = m.group(1)
                     self.nginx_upstreams.add(cls)
     except IOError as e:
         pass
     # Register service
     int_app = inst.int_app
     srv = mg.SingleApplicationWebService(self.app(),
                                          "%s-nginx" % inst.instid, "nginx",
                                          "ngx")
     srv.serve_any_port()
     int_app.call("cluster.register-service", srv)