Exemple #1
0
DEFAULT_JSON = dict(server_name='local',
                    login_ip='127.0.0.1',
                    front_ip='127.0.0.1')

if __name__ == "__main__":
    if os.path.exists('template.json'):
        template = open('template.json')
        str_template = template.read()
        if os.path.exists('my.json'):
            config = json.load(open('my.json'))
            replace_items = config.items()
        else:
            replace_items = DEFAULT_JSON.items()
        for k, v in replace_items:
            str_template = str_template.replace('<=%s=>' % k, v)
            fp = open('config.json', 'w')

            fp.write(str_template)
            fp.flush()
            fp.close()
    else:
        print 'can not find template.json'

    if not os.path.exists(CONFIG_FILE):
        print 'can not find config.json'
    else:
        from gfirefly.master.master import Master
        master = Master()
        master.config(CONFIG_FILE, 'appmain.py')
        master.start()
# coding:utf8
'''
Created on 2013-8-2

@author: lan (www.9miao.com)
'''


def println(a):
    print a


if __name__ == "__main__":
    from gfirefly.master.master import Master

    master = Master()
    master.config('config.json', 'test_server_main.py')
    master.start()
    
    
#coding:utf8

from gevent import monkey; monkey.patch_all()

if __name__=="__main__":
    from gfirefly.master.master import Master
    master = Master()
    master.config('config.json','appmain.py')
    master.start()
    
    
Exemple #4
0
#coding:utf8

from gevent import monkey; monkey.patch_os()

if __name__=="__main__":
    from gfirefly.master.master import Master
    master = Master()
    master.config('config.json','appmain.py')
    master.start()
    
    
Exemple #5
0
        debugSername = raw_input("Debug Server Name:")
    cmds = 'python %s %s' % (os.path.basename(argv[0]), MASTER_SERVER_MODE)
    subprocess.Popen(cmds, shell=True)
    sleep(3)

    config = json.load(open('config.json', 'r'))
    sersconf = config.get('servers')
    for sername in sersconf.keys():
        if sername == debugSername:
            continue
        cmds = 'python %s %s %s' % ('appmain.py', sername, 'config.json')
        subprocess.Popen(cmds, shell=True)

    dbconf = config.get('db')
    memconf = config.get('memcached')
    sersconf = config.get('servers', {})
    masterconf = config.get('master', {})
    serconfig = sersconf.get(debugSername)
    ser = FFServer()
    ser.config(serconfig,
               servername=debugSername,
               dbconfig=dbconf,
               memconfig=memconf,
               masterconf=masterconf)
    ser.start()
else:
    master = Master()
    master.config('config.json', 'appmain.py')
    master.masterapp()
    reactor.run()
Exemple #6
0
# -*- coding:utf-8 -*-

if __name__ == "__main__":
    from gfirefly.master.master import Master
    master = Master()
    master.config('config.json', "appmain.py")
    master.start()
Exemple #7
0
    # print(sys.exit())

    if os.path.exists('/tmp/server_list.json'):
        os.system("cp /tmp/server_list.json server_list.json")

    if os.path.exists('template.json'):
        template = open('template.json')
        str_template = template.read()
        if os.path.exists('my.json'):
            config = json.load(open('my.json'))
            replace_items = config.items()
        else:
            replace_items = DEFAULT_JSON.items()
        for k, v in replace_items:
            str_template = str_template.replace('<=%s=>' % k, v)

        fp = open('config.json', 'w')
        fp.write(str_template)
        fp.flush()
        fp.close()
    else:
        print 'can not find template.json'

    if not os.path.exists(CONFIG_FILE):
        print 'can not find config.json'
    else:
        from gfirefly.master.master import Master
        master = Master()
        master.config(CONFIG_FILE, 'appmain.py')
        master.start()
Exemple #8
0
#coding:utf8
'''
Created on 2013-8-2

@author: lan (www.9miao.com)
'''
    
def println(a):
    print a

if __name__=="__main__":
    from gfirefly.master.master import Master
    master = Master()
    master.config('config.json','test_server_main.py')
    master.start()