def start_services(self): # HTTPS server sockets = tornado.netutil.bind_sockets( self.port, address=Settings['main_app']['servername']) redir_sockets = tornado.netutil.bind_sockets( self.redir_port, address=Settings['main_app']['servername']) tornado.process.fork_processes(Settings['tornado']['num_workers']) server = tornado.httpserver.HTTPServer( self.main_app, ssl_options={ 'certfile': Settings['main_app']['ssl_certfile'], # This really should be read into a string so we can drop privileges # after reading the key but before starting the server, but Python # doesn't let us use strings for keys until Python 3.2 :( 'keyfile': Settings['main_app']['ssl_keyfile'], }) server.add_sockets(sockets) # HTTP server (to redirect to HTTPS) redir_server = tornado.httpserver.HTTPServer(self.redir_app) redir_server.add_sockets(redir_sockets) # Start the mail, git, reviewboard and XMPP queue handlers MailQueue.start_worker() GitQueue.start_worker() RBQueue.start_worker() XMPPQueue.start_worker()
def start_services(self): # HTTPS server sockets = tornado.netutil.bind_sockets(self.port, address=Settings['main_app']['servername']) redir_sockets = tornado.netutil.bind_sockets(self.redir_port, address=Settings['main_app']['servername']) # Start the mail, git, reviewboard and XMPP queue handlers worker_pids = [] worker_pids.extend(MailQueue.start_worker()) worker_pids.extend(RBQueue.start_worker()) worker_pids.extend(XMPPQueue.start_worker()) worker_pids.extend(GitQueue.start_worker()) for worker_pid in worker_pids: pid.write(self.pid_file, append=True, pid=worker_pid) self.queue_worker_pids.extend(worker_pids) tornado.process.fork_processes(Settings['tornado']['num_workers']) server = tornado.httpserver.HTTPServer(self.main_app, ssl_options={ 'certfile': Settings['main_app']['ssl_certfile'], # This really should be read into a string so we can drop privileges # after reading the key but before starting the server, but Python # doesn't let us use strings for keys until Python 3.2 :( 'keyfile': Settings['main_app']['ssl_keyfile'], }) server.add_sockets(sockets) # HTTP server (to redirect to HTTPS) redir_server = tornado.httpserver.HTTPServer(self.redir_app) redir_server.add_sockets(redir_sockets)
def on_db_complete(self, success, db_results): self.check_db_results(success, db_results) _, _, _, _, live_requests = db_results for req in live_requests: if req["reviewid"]: review_id = int(req["reviewid"]) RBQueue.enqueue_review(review_id) if req["watchers"]: user_string = "%s (%s)" % (req["user"], req["watchers"]) users = [req["user"]] + req["watchers"].split(",") else: user_string = req["user"] users = [req["user"]] msg = ( ( """ <p> %(pushmaster)s has certified request for %(user)s as stable in production: </p> <p> <strong>%(user)s - %(title)s</strong><br /> <em>%(repo)s/%(branch)s</em> </p> <p> Regards,<br /> PushManager </p>""" ) % pushmanager.core.util.EscapedDict( { "pushmaster": self.current_user, "user": user_string, "title": req["title"], "repo": req["repo"], "branch": req["branch"], } ) ) subject = "[push] %s - %s" % (user_string, req["title"]) MailQueue.enqueue_user_email(users, msg, subject)
def on_db_complete(self, success, db_results): self.check_db_results(success, db_results) _, _, _, _, live_requests = db_results for req in live_requests: if req['reviewid']: review_id = int(req['reviewid']) RBQueue.enqueue_review(review_id) if req['watchers']: user_string = '%s (%s)' % (req['user'], req['watchers']) users = [req['user']] + req['watchers'].split(',') else: user_string = req['user'] users = [req['user']] msg = ( """ <p> %(pushmaster)s has certified request for %(user)s as stable in production: </p> <p> <strong>%(user)s - %(title)s</strong><br /> <em>%(repo)s/%(branch)s</em> </p> <p> Regards,<br /> PushManager </p>""" ) % pushmanager.core.util.EscapedDict({ 'pushmaster': self.current_user, 'user': user_string, 'title': req['title'], 'repo': req['repo'], 'branch': req['branch'], }) subject = "[push] %s - %s" % (user_string, req['title']) MailQueue.enqueue_user_email(users, msg, subject)