郭超 4 rokov pred
rodič
commit
b9ad121c3c

BIN
.DS_Store


+ 5 - 6
.idea/workspace.xml

@@ -2,12 +2,11 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="41dc853c-f418-44c7-ba5d-2164f3f0373a" name="Default" comment="">
+      <change afterPath="$PROJECT_DIR$/business/init-mongo.js" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/business/private-docker/mongo/setup.sh" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/business/docker-compose-multi.yml" beforeDir="false" afterPath="$PROJECT_DIR$/business/docker-compose-multi.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/business/nginx/conf.d/default.conf" beforeDir="false" afterPath="$PROJECT_DIR$/business/nginx/conf.d/default.conf" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/business/nginx/sites-enabled/default" beforeDir="false" afterPath="$PROJECT_DIR$/business/nginx/sites-enabled/default" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/business/private-docker/mongo/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/business/private-docker/mongo/Dockerfile" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/business/private-docker/mongo/setup.sh" beforeDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -102,7 +101,7 @@
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="aspect.path.notification.shown" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/business/private-docker/mongo/data" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/business/private-docker/mongo" />
     <property name="nodejs_interpreter_path" value="/usr/local/bin/node" />
     <property name="project.structure.last.edited" value="SDKs" />
     <property name="project.structure.proportion" value="0.15" />
@@ -116,11 +115,11 @@
       <recent name="$PROJECT_DIR$/business" />
     </key>
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="$PROJECT_DIR$/business/private-docker/mongo" />
       <recent name="$PROJECT_DIR$/business/private-docker/mongo/data" />
       <recent name="$PROJECT_DIR$/business/TestFileSystem" />
       <recent name="$PROJECT_DIR$/business" />
       <recent name="$PROJECT_DIR$/crowd/nginx" />
-      <recent name="$PROJECT_DIR$/crowd" />
     </key>
   </component>
   <component name="RunDashboard">
@@ -190,7 +189,7 @@
       <workItem from="1610264520879" duration="862000" />
       <workItem from="1610343907658" duration="548000" />
       <workItem from="1618465186243" duration="1756000" />
-      <workItem from="1622184011904" duration="21792000" />
+      <workItem from="1622184011904" duration="23911000" />
     </task>
     <servers />
   </component>

+ 1 - 0
business/docker-compose-multi.yml

@@ -12,6 +12,7 @@ services:
       - 27217:27017
     volumes:
       - ${FILE_STORE_BASE_PATH}/${MONGO_FILE_PATH}:/data/db
+      - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
     command: --bind_ip_all
     tty: true
 

+ 10 - 0
business/init-mongo.js

@@ -0,0 +1,10 @@
+db.createUser({
+    user: 'mooctest',
+    pwd: 'mooctest',
+    roles: [
+        {
+            role: 'readWrite',
+            db: 'test'
+        }
+    ]
+})

+ 3 - 1
business/private-docker/mongo/Dockerfile

@@ -2,9 +2,11 @@ FROM mongo
 
 ENV WORKSPACE /usr/local/work
 ENV AUTO_RUN_DIR /docker-entrypoint-initdb.d
+ENV INSTALL_MONGO_SHELL setup.sh
 
 RUN mkdir -p $WORKSPACE
 
-COPY ./data/*.json $WORKSPACE/
+COPY ./data/* $WORKSPACE/
+COPY ./$INSTALL_MONGO_SHELL $AUTO_RUN_DIR/
 
 RUN chmod a+x $AUTO_RUN_DIR/$INSTALL_MONGO_SHELL

+ 36 - 0
business/private-docker/mongo/setup.sh

@@ -0,0 +1,36 @@
+#!/bin/bash
+mongo << EOF
+use test
+EOF
+
+# db.createCollection("AggTaskStatus")
+# db.createCollection("answerNode")
+# db.createCollection("autoScore")
+# db.createCollection("basicNode")
+# db.createCollection("bug")
+# db.createCollection("BugData")
+# db.createCollection("bugDetail")
+# db.createCollection("bugHistory")
+# db.createCollection("bugMirror")
+# db.createCollection("bugPage")
+# db.createCollection("bugScore")
+# db.createCollection("bugSimilarScore")
+# db.createCollection("bugValidity")
+# db.createCollection("caseToBug")
+# db.createCollection("configuration")
+
+# mongoimport --db test --collection AggTaskStatus --file /usr/local/work/AggTaskStatus.json
+# mongoimport --db test --collection answerNode --file /usr/local/work/answerNode.json
+# mongoimport --db test --collection autoScore --file /usr/local/work/autoScore.json
+# mongoimport --db test --collection basicNode --file /usr/local/work/basicNode.json
+# mongoimport --db test --collection bug --file /usr/local/work/bug.json
+# mongoimport --db test --collection BugData --file /usr/local/work/BugData.json
+# mongoimport --db test --collection bugDetail --file /usr/local/work/bugDetail.json
+# mongoimport --db test --collection bugHistory --file /usr/local/work/bugHistory.json
+# mongoimport --db test --collection bugMirror --file /usr/local/work/bugMirror.json
+# mongoimport --db test --collection bugPage --file /usr/local/work/bugPage.json
+# mongoimport --db test --collection bugScore --file /usr/local/work/bugScore.json
+# mongoimport --db test --collection bugSimilarScore --file /usr/local/work/bugSimilarScore.json
+# mongoimport --db test --collection bugValidity --file /usr/local/work/bugValidity.json
+# mongoimport --db test --collection caseToBug --file /usr/local/work/caseToBug.json
+# mongoimport --db test --collection configuration --file /usr/local/work/configuration.json