From e80a3901ab3ae61286488eeaf247d073b12316af Mon Sep 17 00:00:00 2001 From: Tyler Cox Date: Thu, 25 May 2017 09:35:37 -0500 Subject: [PATCH] Contributed Project Fuse source code Signed-off-by: Tyler Cox --- .gitignore | 56 +++++++++ README.md | 5 + docker-compose.yml | 274 ++++++++++++++++++++++++++++++++++++++++++++ init_mongo.js | 115 +++++++++++++++++++ init_shell.bat | 1 + startdb-no-auth.bat | 6 + startdb.bat | 6 + 7 files changed, 463 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 init_mongo.js create mode 100644 init_shell.bat create mode 100644 startdb-no-auth.bat create mode 100644 startdb.bat diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa01b46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +### /.gitignore-boilerplates/Global/Eclipse.gitignore +*.pydevproject +.metadata +bin/ +tmp/** +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath +*/target/** + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +### .gitignore-boilerplates/Global/OSX.gitignore +.DS_Store +.AppleDouble +.LSOverride +Icon + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +### .gitignore-boilerplates/Java.gitignore +*.class + +# Package Files # +*.jar +*.war +*.ear + +# Intellij +.idea/ +*.iml +*.iws + +# Maven +log/ +target/ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8573db --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Main Author: Jim White + +Copyright 2016-17, Dell, Inc. + +This repos contains scripts, batch files, JSON used in REST calls and other miscellaneous items used by developers buiding EdgeX. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f942589 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,274 @@ +## EdgeX Foundry docker compose file + +version: '2' +services: + volume: + image: dellfuse/docker-edgex-volume + container_name: edgex-files + networks: + - edgex-network + volumes: + - /data/db + - /edgex/logs + - /consul/config + - /consul/data + + consul: + image: dellfuse/docker-core-consul + ports: + - "8400:8400" + - "8500:8500" + - "8600:8600" + container_name: edgex-core-consul + hostname: edgex-core-consul + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + + config-seed: + image: dellfuse/docker-core-config-seed + container_name: edgex-config-seed + hostname: edgex-core-config-seed + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + + mongo: + image: dellfuse/docker-edgex-mongo + ports: + - "27017:27017" + container_name: edgex-mongo + hostname: edgex-mongo + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + command: --smallfiles + + mongo-seed: + image: dellfuse/docker-edgex-mongo-seed + container_name: edgex-mongo-seed + hostname: edgex-mongo-seed + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - mongo + + logging: + image: dellfuse/docker-support-logging + ports: + - "48061:48061" + container_name: edgex-support-logging + hostname: edgex-support-logging + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + + notifications: + image: dellfuse/docker-support-notifications + ports: + - "48060:48060" + container_name: edgex-support-notifications + hostname: edgex-support-notifications + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + + metadata: + image: dellfuse/docker-core-metadata + ports: + - "48081:48081" + container_name: edgex-core-metadata + hostname: edgex-core-metadata + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + + data: + image: dellfuse/docker-core-data + ports: + - "48080:48080" + - "5563" + container_name: edgex-core-data + hostname: edgex-core-data + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - notifications + + command: + image: dellfuse/docker-core-command + ports: + - "48082:48082" + container_name: edgex-core-command + hostname: edgex-core-command + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - metadata + + scheduler: + image: dellfuse/docker-support-scheduler + ports: + - "48085:48085" + container_name: edgex-support-scheduler + hostname: edgex-support-scheduler + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - metadata + - command + + export-client: + image: dellfuse/docker-export-client + ports: + - "48071:48071" + container_name: edgex-export-client + hostname: edgex-export-client + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - notifications + - metadata + - data + + export-distro: + image: dellfuse/docker-export-distro + ports: + - "48070:48070" + - "5566" + container_name: edgex-export-distro + hostname: edgex-export-distro + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - notifications + - metadata + - data + - export-client + + rulesengine: + image: dellfuse/docker-support-rulesengine + ports: + - "48075:48075" + container_name: edgex-support-rulesengine + hostname: edgex-support-rulesengine + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - metadata + - command + - export-distro + +################################################################# +# Device Services +################################################################# + + device-virtual: + image: dellfuse/docker-device-virtual + ports: + - "49990:49990" + container_name: edgex-device-virtual + hostname: edgex-device-virtual + networks: + - edgex-network + volumes_from: + - volume + depends_on: + - volume + - consul + - config-seed + - mongo + - mongo-seed + - logging + - metadata + - data + - command + +networks: + edgex-network: + driver: "bridge" +... diff --git a/init_mongo.js b/init_mongo.js new file mode 100644 index 0000000..7c366a0 --- /dev/null +++ b/init_mongo.js @@ -0,0 +1,115 @@ +//############################################################################### +//# Copyright 2016-2017 Dell Inc. +//# +//# Licensed under the Apache License, Version 2.0 (the "License"); +//# you may not use this file except in compliance with the License. +//# You may obtain a copy of the License at +//# +//# http://www.apache.org/licenses/LICENSE-2.0 +//# +//# Unless required by applicable law or agreed to in writing, software +//# distributed under the License is distributed on an "AS IS" BASIS, +//# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//# See the License for the specific language governing permissions and +//# limitations under the License. +//# +//############################################################################### +//EdgeX Mongo DB initialization script +//version 1 +//author: Jim White +//Create user for security service in Mongo +db=db.getSiblingDB('admin') +db=db.getSiblingDB('authorization') +db.createUser({ user: "admin",pwd: "password",roles: [ { role: "readWrite", db: "authorization" } ]}); +//Create keystore collection +db.createCollection("keyStore"); +db.keyStore.insert( { xDellAuthKey: "x-dell-auth-key", secretKey: "EDGEX_SECRET_KEY" } ); +//Create Service Mapping +db.createCollection("serviceMapping"); +db.serviceMapping.insert( { serviceName: "coredata", serviceUrl: "http://localhost:48080/" }); +db.serviceMapping.insert( { serviceName: "metadata", serviceUrl: "http://localhost:48081/" }); +db.serviceMapping.insert( { serviceName: "command", serviceUrl: "http://localhost:48082/" }); +db.serviceMapping.insert( { serviceName: "rules", serviceUrl: "http://localhost:48084/" }); +db.serviceMapping.insert( { serviceName: "notifications", serviceUrl: "http://localhost:48060/" }); +db.serviceMapping.insert( { serviceName: "logging", serviceUrl: "http://localhost:48061/" }); + +db=db.getSiblingDB('admin') +db.system.users.remove({}); +db.system.version.remove({}); +db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 }); +db=db.getSiblingDB('admin') +db.createUser({ user: "admin", + pwd: "password", + roles: [ + { role: "readWrite", db: "admin" } + ] +}); + +db=db.getSiblingDB('metadata') +db.createUser({ user: "meta", + pwd: "password", + roles: [ + { role: "readWrite", db: "metadata" } + ] +}); +db.createCollection("addressable"); +db.addressable.createIndex({name: 1}, {unique: true}); +db.createCollection("command"); +db.createCollection("device"); +db.device.createIndex({name: 1}, {unique: true}); +db.createCollection("deviceManager"); +db.deviceManager.createIndex({name: 1}, {unique: true}); +db.createCollection("deviceProfile"); +db.deviceProfile.createIndex({name: 1}, {unique: true}); +db.createCollection("deviceReport"); +db.deviceReport.createIndex({name: 1}, {unique: true}); +db.createCollection("deviceService"); +db.deviceService.createIndex({name: 1}, {unique: true}); +db.createCollection("provisionWatcher"); +db.provisionWatcher.createIndex({name: 1}, {unique: true}); +db.createCollection("schedule"); +db.schedule.createIndex({name: 1}, {unique: true}); +db.createCollection("scheduleEvent"); +db.scheduleEvent.createIndex({name: 1}, {unique: true}); + +db=db.getSiblingDB('coredata') +db.createUser({ user: "core", + pwd: "password", + roles: [ + { role: "readWrite", db: "coredata" } + ] +}); +db.createCollection("event"); +db.createCollection("reading"); +db.createCollection("valueDescriptor"); +db.valueDescriptor.createIndex({name: 1}, {unique: true}); + +db=db.getSiblingDB('rules_engine_db') +db.createUser({ user: "rules_engine_user", + pwd: "password", + roles: [ + { role: "readWrite", db: "rules_engine_db" } + ] +}); + +db=db.getSiblingDB('notifications') +db.createUser({ user: "notifications", + pwd: "password", + roles: [ + { role: "readWrite", db: "notifications" } + ] +}); +db.createCollection("notification"); +db.createCollection("transmission"); +db.createCollection("subscription"); +db.notification.createIndex({slug: 1}, {unique: true}); +db.subscription.createIndex({slug: 1}, {unique: true}); + +db=db.getSiblingDB('logging') +db.createUser({ user: "logging", + pwd: "password", + roles: [ + { role: "readWrite", db: "logging" } + ] +}); +db.createCollection("logEntry"); diff --git a/init_shell.bat b/init_shell.bat new file mode 100644 index 0000000..8f7ecfc --- /dev/null +++ b/init_shell.bat @@ -0,0 +1 @@ +"C:\Program Files\MongoDB\Server\3.0\bin\mongo.exe" "init_mongo.js" \ No newline at end of file diff --git a/startdb-no-auth.bat b/startdb-no-auth.bat new file mode 100644 index 0000000..e7a8764 --- /dev/null +++ b/startdb-no-auth.bat @@ -0,0 +1,6 @@ +:PUBLIC +@ECHO PUBLIC PATH +start "" "C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe" --dbpath "C:\Users\Public\mongodb\db" +GOTO END + +:END diff --git a/startdb.bat b/startdb.bat new file mode 100644 index 0000000..c5ee2cf --- /dev/null +++ b/startdb.bat @@ -0,0 +1,6 @@ +:PUBLIC +@ECHO PUBLIC PATH +start "" "C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe" --dbpath "C:\Users\Public\mongodb\db" --auth +GOTO END + +:END \ No newline at end of file