コード例 #1
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Publish?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    active = getInput("Maximum documents the node will accepts?", "1000",
                      isInt)
    custom_opts["doc_limit"] = int(active)

    active = getInput(
        "Enter message size limit in octet. \n" +
        "This should the maximum data size the the node will accept", None,
        isInt)

    custom_opts["msg_size_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    must = __BasicPublishServiceTemplate()
    config_doc = must.render(**custom_opts)
    print config_doc
    doc = json.loads(config_doc)
    PublishDoc(server, dbname, doc["service_type"] + ":Basic Publish service",
               doc)
    print("Configured Basic Publish service:\n{0}\n".format(
        json.dumps(doc, indent=4, sort_keys=True)))
コード例 #2
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Publish?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    active = getInput("Maximum documents the node will accepts?", "1000",
                      isInt)
    custom_opts["doc_limit"] = int(active)

    active = getInput(
        "Enter message size limit in octet. \n" +
        "This should the maximum data size the the node will accept", 4194304,
        isInt)

    custom_opts["msg_size_limit"] = int(active)

    custom_opts["authz"] = []
    active = getInput("Secure publish with Basic Authentication?", "T",
                      isBoolean)
    if active:
        custom_opts["authz"].append("basicauth")

    active = getInput("Secure publish with OAuth and enable Node Signing?",
                      "T", isBoolean)
    if active:
        custom_opts["authz"].append("oauth")
        setupInfo["oauth"] = True

    if len(custom_opts["authz"]) == 0:
        del custom_opts["authz"]

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __BasicPublishServiceTemplate().install(server, dbname, custom_opts)
コード例 #3
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Obtain?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    active = getInput("Enable Basic Obtain Flow Control?", "F", isBoolean)
    custom_opts["flow_control"] = active.lower() in YES

    if custom_opts["flow_control"]:
        active = getInput("Maximum IDs to Return?", "100", isInt)
        custom_opts["id_limit"] = int(active)
        active = getInput("Maximum Docs to Return?", "100", isInt)
        custom_opts["doc_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    must = __BasicObtainServiceTemplate()
    config_doc = must.render(**custom_opts)
    print config_doc
    doc = json.loads(config_doc)
    PublishDoc(server, dbname, doc["service_type"] + ":Basic Obtain service",
               doc)
    print("Configured Basic Obtain service:\n{0}\n".format(
        json.dumps(doc, indent=4, sort_keys=True)))
コード例 #4
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Publish?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    
    active = getInput("Maximum documents the node will accepts?", "1000", isInt)
    custom_opts["doc_limit"] = int(active)

    active = getInput("Enter message size limit in octet. \n"+
                    "This should the maximum data size the the node will accept", 4194304, isInt)

    custom_opts["msg_size_limit"] = int(active)

    custom_opts["authz"] = []
    active = getInput("Secure publish with Basic Authentication?", "T", isBoolean)
    if active:
        custom_opts["authz"].append("basicauth")

    active = getInput("Secure publish with OAuth and enable Node Signing?", "T", isBoolean)
    if active:
        custom_opts["authz"].append("oauth")
        setupInfo["oauth"] = True

    if len(custom_opts["authz"]) == 0:
        del custom_opts["authz"]

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    return __BasicPublishServiceTemplate().install(server, dbname, custom_opts)
コード例 #5
0
def getNGINXSiteConfig(setupInfo, ini_config):
    import setup_utils, urlparse

    std_nginx_log = [
        "/var/log/nginx",
        "/usr/local/var/log"
    ]

    std_nginx_cfg = [
        "/etc/nginx",
        "/usr/local/etc/nginx"
    ]

    def_nginx_log = getFirstValidDefaultFromList(std_nginx_log, checkDirectoryExists)
    def_nginx_cfg = getFirstValidDefaultFromList(std_nginx_cfg, checkFileExists)

    context = {
        "id_management": setupInfo["oauth.app.name"],
        "couchapp_db": ini_config.get("app:main", "couchdb.db.apps"),
        "couchdb": ini_config.get("app:main","couchdb.url"),
        "uwsgi_app": ini_config.get("uwsgi", "socket"),
        "port_https": 443,
        "nginx_logs": def_nginx_log,
        "port_http": 80,
        "ssl_certificate": "%s/certs/server.crt" % def_nginx_cfg,
        "ssl_certificate_key": "%s/certs/server.key" % def_nginx_cfg
    }

    node_url = urlparse.urlsplit(setupInfo['nodeUrl'])
    if node_url.scheme == 'http':
        if node_url.port:
            context["port_http"] = node_url.port

        context["port_https"] = None
    elif node_url.scheme == 'https' and node_url.port:
        context["port_https"] = node_url.port
        context["port_http"] = node_url.port - 443 + 80

        context["port_http"] = setup_utils.getInput("Enter the HTTP (non-SSL) port number the node will operate", context["port_http"])
        context["ssl_certificate"] = setup_utils.getInput("Enter the absolute path to your SSL Certificate", context["ssl_certificate"], validateFunc=checkFileExists)
        context["ssl_certificate_key"] = setup_utils.getInput("Enter the absolute path to your SSL Certificate Key", context["ssl_certificate_key"], validateFunc=checkFileExists)

    context["nginx_logs"] = setup_utils.getInput("Enter the absolute path to the NGINX log directory", context["nginx_logs"])

    if context["port_https"]:
        return getSSLSiteConfig(context)
    else:
        return getSiteConfig(context)
コード例 #6
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Resource Data Distribution Policy?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES
    
    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return  __ResourceDataDistributionPolicyServiceTemplate().install(server, dbname, custom_opts)
コード例 #7
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Network Node Status?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES
    
    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __NetworkNodeStatusServiceTemplate().install(server, dbname, custom_opts)
コード例 #8
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Harvest?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    active = getInput("Enable Basic Harvest Flow Control?", "T", isBoolean)
    custom_opts["flow_control"] = active.lower() in YES

    if custom_opts["flow_control"]:
        active = getInput("Maximum IDs to Return?", "100", isInt)
        custom_opts["id_limit"] = int(active)
        active = getInput("Maximum Docs to Return?", "100", isInt)
        custom_opts["doc_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __BasicHarvestServiceTemplate().install(server, dbname, custom_opts)
コード例 #9
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Resource Data Distribution?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    return __ResourceDataDistributionServiceTemplate().install(server, dbname, custom_opts)
コード例 #10
0
ファイル: Slice.py プロジェクト: ljwolford/LearningRegistry
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Slice?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES
    
    active = getInput("Enable Flow Control for Slice?", "T", isBoolean)
    custom_opts["flow_control"] = active.lower() in YES
    
    if custom_opts["flow_control"]:
        active = getInput("Maximum IDs to Return?", "100", isInt)
        custom_opts["id_limit"] = int(active)
        active = getInput("Maximum Docs to Return?", "100", isInt)
        custom_opts["doc_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __SliceServiceTemplate().install(server, dbname, custom_opts)
コード例 #11
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Publish?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    
    active = getInput("Maximum documents the node will accepts?", "1000", isInt)
    custom_opts["doc_limit"] = int(active)

    active = getInput("Enter message size limit in octet. \n"+
                    "This should the maximum data size the the node will accept", None, isInt)

    custom_opts["msg_size_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    return __BasicPublishServiceTemplate().install(server, dbname, custom_opts)
コード例 #12
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Network Node Services?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __NetworkNodeServicesServiceTemplate().install(
        server, dbname, custom_opts)
コード例 #13
0
def prompt():
    import setup_utils
    context = {}
    context.update(def_context)

    context["LR_BASE"] = setup_utils.getInput("Base Learning Registry Directory", context["LR_BASE"], checkDirectoryExists)

    possible = [
        "/var",
        "/usr/local/var"
    ]

    context["VAR_DIR"] = setup_utils.getInput("var directory", getFirstValidDefaultFromList(possible, checkDirectoryExists), checkDirectoryExists)


    context["LR_USER"] = setup_utils.getInput("Enter the user that LR process will run as", context["LR_USER"])
    context["LR_GRP"] = setup_utils.getInput("Enter the group that LR process will run as", context["LR_GRP"])

    return context
コード例 #14
0
def prompt():
    import setup_utils
    context = {}
    context.update(def_context)

    context["LR_BASE"] = setup_utils.getInput(
        "Base Learning Registry Directory", context["LR_BASE"],
        checkDirectoryExists)

    possible = ["/var", "/usr/local/var"]

    context["VAR_DIR"] = setup_utils.getInput(
        "var directory",
        getFirstValidDefaultFromList(possible, checkDirectoryExists),
        checkDirectoryExists)

    context["LR_USER"] = setup_utils.getInput(
        "Enter the user that LR process will run as", context["LR_USER"])
    context["LR_GRP"] = setup_utils.getInput(
        "Enter the group that LR process will run as", context["LR_GRP"])

    return context
コード例 #15
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Network Node Description?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    must = __NetworkNodeDescriptionServiceTemplate()
    config_doc = must.render(**custom_opts)
    print config_doc
    doc = json.loads(config_doc)
    PublishDoc(server, dbname, doc["service_type"] + ":Network Node Description service", doc)
    print ("Configured Network Node Description service:\n{0}\n".format(json.dumps(doc, indent=4, sort_keys=True)))
コード例 #16
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable OAI-PMH Harvest?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES
    
    active = getInput("Enable OAI-PMH Flow Control?", "F", isBoolean)
    custom_opts["flow_control"] = active.lower() in YES
    
    if custom_opts["flow_control"]:
        active = getInput("Maximum IDs to Return?", "100", isInt)
        custom_opts["id_limit"] = int(active)
        active = getInput("Maximum Docs to Return?", "100", isInt)
        custom_opts["doc_limit"] = int(active)
        
        
    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    must = __OaiServiceTemplate()
    config_doc = must.render(**custom_opts)
    doc = json.loads(config_doc)
    PublishDoc(server, dbname, doc["service_type"]+":OAI-PMH service", doc)
    print("Configured OAI-PMH Harvest service:\n{0}\n".format(json.dumps(doc, indent=4, sort_keys=True)))
コード例 #17
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable SWORD Service?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["authz"] = []
    active = getInput("Secure publish with Basic Authentication?", "T", isBoolean)
    if active:
        custom_opts["authz"].append("basicauth")

    active = getInput("Secure publish with OAuth and enable Node Signing?", "T", isBoolean)
    if active:
        custom_opts["authz"].append("oauth")
        setupInfo["oauth"] = True

    if len(custom_opts["authz"]) == 0:
        del custom_opts["authz"]


    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    return __BasicSwordServiceTemplate().install(server, dbname, custom_opts)
コード例 #18
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable SWORD Service?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["authz"] = []
    active = getInput("Secure publish with Basic Authentication?", "T",
                      isBoolean)
    if active:
        custom_opts["authz"].append("basicauth")

    active = getInput("Secure publish with OAuth and enable Node Signing?",
                      "T", isBoolean)
    if active:
        custom_opts["authz"].append("oauth")
        setupInfo["oauth"] = True

    if len(custom_opts["authz"]) == 0:
        del custom_opts["authz"]

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    return __BasicSwordServiceTemplate().install(server, dbname, custom_opts)
コード例 #19
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Basic Publish?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    
    active = getInput("Maximum documents the node will accepts?", "1000", isInt)
    custom_opts["doc_limit"] = int(active)

    active = getInput("Enter message size limit in octet. \n"+
                    "This should the maximum data size the the node will accept", None, isInt)

    custom_opts["msg_size_limit"] = int(active)

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex
    
    
    must = __BasicPublishServiceTemplate()
    config_doc = must.render(**custom_opts)
    print config_doc
    doc = json.loads(config_doc)
    PublishDoc(server, dbname,doc["service_type"]+":Basic Publish service", doc)
    print("Configured Basic Publish service:\n{0}\n".format(json.dumps(doc, indent=4, sort_keys=True)))
コード例 #20
0
def install(server, dbname, setupInfo):
    custom_opts = {}
    active = getInput("Enable Network Node Description?", "T", isBoolean)
    custom_opts["active"] = active.lower() in YES

    custom_opts["node_endpoint"] = setupInfo["nodeUrl"]
    custom_opts["service_id"] = uuid.uuid4().hex

    must = __NetworkNodeDescriptionServiceTemplate()
    config_doc = must.render(**custom_opts)
    print config_doc
    doc = json.loads(config_doc)
    PublishDoc(server, dbname,
               doc["service_type"] + ":Network Node Description service", doc)
    print("Configured Network Node Description service:\n{0}\n".format(
        json.dumps(doc, indent=4, sort_keys=True)))
コード例 #21
0
        appsPath = os.path.join(sourceDirPath, db_name, 'apps')
        if os.path.exists(appsPath) and os.path.isdir(appsPath):
            for app in os.listdir(appsPath):
                appDir = os.path.join(appsPath, app)
                if os.path.isdir(appDir):
                    pushCouchApp(appDir, destURL)


if __name__ == "__main__":
    from setup_utils import getInput

    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)

    def doesNotEndInSlash(input=None):
        return input is not None and input[-1] != "/"

    def dirExists(input=None):
        return input is not None and os.path.exists(input) and os.path.isdir(
            input)

    scriptPath = os.path.dirname(os.path.abspath(__file__))
    defaultPath = os.path.join(scriptPath, "..", "couchdb")

    couchDBUrl = getInput("Enter your couchDB server URL",
                          "http://127.0.0.1:5984", doesNotEndInSlash)

    couchApps = getInput("Enter the base directory to the CouchApps",
                         defaultPath, dirExists)

    pushAllCouchApps(couchApps, couchDBUrl)
コード例 #22
0
            "service_key": "false", 
            "service_https": "false",
            "service_type": "access",
            "spec_kv_only": None,
            "flow_control": False,
            "id_limit": False,
            "doc_limit": False         
        }
        return opts
        
if __name__ == "__main__":
    import couchdb
    
    nodeSetup = {
                 'couchDBUrl': "http://localhost:5984",
                 'nodeUrl': "http://test.example.com"
    }
    
    def doesNotEndInSlash(input=None):
        return input is not None and input[-1] != "/"
    
    def notExample(input=None):
        return input is not None and input != nodeSetup["nodeUrl"]
    
    nodeSetup["couchDBUrl"] = getInput("Enter the CouchDB URL:", nodeSetup["couchDBUrl"], doesNotEndInSlash)
    nodeSetup["nodeUrl"] = getInput("Enter the public URL of the LR Node", nodeSetup["nodeUrl"], notExample)
    
    server =  couchdb.Server(url= nodeSetup['couchDBUrl'])
    install(server, "node", nodeSetup)
    
コード例 #23
0
                appDir = os.path.join(appsPath, app)
                if os.path.isdir(appDir):
                    pushCouchApp(appDir, destURL)
                    
        




if __name__ == "__main__":
    from setup_utils import getInput
    
    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
    
    def doesNotEndInSlash(input=None):
        return input is not None and input[-1] != "/"
    
    def dirExists(input=None):
        return input is not None and os.path.exists(input) and os.path.isdir(input)
    
    scriptPath = os.path.dirname(os.path.abspath(__file__))
    defaultPath = os.path.join(scriptPath, "..", "couchdb")
    
    couchDBUrl = getInput("Enter your couchDB server URL", "http://127.0.0.1:5984", doesNotEndInSlash)
        
    couchApps = getInput("Enter the base directory to the CouchApps", defaultPath, dirExists)
    
    pushAllCouchApps(couchApps, couchDBUrl)
    
    
    
コード例 #24
0
            "service_https": "false",
            "service_type": "access",   
            "spec_kv_only": False,
            "flow_control": False,
            "id_limit": None,
            "doc_limit":None
        }
        return opts
 

if __name__ == "__main__":
    import couchdb
    
    nodeSetup = {
                 'couchDBUrl': "http://localhost:5984",
                 'node_service_endpoint_url': "http://test.example.com"
    }
    
    def doesNotEndInSlash(input=None):
        return input is not None and input[-1] != "/"
    
    def notExample(input=None):
        return input is not None and input != nodeSetup["nodeUrl"]
    
    nodeSetup["couchDBUrl"] = getInput("Enter the CouchDB URL:", nodeSetup["couchDBUrl"], doesNotEndInSlash)
    nodeSetup["nodeUrl"] = getInput("Enter the public URL of the LR Node", nodeSetup["nodeUrl"], notExample)
    
    server =  couchdb.Server(url= nodeSetup['couchDBUrl'])
    install(server, "node", nodeSetup)