Exemple #1
0
    def setUpClass(self):
        cfg = RZ_Config.init_from_file("res/etc/rhizi-server.conf")
        self.db_ctl = db_controller.DB_Controller(cfg.db_base_url)
        self.log = logging.getLogger("rhizi")
        self.log.addHandler(logging.StreamHandler())

        # bootstrap kernel
        kernel = RZ_Kernel()
        kernel.db_ctl = self.db_ctl
        kernel.db_op_factory = DBO_factory__default()
        kernel.start()

        self.kernel = kernel

        while not self.kernel.is_DB_status__ok():  # wait for kernel to initialize...
            time.sleep(0.3)
Exemple #2
0
def init_test_ws_server(cfg, db_ctl):
    """
    Initialize a test websocket server

    @param db_ctl: an initialized DB_Controller
    """
    kernel = RZ_Kernel()
    webapp = init_webapp(cfg, kernel, db_ctl)
    ws_srv = init_ws_interface(cfg, webapp)
    return ws_srv
Exemple #3
0
 def __init__(self, config_dir):
     cfg = init_config(config_dir)
     kernel = RZ_Kernel()
     db_ctl = dbc.DB_Controller(cfg.db_base_url)
     kernel.db_ctl = db_ctl
     user_db = Fake_User_DB()
     webapp = init_webapp(cfg, kernel)
     webapp.user_db = user_db
     kernel.db_op_factory = webapp  # assist kernel with DB initialization
     kernel.start()
     time.sleep(0.1)
     self.kernel = kernel
Exemple #4
0
    def setUpClass(self):
        cfg = RZ_Config.init_from_file('res/etc/rhizi-server.conf')
        self.db_ctl = db_controller.DB_Controller(cfg.db_base_url)
        self.log = logging.getLogger('rhizi')
        self.log.addHandler(logging.StreamHandler())

        # bootstrap kernel
        kernel = RZ_Kernel()
        kernel.db_ctl = self.db_ctl
        kernel.db_op_factory = DBO_factory__default()
        kernel.start()

        self.kernel = kernel

        while not self.kernel.is_DB_status__ok(
        ):  # wait for kernel to initialize...
            time.sleep(0.3)
Exemple #5
0
        if False == cfg.access_control:
            log.warn(
                '[!] access control disabled, all-granted access set on all URLs'
            )

        init_signal_handlers()
        init_user_db(cfg)
    except Exception as e:
        log.exception('failed to initialize server')
        traceback.print_exc()
        exit(-1)

    #
    # init kernel
    #
    kernel = RZ_Kernel()
    kernel.db_ctl = DB_Controller(cfg.db_base_url)

    #
    # init webapp
    #
    webapp = init_webapp(cfg, kernel)
    webapp.user_db = user_db
    kernel.db_op_factory = webapp  # assist kernel with DB initialization
    ws_srv = init_ws_interface(cfg, kernel, webapp)

    try:
        kernel.start()
        ws_srv.serve_forever()
    except Exception as e:
        log.exception(e)
Exemple #6
0
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#!/usr/bin/python

import cgitb
from flup.server.fcgi import WSGIServer
import os
import sys

from rz_kernel import RZ_Kernel
import rz_server

# sys.path.insert(0, '/srv/www/rhizi/rhizi.net/src-py')
# enable debugging
cgitb.enable()

if __name__ == '__main__':

    cfg = rz_server.init_config(cfg_dir='/etc/rhizi')
    log = rz_server.init_log(cfg)

    kernel = RZ_Kernel()
    webapp = rz_server.init_webapp(cfg, kernel)
    ws_srv = rz_server.init_ws_interface(cfg, kernel, webapp)

    log.info('launching webapp via flup.server.fcgi.WSGIServer')

    WSGIServer(ws_srv).run()
Exemple #7
0
        cfg_indent_str = '   ' + str(cfg).replace('\n', '\n   ')
        log.info('loaded configuration:\n%s' % cfg_indent_str)  # print indented
        if False == cfg.access_control:
            log.warn('[!] access control disabled, all-granted access set on all URLs')

        init_signal_handlers()
        init_user_db(cfg)
    except Exception as e:
        log.exception('failed to initialize server')
        traceback.print_exc()
        exit(-1)

    #
    # init kernel
    #
    kernel = RZ_Kernel()
    kernel.db_ctl = DB_Controller(cfg.db_base_url)

    #
    # init webapp
    #
    webapp = init_webapp(cfg, kernel)
    webapp.user_db = user_db
    kernel.db_op_factory = webapp  # assist kernel with DB initialization
    ws_srv = init_ws_interface(cfg, kernel, webapp)

    try:
        kernel.start()
        ws_srv.serve_forever()
    except Exception as e:
        log.exception(e)