You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by ad...@apache.org on 2019/10/09 08:13:09 UTC

[incubator-dlab] 01/01: Added local_endpoint.json (for local endpoint in MongoDB).

This is an automated email from the ASF dual-hosted git repository.

adamsd pushed a commit to branch DLAB-1145
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 1e240e419cf830cc16caaf5bf488cde5a972e001
Author: AdamsDisturber <ad...@gmail.com>
AuthorDate: Wed Oct 9 11:12:53 2019 +0300

    Added local_endpoint.json (for local endpoint in MongoDB).
---
 infrastructure-provisioning/src/general/files/aws/base_Dockerfile | 1 +
 .../src/general/files/azure/base_Dockerfile                       | 1 +
 infrastructure-provisioning/src/general/files/gcp/base_Dockerfile | 1 +
 .../src/general/files/os/local_endpoint.json                      | 6 ++++++
 infrastructure-provisioning/src/ssn/scripts/configure_mongo.py    | 8 ++++----
 infrastructure-provisioning/src/ssn/scripts/configure_ui.py       | 4 ++++
 6 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/src/general/files/aws/base_Dockerfile b/infrastructure-provisioning/src/general/files/aws/base_Dockerfile
index f3ef362..ffbe54d 100644
--- a/infrastructure-provisioning/src/general/files/aws/base_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/base_Dockerfile
@@ -70,6 +70,7 @@ COPY ${SRC_PATH}general/lib/os/${OS}/common_lib.py /usr/lib/python2.7/dlab/commo
 COPY ${SRC_PATH}general/lib/os/fab.py /usr/lib/python2.7/dlab/fab.py
 COPY ${SRC_PATH}general/files/os/${OS}/sources.list /root/files/
 COPY ${SRC_PATH}general/files/os/ivysettings.xml /root/templates/
+COPY ${SRC_PATH}general/files/os/local_endpoint.json /root/files/
 COPY ${SRC_PATH}project/templates/locations/ /root/locations/
 
 RUN chmod a+x /root/*.py && \
diff --git a/infrastructure-provisioning/src/general/files/azure/base_Dockerfile b/infrastructure-provisioning/src/general/files/azure/base_Dockerfile
index 04d6ed5..68ce799 100644
--- a/infrastructure-provisioning/src/general/files/azure/base_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/azure/base_Dockerfile
@@ -70,6 +70,7 @@ COPY ${SRC_PATH}general/lib/os/${OS}/common_lib.py /usr/lib/python2.7/dlab/commo
 COPY ${SRC_PATH}general/lib/os/fab.py /usr/lib/python2.7/dlab/fab.py
 COPY ${SRC_PATH}general/files/os/${OS}/sources.list /root/files/
 COPY ${SRC_PATH}general/files/os/ivysettings.xml /root/templates/
+COPY ${SRC_PATH}general/files/os/local_endpoint.json /root/files/
 COPY ${SRC_PATH}project/templates/locations/ /root/locations/
 
 RUN chmod a+x /root/*.py && \
diff --git a/infrastructure-provisioning/src/general/files/gcp/base_Dockerfile b/infrastructure-provisioning/src/general/files/gcp/base_Dockerfile
index fe9f0cb..8a66b82 100644
--- a/infrastructure-provisioning/src/general/files/gcp/base_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/gcp/base_Dockerfile
@@ -70,6 +70,7 @@ COPY ${SRC_PATH}general/lib/os/${OS}/common_lib.py /usr/lib/python2.7/dlab/commo
 COPY ${SRC_PATH}general/lib/os/fab.py /usr/lib/python2.7/dlab/fab.py
 COPY ${SRC_PATH}general/files/os/${OS}/sources.list /root/files/
 COPY ${SRC_PATH}general/files/os/ivysettings.xml /root/templates/
+COPY ${SRC_PATH}general/files/os/local_endpoint.json /root/files/
 COPY ${SRC_PATH}project/templates/locations/ /root/locations/
 
 RUN chmod a+x /root/*.py && \
diff --git a/infrastructure-provisioning/src/general/files/os/local_endpoint.json b/infrastructure-provisioning/src/general/files/os/local_endpoint.json
new file mode 100644
index 0000000..5178414
--- /dev/null
+++ b/infrastructure-provisioning/src/general/files/os/local_endpoint.json
@@ -0,0 +1,6 @@
+{
+    "name" : "local",
+    "url" : "https://localhost:8084/",
+    "account" : "local",
+    "endpoint_tag" : "local"
+}
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py b/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
index 2890a51..1cd5eb5 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_mongo.py
@@ -85,10 +85,10 @@ if __name__ == "__main__":
         client.dlabdb.add_user('admin', mongo_passwd, roles=[{'role':'userAdminAnyDatabase','db':'admin'}])
         client.dlabdb.command('grantRolesToUser', "admin", roles=["readWrite"])
         # set_mongo_parameters(client, mongo_parameters)
-        # with open(args.dlab_path + 'tmp/mongo_roles.json', 'r') as data:
-        #     json_data = json.load(data)
-        # for i in json_data:
-        #     client.dlabdb.roles.insert_one(i)
+        with open(args.dlab_path + 'tmp/local_endpoint.json', 'r') as data:
+            json_data = json.load(data)
+        for i in json_data:
+            client.dlabdb.roles.insert_one(i)
         # client.dlabdb.security.create_index("expireAt", expireAfterSeconds=7200)
         if add_2_yml_config(path,'security','authorization','enabled'):
             command = ['service', 'mongod', 'restart']
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
index 12cc6a6..4b703f9 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
@@ -122,7 +122,11 @@ def configure_mongo(mongo_passwd):
         local('scp -i {} /root/files/{}/mongo_roles.json {}:/tmp/mongo_roles.json'.format(args.keyfile,
                                                                                           args.cloud_provider,
                                                                                           env.host_string))
+        local('scp -i {} /root/files/{}/local_endpoint.json {}:/tmp/local_endpoint.json'.format(args.keyfile,
+                                                                                                args.cloud_provider,
+                                                                                                env.host_string))
         sudo('mv /tmp/mongo_roles.json ' + args.dlab_path + 'tmp/')
+        sudo('mv /tmp/local_endpoint.json ' + args.dlab_path + 'tmp/')
         sudo("python " + args.dlab_path + "tmp/configure_mongo.py --dlab_path {} ".format(
             args.dlab_path))
     except Exception as err:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org