def _deferred_start(self): ret = update_db() if ret == -1: reactor.stop() return if ret == 0: create_db() init_db() sync_clean_untracked_files() sync_refresh_memory_variables() self.state.orm_tp.start() reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown) for sock in self.state.http_socks: listen_tcp_on_sock(reactor, sock.fileno(), self.api_factory) self.state.process_supervisor = ProcessSupervisor( self.state.https_socks, '127.0.0.1', 8082) self.state.process_supervisor.maybe_launch_https_workers() self.start_jobs() self.print_listening_interfaces()
def _deferred_start(self): ret = update_db() if ret == -1: reactor.stop() if ret == 0: init_db() sync_clean_untracked_files() sync_refresh_memory_variables() GLSettings.orm_tp.start() reactor.addSystemEventTrigger('after', 'shutdown', GLSettings.orm_tp.stop) arw = APIResourceWrapper() GLSettings.api_factory = Site(arw, logFormatter=timedLogFormatter) for sock in GLSettings.http_socks: listen_tcp_on_sock(reactor, sock.fileno(), GLSettings.api_factory) GLSettings.state.process_supervisor = ProcessSupervisor(GLSettings.https_socks, '127.0.0.1', 8082) yield GLSettings.state.process_supervisor.maybe_launch_https_workers() GLSettings.start_jobs() GLSettings.start_services() GLSettings.print_listening_interfaces()
def _deferred_start(self): ret = update_db() if ret == -1: reactor.stop() if ret == 0: init_db() sync_clean_untracked_files() sync_refresh_memory_variables() GLSettings.orm_tp.start() reactor.addSystemEventTrigger('after', 'shutdown', GLSettings.orm_tp.stop) arw = APIResourceWrapper() GLSettings.api_factory = Site(arw, logFormatter=timedLogFormatter) for sock in GLSettings.http_socks: listen_tcp_on_sock(reactor, sock.fileno(), GLSettings.api_factory) GLSettings.state.process_supervisor = ProcessSupervisor( GLSettings.https_socks, '127.0.0.1', GLSettings.bind_port) yield GLSettings.state.process_supervisor.maybe_launch_https_workers() GLSettings.start_jobs() print( "GlobaLeaks is now running and accessible at the following urls:") if GLSettings.memory_copy.reachable_via_web: print("- http://%s:%d%s" % (GLSettings.bind_address, GLSettings.bind_port, GLSettings.api_prefix)) if GLSettings.memory_copy.hostname: print("- http://%s:%d%s" % (GLSettings.memory_copy.hostname, GLSettings.bind_port, GLSettings.api_prefix)) else: print("- http://127.0.0.1:%d%s" % (GLSettings.bind_port, GLSettings.api_prefix)) if GLSettings.onionservice is not None: print("- http://%s%s" % (GLSettings.onionservice, GLSettings.api_prefix))
def setUp(self): self.test_reactor = task.Clock() jobs.job.reactor = self.test_reactor tempdict.reactor = self.test_reactor token.TokenList.reactor = self.test_reactor Sessions.reactor = self.test_reactor self.state = State init_state() self.setUp_dummy() if self.initialize_test_database_using_archived_db: shutil.copy( os.path.join(TEST_DIR, 'db', 'empty', 'glbackend-%d.db' % DATABASE_VERSION), os.path.join(Settings.db_file_path)) else: yield db.create_db() yield db.init_db() allow_unencrypted = self.encryption_scenario in ['PLAINTEXT', 'MIXED'] yield tw(db_set_config_variable, 1, u'allow_unencrypted', allow_unencrypted) yield self.set_hostnames(1) yield db.refresh_memory_variables() sup = ProcessSupervisor([], '127.0.0.1', 8082) self.state.process_supervisor = sup self.state.reset_hourly() Settings.submission_minimum_delay = 0 self.internationalized_text = load_appdata( )['node']['whistleblowing_button']
def setUp(self): test_config.skipCase(self) self.test_reactor = task.Clock() jobs.base.test_reactor = self.test_reactor tempdict.test_reactor = self.test_reactor token.TokenList.reactor = self.test_reactor GLSessions.reactor = self.test_reactor init_glsettings_for_unit_tests() self.setUp_dummy() if self.initialize_test_database_using_archived_db: shutil.copy( os.path.join(TEST_DIR, 'db', 'empty', GLSettings.db_file_name), os.path.join(GLSettings.working_path, 'db', GLSettings.db_file_name)) else: yield db.init_db(use_single_lang=True) allow_unencrypted = self.encryption_scenario in ['PLAINTEXT', 'MIXED'] yield update_node_setting('allow_unencrypted', allow_unencrypted) yield db.refresh_memory_variables() sup = ProcessSupervisor([], '127.0.0.1', 8082) GLSettings.state.process_supervisor = sup Alarm.reset() event.EventTrackQueue.clear() GLSettings.reset_hourly() GLSettings.submission_minimum_delay = 0 self.internationalized_text = load_appdata( )['node']['whistleblowing_button']