diff --git a/.gitmodules b/.gitmodules index e69de29bb..c858df312 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,18 @@ +[submodule "predix-sdks"] + path = predix-sdks + url = https://github.com/PredixDev/predix-sdks.git +[submodule "data-exchange"] + path = data-exchange + url = https://github.com/PredixDev/data-exchange.git +[submodule "data-exchange-simulator"] + path = data-exchange-simulator + url = https://github.com/PredixDev/data-exchange-simulator.git +[submodule "rmd-datasource"] + path = rmd-datasource + url = https://github.com/PredixDev/rmd-datasource.git +[submodule "predix-webapp-starter"] + path = predix-webapp-starter + url = https://github.com/PredixDev/predix-webapp-starter.git +[submodule "predix-websocket-server"] + path = predix-websocket-server + url = https://github.com/PredixDev/predix-websocket-server.git diff --git a/COPYRIGHT.md b/COPYRIGHT.md new file mode 100644 index 000000000..5bc03a677 --- /dev/null +++ b/COPYRIGHT.md @@ -0,0 +1 @@ +The dependencies in this project are resolved by Maven pom.xml. Copyrights from those projects are included [here](http://predixdev.github.io/rmd-ref-app-copyright/). This list may be a superset of projects actually referenced by this project. diff --git a/Jenkinsfile_example b/Jenkinsfile_example new file mode 100644 index 000000000..cd987b746 --- /dev/null +++ b/Jenkinsfile_example @@ -0,0 +1,204 @@ +#!/usr/bin/env groovy +@Library('devrel') _ +def complianceEnabled = true; +def pullRequest = env.CHANGE_ID +def pullTarget = env.CHANGE_TARGET +def org = "adoption" +def repoName = "predix-rmd-ref-app" +def branchName = env.BRANCH_NAME +def jobName = "app-predix-rmd-ref-app" +def devMvnSettings = "mvn_settings_snapshot_with_external.xml" +def buildDependencyJobs = "" +def dependencyRepos = "local-setup, predix-scripts, data-exchange-simulator, predix-webapp-starter, rmd-datasource, predix-websocket-server" +def dependencyJobs = "util-local-setup, util-predix-scripts, MS-data-exchange-simulator, app-predix-webapp-starter, MS-rmd-datasource, MS-predix-websocket-server" +def quickstartScript = "quickstart-rmd-ref-app.sh" +def uiAppName = "" +def uiTestJobName = "" + +pipeline { + agent { + docker { + image 'predixadoption/devrelprediximage:latest' + label 'dind' + } + } + environment { + COMPLIANCEENABLED = true + CF_AWS_CREDS = credentials('cf_aws_creds') + DEVCLOUD_ARTIFACTORY_CREDS = credentials('devcloud_artifactory_creds') + EXT_GITHUB_CREDS = credentials('external_git_creds') + EXT_ARTIFACTORY_USER_CREDS = credentials('external_artifactory_user_creds') + } + parameters { + string(name: 'BUILD', defaultValue: 'true', description: 'checkout, build, test and/or deploy') + string(name: 'INCREMENT', defaultValue: 'none', description: 'increment version - patch | major | minor') + string(name: 'INCREMENT_DEPENDENCIES', defaultValue: 'false', description: 'point at latest dependencies in develop') + string(name: 'MERGE_MASTER', defaultValue: 'false', description: 'merge to master') + string(name: 'RELEASE', defaultValue: 'false', description: 'release master to production') + string(name: 'SMOKE_TEST', defaultValue: 'false', description: 'run smoketests in production') + string(name: 'MORE_SWITCHES', defaultValue: '', description: 'more things for quickstart to do') + string(name: 'INSTANCE_PREFIX', defaultValue: 'rmd-ref-app', description: 'this is a prefix added to app names and service names to make them unique') + string(name: 'POPS', defaultValue: 'uswest,useast,frankfurt,japan', description: 'one or more of these: uswest,useast,frankfurt,japan') + string(name: 'LIVE_PUSH', defaultValue: 'false', description: 'deploy live app to uswest') + } + stages { + stage("Checkout" ) { + steps { + echo "The workspace is ${env.WORKSPACE}" + script { + echo 'Stage Checkout' + internalrelease.checkoutPropelSharedLibrary() + } + } + post { + success { + echo "Checkout stage completed successfully" + } + failure { + echo "Checkout stage failed" + } + } + } + stage("Build, Test, Deploy" ) { + when { + allOf { environment name: 'BUILD', value: 'true'; environment name: 'MERGE_MASTER', value: 'false'; environment name: 'INCREMENT', value: 'none'; environment name: 'INCREMENT_DEPENDENCIES', value: 'false'; environment name: 'RELEASE', value: 'false'; environment name: 'SMOKE_TEST', value: 'false'; } + } + steps { + script { + echo 'Stage Build, Test, Deploy' + internalrelease.build(org, repoName, branchName, jobName, buildDependencyJobs.split(','), devMvnSettings, quickstartScript) + } + } + post { + success { + echo "Build, Test, Deploy stage completed successfully" + } + failure { + script { + echo "Build, Test, Deploy stage failed" + internalrelease.buildFailed(repoName) + } + } + } + } + stage('MergeToDevelop') { + when { + environment name: 'CHANGE_TARGET', value: 'develop' + } + steps { + script { + echo 'Stage MergeToDevelop' + internalrelease.mergeToDevelop() + } + } + } + stage('IncrementVersion') { + when { + branch 'develop' + environment name: 'INCREMENT', value: 'patch' + } + steps { + script { + echo 'Stage Increment - run this stage to increment version on develop' + internalrelease.incrementVersion(org, repoName, env.INCREMENT, "mvn_settings_snapshot_with_external.xml") + } + } + post { + success { + echo "IncrementVersion stage completed, time to trigger increment dependencies on dependent projects to point at my new version" + } + failure { + echo "Increment stage failed" + } + } + } + stage('IncrementVersionInDependencies') { + when { + branch 'develop' + environment name: 'INCREMENT_DEPENDENCIES', value: 'true' + } + steps { + script { + echo 'Stage IncrementVersionInDependencies - run this stage - when versions of dependencies have changed, to point at latest versio of that dependency' + internalrelease.incrementDependencies(org, repoName) + } + } + post { + success { + echo "incrementDependencies stage completed successfully" + } + failure { + echo "incrementDependencies stage failed" + } + } + } + stage('MergeMaster') { + when { + branch 'develop' + anyOf { environment name: 'MERGE_MASTER', value: 'true'; } + } + steps { + script { + internalrelease.mergeToMaster(org, repoName, dependencyRepos, dependencyJobs) + build job: "app-predix-rmd-ref-app/develop",parameters: [[$class: 'StringParameterValue', name: 'INCREMENT', value: 'patch'], [$class: 'StringParameterValue', name: 'BUILD', value: 'false']] ,propagate: false, wait: false + } + } + post { + success { + echo "MergeMaster completed successfully" + } + failure { + echo "MergeMaster failed" + } + } + } + stage("Release, SmokeTest" ) { + when { + environment name: 'RELEASE', value: 'true' + } + steps { + script { + echo 'Stage Release, SmokeTest' + externalrelease.release(org, repoName, branchName, jobName, dependencyRepos, dependencyJobs) + } + } + post { + success { + echo "Release completed successfully" + } + failure { + echo "Release failed" + } + } + } + stage("Live push - USWest") { + when { + // branch 'master' + environment name: 'LIVE_PUSH', value: 'true' + } + steps { + script { + lock ("${repoName}-Live-Push") { + externalrelease.livePushRefApp("${params.INSTANCE_PREFIX}") + } + } + } + post { + success { + echo "Live push completed successfully" + } + failure { + echo "Live push failed" + } + } + } + } + post { + always { + script { + internalrelease.cleanupAfterJob() + notifications.sendFlowdockMsg() + } + } + } +} diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..7ac187267 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,69 @@ +### GE Software Development License Agreement – General Release + +THIS SOFTWARE LICENSE AGREEMENT (the “License”) describes the rights granted by the General Electric Company, operating through GE Digital (also referred to as “GE Software”), located at 2623 Camino Ramon, San Ramon, CA 94583 (herein referred to as “Licensor”) to any entity (the “Licensee”) receiving a copy of any of the following GE Digital development materials: Predix DevBox; Predix Reference Application (“RefApp”); Predix Dashboard Seed; Predix Px, Predix Security Service redistributable .jar files; Predix Machine redistributable .jar files; and Predix Machine SDK . These materials may include scripts, compiled code, supporting components, and documentation and are collectively referred to as the “Licensed Programs”. Both Licensor and Licensee are referred to hereinafter as a “Party” and collectively as the “Parties” to this License + +### Section 1 – Conditional Grant. + +No Licensee is required to accept this License for use of the Licensed Programs. In the absence of a signed license agreement between Licensor and Licensee specifying alternate terms, any use of the Licensed Programs by the Licensee shall be considered acceptance of these terms. The Licensed Programs are copyrighted and are licensed, not sold, to you. If you are not willing to be bound by the terms of this License, do not install, copy or use the Licensed Programs. If you received this software from any source other than the Licensor, your access to the Licensed Programs is NOT permitted under this License, and you must delete the software and any copies from your systems. + +### Section 2 – Warranty Disclaimer. + +NO WARRANTIES. LICENSOR AND OUR AFFILIATES, RESELLERS, DISTRIBUTORS, AND VENDORS, MAKE NO WARRANTIES, EXPRESS OR IMPLIED, GUARANTEES OR CONDITIONS WITH RESPECT TO USE OF THE LICENSED PROGRAMS. LICENSEE’S USE OF ALL SUCH PROGRAMS ARE AT LICENSEE’S AND CUSTOMERS’ OWN RISK. LICENSOR PROVIDES THE LICENSED PROGRAMS ON AN “AS IS” BASIS “WITH ALL FAULTS” AND “AS AVAILABLE.” LICENSOR DOES NOT GUARANTEE THE ACCURACY OR TIMELINESS OF INFORMATION AVAILABLE FROM, OR PROCESSED BY, THE LICENSED PROGRAMS. TO THE EXTENT PERMITTED UNDER LAW, LICENSOR EXCLUDES ANY IMPLIED WARRANTIES, INCLUDING FOR MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, AND NON-INFRINGEMENT. NO GUARANTEE OF UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE OPERATION IS MADE. + +THESE LICENSED PROGRAMS MAY BE USED AS PART OF A DEVELOPMENT ENVIRONMENT, AND MAY BE COMBINED WITH OTHER CODE BY END-USERS. LICENSOR IS NOT ABLE TO GUARANTEE THAT THE LICENSED PROGRAMS WILL OPERATE WITHOUT DEFECTS WHEN USED IN COMBINATION WITH END-USER SOFTWARE. LICENSEE IS ADVISED TO SAFEGUARD IMPORTANT DATA, TO USE CAUTION, AND NOT TO RELY IN ANY WAY ON THE CORRECT FUNCTIONING OR PERFORMANCE OF ANY COMBINATION OF END-USER SOFTWARE AND THE LICENSED PROGRAMS AND/OR ACCOMPANYING MATERIALS. LICENSEE IS ADVISED NOT TO USE ANY COMBINATION OF LICENSED PROGRAMS AND END-USER PROVIDED SOFTWARE IN A PRODUCTION ENVIRONMENT WITHOUT PRIOR SUITABILITY AND DEFECT TESTING. + +### Section 3 – Feedback. + +It is expressly understood, acknowledged and agreed that you may provide GE reasonable suggestions, comments and feedback regarding the Software, including but not limited to usability, bug reports and test results, with respect to Software testing (collectively, "Feedback"). If you provide such Feedback to GE, you shall grant GE the following worldwide, non-exclusive, perpetual, irrevocable, royalty free, fully paid up rights: + +A). to make, use, copy, modify, sell, distribute, sub-license, and create derivative works of, the Feedback as part of any product, technology, service, specification or other documentation developed or offered by GE or any of its affiliates (individually and collectively, "GE Products"); + +B). to publicly perform or display, import, broadcast, transmit, distribute, license, offer to sell, and sell, rent, lease or lend copies of the Feedback (and derivative works thereof) as part of any GE Product; + +C). solely with respect to Licensee's copyright and trade secret rights, to sublicense to third parties the foregoing rights, including the right to sublicense to further third parties; and d. to sublicense to third parties any claims of any patents owned or licensable by Licensee that are necessarily infringed by a third party product, technology or service that uses, interfaces, interoperates or communicates with the Feedback or portion thereof incorporated into a GE Product, technology or service. Further, you represent and warrant that your Feedback is not subject to any license terms that would purport to require GE to comply with any additional obligations with respect to any GE Products that incorporate any Feedback. + +### Section 4 – Reserved + +### Section 5 – Limitation of Liability. + +LIABILITY ARISING UNDER THIS LICENSE, WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), SHALL BE LIMITED TO DIRECT, OBJECTIVELY MEASURABLE DAMAGES. LICENSOR SHALL HAVE NO LIABILITY TO THE OTHER PARTY OR TO ANY THIRD PARTY, FOR ANY INCIDENTAL, PUNITIVE, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. LIABILITY FOR ANY SOFTWARE LICENSED FROM THIRD PARTIES FOR USE WITH THE SERVICES IS EXPLICILTLY DISCLAIMED AND LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW. + +Notwithstanding anything to the contrary, the aggregate liability of Licensor and its suppliers under this License shall not exceed the total amounts paid by Licensee to Licensor hereunder during the one-year period immediately preceding the event which gave rise to the claims. + +### Section 6 – License. + +A). License Grant. Subject to the terms and conditions of this License, Licensor hereby grants Licensee a worldwide, perpetual, royalty-free, non-exclusive license to: + +i) install the Licensed Programs on Licensee’s premises, and permit Licensee’s users to use the Licensed Programs so installed, solely for Licensee’s own development, testing, demonstration, staging, and production of Licensee’s own software that makes use of the Licensed Programs in a way that adds substantial functionality not present in the Licensed Programs (the result, a “Licensee Application”); + +ii) permit Licensee to permit third-party hosts (“Hosts”) to install the Licensee Application on such Hosts’ respective premises on Licensee’s behalf, and permit Licensee’s users to access and use the Licensed Programs so installed, solely for Licensee’s own development, testing, demonstration, staging and production purposes + +iii) install the Licensee Application on Licensee’s own premises and permit its own users to use the Licensee Application so installed on the same terms as sub-sections (i) and (ii) above. + +B). For the purposes of this License, the right to “use” the Licensed Programs shall include the right to utilize, run, access, store, copy, test or display the Licensed Programs. No right or license is granted or agreed to be granted to disassemble or decompile any Licensed Programs furnished in object code form, and Licensee agrees not to engage in any such conduct unless permitted by law. Reverse engineering of Licensed Programs provided in object code form is prohibited, unless such a right is explicitly granted by any explicit license subject to sub-section (d) below or as a matter of law, and then only to the extent explicitly permitted. Licensor shall have no obligation to support any such reverse engineering, any product or derivative of such reverse engineering, or any use of the Licensed Programs with any modified versions of any of their components under this License. + +C). Licensee shall ensure that any Licensee Applications incorporate the Licensed Programs in such a way as to prevent third parties (other than Hosts) from viewing the code of the Licensed Programs or gaining access to any programmatic interface or other hidden aspect of the Licensed Programs. Licensee shall also restrict distribution of the Licensed Programs, including as part of Licensee Applications, to only those parties who are notified of, and subject to, an enforceable obligation to refrain from any of the prohibited activities listed herein, such as reverse engineering or disassembling the Licensed Programs. + +D). Use of some open source and third party software applications or components included in or accessed through the Licensed Programs may be subject to other terms and conditions found in a separate license agreement, terms of use or “Notice” file located at the download page. The Licensed Programs are accompanied by additional software components solely to enable the Licensed Programs to operate as designed. Licensee is not permitted to use such additional software independently of the Licensed Programs unless Licensee secures a separate license for use from the named vendor. Do not use any third party code unless you agree with the applicable license terms for that code. + +E). Title. Title to and ownership of the Licensed Programs shall at all times remain with Licensor. + +### Section 7 – Termination. + +A). The Licensor reserves the right to cease distribution and grant of further licenses to any or all of the Licensed Programs at any time in its sole discretion. + +B). The Licensor reserves the right to at any time and at its sole discretion provide updated versions of any or all of the Licensed Programs that supercede and replace the prior version of that Licensed Program. + +C). Your license rights under Section 6 are effective until terminated as described below: + +i). This license and all rights under it will terminate or cease to be effective without notice if Licensee breaches the terms of the License and does not correct or remedy such breach promptly. + +ii). Notwithstanding the foregoing, Licensee may terminate this License at any time for any reason or no reason by providing the Licensor written notice thereof. + +D). Upon any expiration or termination of this License, the rights and licenses granted to you under this License shall immediately terminate, and you shall immediately cease using and delete the Licensed Programs. Licensee Applications based upon the Licensed Programs (see Section 6(a) above) are not subject to this limitation. + +In the event of any expiration or termination of this Licensee, any Confidentiality provision, disclaimers of GE’s representations and warranties, choice of applicable law and limitations of GE’s liability shall survive. + +### Section 8 – Applicable Law. + +The License shall be governed by and interpreted in accordance with the substantive law of the State of California, U.S.A., excluding its conflicts of law provisions, and by the courts of that state. diff --git a/README.md b/README.md new file mode 100644 index 000000000..86e23aed9 --- /dev/null +++ b/README.md @@ -0,0 +1,165 @@ + + view github pages + + +Predix RMD Reference App +===================== + +Welcome to the Predix Remote Monitoring & Diagnostics (RMD) Reference Application. The Predix platform enables you to create applications with an Industrial Internet focus and allows you to manage and scale those applications as they are consumed by your end users. + +The RMD Reference App shows developers and architects how to use and leverage all of the Predix application building block Services you find in the Catalog. So, it only has some aspects of a fully featured RMD application. Instead, it's intent is to show developers and architects a best-practices microservices application architecture integrating with all the underlying Predix Services. It will save you a few weeks or months of effort if you leverage the components inside. + +You can view a running version of the [Reference App](https://rmd-ref-app.run.aws-usw02-pr.ice.predix.io/dashboard) in your browser using these login credentials + + User: app_user_1 + Password: App_User_111 + +You can view our Video and later run the [deployment script ](https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=2106&tag=1610&journey=Digital%20Twin%3A%20from%20the%20Edge%20to%20the%20Cloud%20using%20RMD%20Reference%20App&resources=1592,1473,2106,1600), which will push the Reference App to your own Cloud Foundry space so you can quickly start trying out various Predix Services. + +Now, take a few moments to learn all about Predix, using Reference App as a guide. There is lots to discover and soon you'll be creating Predix Apps of your own. + +## Predix Integration +The Reference App Front-End and Back-End Microservices demonstrate how to use the Predix PAAS to build an Industrial Internet application. The app takes advantage of the following Predix components: + +[Base Asset Monitoring Reference App Installer](https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=2106&tag=1610&journey=Digital%20Twin%3A%20from%20the%20Edge%20to%20the%20Cloud%20using%20RMD%20Reference%20App&resources=1592,1473,2106,1600) +- [Predix WebApp Starter](https://github.com/predixdev/predix-webapp-starter) +- [Predix UAA Security](https://docs.predix.io/en-US/content/service/security/user_account_and_authentication/) +- [Predix Asset](https://docs.predix.io/en-US/content/service/data_management/asset/) +- [Predix Time Series](https://docs.predix.io/en-US/content/service/data_management/time_series/) + +[Digital Twin Analytics Reference App Installer](https://www.predix.io/resources/tutorials/journey.html#1611) +- [Predix Analytics](https://docs.predix.io/en-US/content/service/analytics_services/analytics_framework/) + +[Edge Starters - Personal Edition Installer](https://www.predix.io/resources/tutorials/journey.html#2054) +- [Predix Machine](https://docs.predix.io/en-US/content/service/edge_software_and_services/machine/) +- [Predix Machine Modbus Adapter](https://docs.predix.io/en-US/content/service/edge_software_and_services/machine/modbus-machine-adapter) +- [Predix Data River Receiver](https://docs.predix.io/en-US/content/service/edge_software_and_services/machine/data-bus-river#concept_7975e96d-33fc-4cba-811a-8dc895d98f94) + +## RMD Reference App +RMD Reference App is composable and the pieces can be used in a variety of configurations to help solve your Application use-case. Like most Apps, at it's core, Reference App consists of a [RMD UI](#microservices) front end microservice and a [RMD Datasource](#microservices) back-end microservice. + + + +Beyond the core services there are other [microservices](#microservices) and [microcomponent utilities](#microcomponents) which help generate Data, make Secure Rest calls or integrate with all the different Predix Services and Security. + +## Detailed Architecture of the Base Asset Monitoring Reference App + +Architecturally the reference app is organized into four Tiers (Presentation, Delivery, Aggregation and Storage) and supports three Data Flows (Ingestion, Analytics, Visualization) +- Presentation Tier - UI layer and microservices +- Delivery Tier - Cacheing, Mobile, Personalization +- Aggregation Tier - Service Composition and Business Logic +- Storage Tier - the Predix PAAS Services + + + +The 2 main microservices and some helper microservices which are pushed to and run in cloud foundry, as follows: + + + +### Ingestion Flow +In your production Edge to Cloud architecture, Predix Machine using the Predix Machine DataRiver posts data over a websocket to the Time Series service directly. To get a feel for this, our companion Edge Starter reference applications (links shown above) show how to configure that. + +With the Base Reference App however, the Predix Machine is not installed by the install script. Instead we install a microservice called the Data Exchange Simulator. Data Flows from the Data Exchange Simulator to the Data Exchange and on to Predix Time Series. The Data Exchange also acts as a websocket server, which feeds live data to the RMD Reference App UI in near real-time. + +(future) Raw data often needs cleaning and preparation before it is consumable via Analytics and UI. A best-practice would be to mark this data as raw and trigger Cleansing and Quality jobs leveraging the analytics framework. + + + +### Ingestion Flow (pipeline architecture) +(future) For many applications, there is a need to be in the flow of data as it arrives. The Event Hub service provides a subscription mechanism as the data comes in, the proposed flow below has data coming in to the Data Exchange so that other actions can be taken. Examples are: + +- Sending data to the Web Socket Clients, so data streams directly to the UI +- Putting a message on a Queue to trigger downstream processes +- Enriching or Filtering the data in a Custom Handler + +We leave these enhancements to you to implement depending on your application use-case. + + + + +### Visualization Flow +The UI accesses data from Predix Asset directly which drives the Asset selector menu. Once a selection is made the View requests data from the RMD Datasource and returns the data from Predix Asset and Predix Time Series in a mashup. However, in the Graph Widget the Time Series service is accessed directly. + + + +## Detailed Architecture of the Digital Twin Analytics Reference App + +Since we have your attention, we'd like to introduce the features of our Digital Twin Analytics Reference App. This builds on the base Reference App to add the ability to trigger analytic processes. The DT Analytics Reference App uses a separate installer (see links above). + +### Analytics Flow +Data arrives via the Ingestion Flow and is stored. A message is placed in a queue which kicks off an Analytic Orchestration. The Analytics uses data from Predix Asset and Predix Time Series, produces a result, which is then stored back to Predix Asset or Predix Time Series or potentially to/from any other datastore. + + + +## Getting Acquainted with Reference App + +Go through the following Guide to get acquainted with Predix RMD Reference application. + +[Digital Twin: from the Edge to the Cloud using RMD Reference App](https://www.predix.io/resources/tutorials/journey.html#1610) + + +## Setting up your environment +Reference App accesses code repos at https://github.com/PredixDev and a maven repository at https://artifactory.predix.io. + +The best experience is to use a [DevBox](https://www.predix.io/services/other-resources/devbox.html) which has all the tools and settings pre-installed. + +Use the quickstart script [in the tutorial](https://www.predix.io/resources/tutorials/journey.html#1610) to install the tools and the app. + +For more detailed instructions on tools installationn, follow the link below to setup your development environment: + +[Development Environment](https://www.predix.io/resources/tutorials/journey.html#1607) + + +## Predix Hello World +Go through the following tutorial on how to build a simple hello world application using Predix components. + +[Hello World](https://www.predix.io/resources/tutorials/journey.html#1719) + + +## Microservices +The base Asset Monitoring Ref App consists of 2 core microservices and 3 helper microservices. Each microservice can be individually managed and scaled, leveraging the Cloud Foundry infrastructure. These services can be mixed and matched for your next Predix application depending on which services you need to integrate with. + +### [RMD Ref App UI](https://github.com/PredixDev/predix-webapp-starter/blob/master/public/docs/ABOUT.md) +A Polymer Web Components based UI framework. We started with the [Polymer Webapp Starter](https://github.com/PredixDev/predix-webapp-starter) for UI Development which comes with a JSON only mode that is not hooked to back-end Predix services. The very same github repo serves as the RMD Reference App UI and is instrumented with best-practice behaviors for hooking to real back-end Predix services and apps. The UI talks to the RMD Datasource Service, Predix UAA, Predix Asset and Predix Timerseries back-end services. + +More details can be found [here](https://github.com/PredixDev/predix-webapp-starter/blob/develop/public/docs/ABOUT.md). + +### [RMD Datasource Service](https://github.com/PredixDev/rmd-datasource/blob/master/README.md#welcome-to-the-rmd-datasource-microservice) +A Mashup Service doing much of the logic for the Reference App. It talks to Predix Asset and Time Series databases and return results for display. + +### [DataExchange](https://github.com/predixdev/data-exchange/tree/master#data-exchange) + The DataExchange framework retrieves data from any Datasource using a simple Get or Put API. Inside the Data Exchange are handlers for Asset, Timeseries, RabbitMQ, and WebSockets. An empty CustomHandler is provided so you can hook to your custom datasource (e.g. Postgres). DataExchange can help manage data Get/Put requests that are from distributed, near-data, relational db, public internet, file dataources, via other Rest APIs and also can be used at the Edge (on Machines outside the cloud). The Data Exchange can also act as a websocket server, to broadcast data to clients over websockets. + +### [Data Exchange Simulator Service](https://github.com/PredixDev/data-exchange-simulator/tree/master) + A Service to generate time series data when a physical machine is not available. The Simulator sends data to the Data Exchange Service. The install script lets the simulator run for 30 seconds and then stops it. This is so data is not unnecessarily flowing in to Predix Time Series. + +## Asset Model + +Using the tutorial below, you will learn about the RMD Reference App asset model to help understand how you can create your own asset model for your Industrial Assets. + +[Reference App and Predix Asset](https://www.predix.io/resources/tutorials/journey.html#1709) + +## APIs +The reference app defines some apis and message bodies that are needed to communicate between microservices. They are defined by xsd but at runtime use JSON. +* [RMD Datasource](https://github.com/PredixDev/rmd-datasource) +* [Run Analytic](https://github.com/PredixDev/ext-interface/blob/master/ext-model/src/main/resources/META-INF/schemas/predix/entity/runanalytic/runanalytic.xsd) +* [Data Exchange - GetFieldData](https://github.com/PredixDev/ext-interface/blob/3279197f26802afd3c4eb5d181390313868caa9f/ext-model/src/main/resources/META-INF/schemas/predix/entity/getfielddata/getfielddata.xsd) +* [Data Exchange - PutFieldData](https://github.com/PredixDev/ext-interface/blob/3279197f26802afd3c4eb5d181390313868caa9f/ext-model/src/main/resources/META-INF/schemas/predix/entity/putfielddata/putfielddata.xsd) +* [FieldChangedEvent](https://github.com/PredixDev/ext-interface/blob/master/ext-model/src/main/resources/META-INF/schemas/predix/event/fieldchangedevent/fieldchangedevent.xsd) + +## Microcomponents +* [Predix Microcomponent Bootstraps](docs/microcomponents.md) - reusable libraries that can be used in any microservice + +## SDKs +One of the primary points of the Reference App is to provide sample code and SDKs that help you talk to real Predix Services. [We have SDKs](https://www.predix.io/resources/tutorials/journey.html#SDK) for many of the services in several languages including for UAA, Asset, Timeseries, Analytic Runtime, basic REST client, basic WebSocket client, etc. + + +#### Known Issues +* Safari has visual issues + +### More Details +* [RMD overview](https://github.com/predixdev/predix-rmd-ref-app/tree/master/docs/overview.md) - the Remote Monitoring & Diagnostics use-case +* [Securing an application](https://github.com/predixdev/predix-rmd-ref-app/tree/master/docs/security.md) +* [More GE resources](https://github.com/predixdev/predix-rmd-ref-app/tree/master/docs/resources.md) + +[![Analytics](https://ga-beacon.appspot.com/UA-82773213-1/predix-rmd-ref-app/readme?pixel)](https://github.com/PredixDev) diff --git a/acs/admin-user-policy-evaluation.json b/acs/admin-user-policy-evaluation.json new file mode 100644 index 000000000..bad912a4a --- /dev/null +++ b/acs/admin-user-policy-evaluation.json @@ -0,0 +1,15 @@ +{ + "action": "POST", + "resourceIdentifier": "/validateuser", + "subjectAttributes": [ + { + "issuer": "https://acs.attributes.int", + "name": "role", + "scopes": [ + {} + ], + "value": "admin" + } + ], + "subjectIdentifier": "app_admin_1" +} diff --git a/acs/app_admin_1_role_attribute.json b/acs/app_admin_1_role_attribute.json new file mode 100644 index 000000000..d8426619f --- /dev/null +++ b/acs/app_admin_1_role_attribute.json @@ -0,0 +1,11 @@ +{ + "subjectIdentifier": "app_admin_1", + "attributes": [ + { + "name": "role", + "value": "admin", + "issuer": "https://acs.attributes.int" + } + ], + "subjectId": "app_admin_1" +} diff --git a/acs/app_user_1_role_attribute.json b/acs/app_user_1_role_attribute.json new file mode 100644 index 000000000..5f4ab8ec5 --- /dev/null +++ b/acs/app_user_1_role_attribute.json @@ -0,0 +1,11 @@ +{ + "subjectIdentifier": "app_user_1", + "attributes": [ + { + "name": "role", + "value": "operator", + "issuer": "https://acs.attributes.int" + } + ], + "subjectId": "app_user_1" +} \ No newline at end of file diff --git a/acs/rmd_app_policy.json b/acs/rmd_app_policy.json new file mode 100644 index 000000000..1ae39e8d3 --- /dev/null +++ b/acs/rmd_app_policy.json @@ -0,0 +1,73 @@ +{ + "name" : "refapp-acs-policy", + "policies" : [ + { + "name" : "allow-all-HTTP-requests-for-admin", + "target" : { + "resource" : { + "uriTemplate" : "/validateuser" + }, + "subject" : { + "name" : "has-role", + "attributes" : [ + { "issuer" : "https://acs.attributes.int", + "name" : "role" } + ] + } + }, + "conditions" : [ + { "name" : "", + "condition" : "match.single(subject.attributes('https://acs.attributes.int', 'role'), 'admin')" } + ], + "effect" : "PERMIT" + } + , + { + "name" : "allow-only- POST-for-operator", + "target" : { + "resource" : { + "uriTemplate" : "/validateuser" + }, + "action":"POST", + "subject" : { + "name" : "has-role", + "attributes" : [ + { "issuer" : "https://acs.attributes.int", + "name" : "role" } + ] + } + }, + "conditions" : [ + { "name" : "", + "condition" : "match.single(subject.attributes('https://acs.attributes.int', 'role'), 'admin')" } + ], + "effect" : "PERMIT" + }, + { + "name" : "allow-only-HTTP GET-for-operator", + "target" : { + "resource" : { + "uriTemplate" : "/validateuser" + }, + "action":"GET", + "subject" : { + "name" : "has-role", + "attributes" : [ + { "issuer" : "https://acs.attributes.int", + "name" : "role" } + ] + } + }, + "conditions" : [ + { "name" : "", + "condition" : "match.single(subject.attributes('https://acs.attributes.int', 'role'), 'operator')" } + ], + "effect" : "PERMIT" + } + , + { + "name" : "catch-all-DENY-policy", + "effect" : "DENY" + } + ] +} \ No newline at end of file diff --git a/data-exchange b/data-exchange new file mode 160000 index 000000000..5656a6c11 --- /dev/null +++ b/data-exchange @@ -0,0 +1 @@ +Subproject commit 5656a6c11915bb481c9ff2649e66c9134e4a3f15 diff --git a/data-exchange-simulator b/data-exchange-simulator new file mode 160000 index 000000000..9e6cbd35b --- /dev/null +++ b/data-exchange-simulator @@ -0,0 +1 @@ +Subproject commit 9e6cbd35b4c1252ba27bea1c93529f09c5151dcd diff --git a/docs/assetModel.md b/docs/assetModel.md new file mode 100644 index 000000000..1284024a2 --- /dev/null +++ b/docs/assetModel.md @@ -0,0 +1,25 @@ +##Asset Model +Since Predix Asset comes with an empty database, the Reference App creates a data 'model' depicted below, which sets up entities and attributes for Groups, Classifications, Assets and Meters. + +Note: Meter will change to Parameter in a future release + + + +The model has these characteristics: +- A Turbine, for example, is Modeled as a Classification +- (future)A Device, such as a Honeywell Controller, is modeled as a Classification +- (future)A DeviceMeter is hooked to Predix Machine and a data Node retrieves data using an Adapter. +- An AssetMeter is hooked to Predix Machine and a data Node retrieves data using an Adapter. +- A Predix Machine can talk to many Devices on many Industrial Machines +- A Meter represents a Timeseries Data parameter, either raw sensor data or calculated data +- (future)A DeviceAsset is an instance of a Device classification and has DeviceMeter instance attributes +- An AssetGroup can be a location (Site,Plant,etc) or an entity(Enterprise,City,County) that logically holds a set of Assets +- An Asset is an instance of a Classification and has singleValue Attributes as well as AssetMeter instance attributes +- AssetMeter knows of it's Unit of Measure and also has a key to several Datasources +DeviceMeter ID +Node ID +Timeseries Tag ID +- A Field further describes any Attribute for purposes such as Data Ingestion, UI, DataBinding for FederatedQuery, Analytics +- A Field has a FieldSource that describes how or where the data is stored for an Attribute +- A Field has a DataHandler uri that knows how to retrieve or store data from/to a FieldSource +- (future)A MachineAsset can be modeled to navigate from the Machine Id to the Devices and Assets diff --git a/docs/microcomponents.md b/docs/microcomponents.md new file mode 100644 index 000000000..d8f23d7e5 --- /dev/null +++ b/docs/microcomponents.md @@ -0,0 +1,27 @@ +##Microcomponents + +Microcomponents are reusable libraries that can be used in any microservice. The Adoption team has developed many Bootstrap Microcomponents, the following are relevent to the current version of Predix. + +- [Predix Microservice Templates](#PredixMicroserviceTemplates) +- [Predix SDKS](https://github.com/PredixDev/predix-sdks) + - [Predix Rest Client](#PredixRestClient) + - [Predix Web Socket Client](#PredixWebSocketClient) + - [Asset Bootstrap Client](#AssetBootstrapClient) + - [Timeseries Bootstrap Client](#TimeseriesBootstrapClient) + - and more... + +###PredixMicroserviceTemplates +A collection of back-end Microservice bootstraps that gets you creating a Microservice much quicker than starting from scratch. For Java, we started with SpringBoot helloWorld and added CXF, Tomcat, Spring Profiles and Property File management features that you would need anyway. Other templates for NodeJS, etc are on their way. + +###Predix Rest Client +Predix Rest Client has GET, PUT, POST, DELETE calls that integrate with Predix UAA Security. Everything is property-ized from the Hostname to Port to Proxy server urls to JWT vs SAML token support. It works backwards compatible to Predix 1.0 security as well so you can use it port services from Predix 1.0 to 2.0 in the cloud. + +###Predix WebSocket Client +Coming Soon. Predix Web Socket Client has WebSocket OPEN, CLOSE, SEND, RECEIVE calls that integrate with Predix UAA Security. Everything is property-ized from the Hostname to Port to Proxy server urls to JWT token support. + +###Asset Bootstrap Client +Asset Bootstrap exposes the Predix Asset APIs for Groups, Classifications, Assets and Meters. It also provides the ability to pass through or get tokens from Predix UAA Security. This is also backwards compatible, at this time, to Predix Asset 14.3. + +###Timeseries Bootstrap Client +Timeseries Bootstrap exposes the Predix Timeseries APIs. Support for Start/End Date based timeseries calls are much more easily exposed including support for Predix UAA calls to Security Authorization. + diff --git a/docs/overview.md b/docs/overview.md new file mode 100644 index 000000000..4a32c5e27 --- /dev/null +++ b/docs/overview.md @@ -0,0 +1,15 @@ +## Overview + +Remote monitoring and diagnostics (RM&D) applications are used in industries to monitor machines to report irregularities in operation and analyze patterns of behavior and performance over time. Monitoring and diagnostic applications use a set of algorithms, processes, and tools to monitor the health of an asset and detect faults before they turn into failures. + +This RM&D reference app is a good starting point for understanding Predix cloud application development. This app was created from a fork of the Predix Experience Seed app, then the user interface was customized for the needs of RM&D. The app also demonstrates how you can: + +* Integrate your backend services +* Model assets and meters +* Ingest data into time series +* Customize your user interface +* Secure your application using Predix authentication service +* Use Predix Contextual Dashboard to browse assets +* Use Predix widgets - Data Grid, and Time-series +* Integrate Predix cloud services - Asset, Time Series, UAA, ACS, Analytics +* Visualize Predix Machine live data diff --git a/docs/proxy.md b/docs/proxy.md new file mode 100644 index 000000000..fd7d49878 --- /dev/null +++ b/docs/proxy.md @@ -0,0 +1,31 @@ +#Proxy + +A Corporate Proxy Server filters web content and malicious software. It also improves performance of frequently accessed web pages. + +Web Browsers get their proxy info from the network settings. Some companies have a http script (pac.pac file) that helps the +browser know which URLs are internal vs. external. Firefox allows for manual configuration as well. + +When using Predix and/or the Reference App it depends on your situation whether to set or unset the Proxy config. Tools such as wget, curl, git, maven etc use the Environment variables such as +- HTTP_PROXY=http://proxy.mycompany.com:8080 +- HTTPS_PROXY=http://proxy.mycompany.com:8080 +- http_proxy=http://proxy.mycompany.com:8080 +- https_proxy=http://proxy.mycompany.com:8080 +- no_proxy=mycompany.com + +Thus if you are on your Corporate Network or over VPN to your Corporate Network the proxy is required to get to servers out on the Internet and you MUST have these env vars set. If you are at home or a cafe on the public internet and not using VPN then you MUST unset these variables because the proxy server will not be found. + +>While most ENV vars are upper case it's an historical oddity that http_proxy is defined in lower case. Thus, both lower and upper case +env vars are often set. The noproxy env var tells the tool to not bother going to the proxy server for certain domains, usually internal +to the network. + +On OSX or linux this will unset it for the current terminal window +- unset HTTP_PROXY +- unset HTTPS_PROXY +- unset http_proxy +- unset https_proxy + +On Windows this will unset it for the current command window +- set HTTP_PROXY= +- set HTTPS_PROXY= +- set http_proxy= +- set https_proxy= diff --git a/docs/resources.md b/docs/resources.md new file mode 100644 index 000000000..69c963d28 --- /dev/null +++ b/docs/resources.md @@ -0,0 +1,12 @@ +## Resources + +### Predix related Documents and Downloads: + +* Predix Product site + +### Useful Predix links: + +* Predix DevBox +* Q&A Forum +* Support ticket +* Predix GitHub repo diff --git a/docs/security.md b/docs/security.md new file mode 100644 index 000000000..8a8032382 --- /dev/null +++ b/docs/security.md @@ -0,0 +1,18 @@ +## Securing the Application + +### Authentication + +Predix Authentication service (UAA) is configured for this application. In practice, you'd probably want to federate with GE SSO. In order to enable your application to have a GE SSO, please work with Predix security team.This service is available through service broker and provided in the cloud foundry .For the RMD application , the security service can be created .The RMD application is configured for the "rmd_uaa_%username%" service instance name .The %username% is the cf login username. + +``` +cf cs predix-uaa beta rmd_uaa_%username% -c '{"adminClientSecret": "secret"}' +``` +Once the instance of the predix-uaa is generated. Install the uaac tool (follow the Security service documentation for setting up the uaac and details on setting on the client ) . + +Once you get the applicationId (aka clientId), go to your appliction frontend project (see rmd-predix-ui project), specify your clientId in /public/scripts/app.js: + + $scope.clientId = 'your_client_id'; + +### Authorization + +Predix ACS service can provide role based authorization for your application. Please refer to Predix ACS service documentation to use this feature: Role based authorization was not implemented for this RMD reference app. diff --git a/docs/services.md b/docs/services.md new file mode 100644 index 000000000..5e60c531b --- /dev/null +++ b/docs/services.md @@ -0,0 +1,80 @@ +## Developing and Configuring Microservices + +### Predix Components + +#### Asset Service +This service is available through service broker and provided in the cloud foundry. For the RMD application, the asset service instance can be created, if the instance is not already present in the space. The RMD application is configured for the "predixAsset" service instance name. +``` +cf create-service stc-asset beta-plan predixAsset +``` + +#### Timeseries Service +This service is available through service broker and provided in the cloud foundry. For the RMD application, the timeseries service instance can be created, if the instance is not already present in the space. + + +To deploy: ++ cd to the clone directory ++ cf push + +##### Ingesting Timeseries data + + +There are two ways to insert data into the time series DB. +1. To automatically generate some random data and insert into Timeseries, scripts are provided here: . Follow README instructions in this folder. Modify generate-data.sh script update tag names, so you don't overwrite data for tags others are using. Tag names could be tied to the "sourceTagId" field in Predix Asset, to associate time-series data with an asset. +2. Use the Predix Machine services described below. This way, you can either ingest real data from a device, or ingest sample data from a simulator. + +#### Predix Authentication Service UAA based configuration. +The application is configured with Predix UAA configuration. The client application id is configured on the UAA for this application. +Login: app_user_1 / App_User_1 + +*** + +### Customized RMD application specific Microservices + +#### Dashboard View Service +- This service is repository for the views displayed by the px-contextual-dashboard. Each view is associated with an asset classification. +- You can create an instance of the views service by following the steps described here, in the [seed application View Service setup.](https://github.com/PredixDev/predix-seed/tree/1.0#binding-to-view-service). +- Alternatively, you can create your own views service that returns JSON in the correct format. You could modify and deploy the [rmd-ui-service](https://github.com/PredixDev/rmd-ui-service/tree/develop) described below. +- Run the views script documented below to register the views configured for the RMD application. + +#### Application meta-context Service +This service is repository that holds application datasource meta-context. Widgets used in the Predix Dashboard call this service to find datasources. + +To deploy: ++ git clone https://github.sw.ge.com/predix-integration/rmd-ui-service/tree/develop ( branch) ++ cd to the clone directory ++ modify manifest.yml and give the application a unique name. ++ mvn clean install ++ cf push +- verify the service is deployed calling the {application_url}/views and setting the Authorized token. + +#### Experience Datasource bootstrap Service +This service has orchestration , that provides data to data-grids and widgets. Github repo for this service is located here: This bootstrap is dependent on the following micro component dependencies uploaded to the artifactory. +1. (predix-rest-client) https://github.com/PredixDev/predix-rest-client +2. (asset-bootstrap-client) https://github.sw.ge.com/adoption/asset-bootstrap.git +3. (timeseries-bootstrap-client) https://github.sw.ge.com/adoption/timeseries-bootstrap.git (develop) + +To deploy: ++ git clone https://github.sw.ge.com/adoption/experience-datasource-bootstrap.git ++ cd <> ++ mvn clean install ++ cd ++ cf push + +### Data Seed Service +This service was used to construct and populate the asset model. You can create a datamodel in an Excel spreadsheet, then upload to this service. The service will make the correct Predix Asset REST API calls to create or update the model. + + + +A sample excel spreadsheet can be found here, in the AssetData.xls file: + +### Predix Machine Services +This repo contains bundles to run in Predix Machine, as well as an ingestion service to store data in the time series DB. + + + +### ADH-PAPI Service - https://github.sw.ge.com/adoption/adh-papi + - implements the ADH API and retrieves Asset data + +### ADH-Router Service - https://github.sw.ge.com/adoption/adh-router-service + - implements the ADH API and routes requests to the appropriate ADH Handler or Microservice diff --git a/docs/settings-security.xml b/docs/settings-security.xml new file mode 100644 index 000000000..f62d65ebe --- /dev/null +++ b/docs/settings-security.xml @@ -0,0 +1,3 @@ + + encrypted-master-password-here + diff --git a/docs/settings.xml b/docs/settings.xml new file mode 100644 index 000000000..8653d2ca0 --- /dev/null +++ b/docs/settings.xml @@ -0,0 +1,70 @@ + + + + + + + + + + predix.repo + your.predix.io.username + your.encrypted.password + + + + + + default + + + + predix.repo + https://artifactory.predix.io/artifactory/PREDIX-EXT + + false + + + true + + + + central + http://repo1.maven.org/maven2 + + false + + + true + + + + + + + central + http://repo1.maven.org/maven2 + + + + + + + default + + diff --git a/docs/unset_proxy.sh b/docs/unset_proxy.sh new file mode 100755 index 000000000..a4c507c9c --- /dev/null +++ b/docs/unset_proxy.sh @@ -0,0 +1,6 @@ +#/bin/sh +unset http_proxy +unset https_proxy +unset HTTP_PROXY +unset HTTPS_PROXY + diff --git a/images/AssetModel.png b/images/AssetModel.png new file mode 100644 index 000000000..84f051f4c Binary files /dev/null and b/images/AssetModel.png differ diff --git a/images/DataExchange-OsacbmData.png b/images/DataExchange-OsacbmData.png new file mode 100644 index 000000000..d730ab68b Binary files /dev/null and b/images/DataExchange-OsacbmData.png differ diff --git a/images/RefApp-AnalyticsFlow2.png b/images/RefApp-AnalyticsFlow2.png new file mode 100644 index 000000000..3c0e7d0bb Binary files /dev/null and b/images/RefApp-AnalyticsFlow2.png differ diff --git a/images/RefApp-CoreMicroservices.png b/images/RefApp-CoreMicroservices.png new file mode 100644 index 000000000..0a59dd5f1 Binary files /dev/null and b/images/RefApp-CoreMicroservices.png differ diff --git a/images/RefApp-IngestionFlow-pipeline.png b/images/RefApp-IngestionFlow-pipeline.png new file mode 100644 index 000000000..b6939d231 Binary files /dev/null and b/images/RefApp-IngestionFlow-pipeline.png differ diff --git a/images/RefApp-IngestionFlow3.png b/images/RefApp-IngestionFlow3.png new file mode 100644 index 000000000..20283be8c Binary files /dev/null and b/images/RefApp-IngestionFlow3.png differ diff --git a/images/RefApp-VisualizationFlow.png b/images/RefApp-VisualizationFlow.png new file mode 100644 index 000000000..10041f2a1 Binary files /dev/null and b/images/RefApp-VisualizationFlow.png differ diff --git a/images/ReferenceApp-Microservices3.png b/images/ReferenceApp-Microservices3.png new file mode 100644 index 000000000..8a58454c8 Binary files /dev/null and b/images/ReferenceApp-Microservices3.png differ diff --git a/images/javadoc.png b/images/javadoc.png new file mode 100644 index 000000000..e0afa179e Binary files /dev/null and b/images/javadoc.png differ diff --git a/images/pages.jpg b/images/pages.jpg new file mode 100644 index 000000000..b93b7a82c Binary files /dev/null and b/images/pages.jpg differ diff --git a/images/refapp_arch1.png b/images/refapp_arch1.png new file mode 100644 index 000000000..98ce93a03 Binary files /dev/null and b/images/refapp_arch1.png differ diff --git a/images/refapp_arch2.png b/images/refapp_arch2.png new file mode 100755 index 000000000..c6e73df27 Binary files /dev/null and b/images/refapp_arch2.png differ diff --git a/images/test.txt b/images/test.txt new file mode 100644 index 000000000..a82746db4 --- /dev/null +++ b/images/test.txt @@ -0,0 +1 @@ +ttt diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..7e45af5e5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + com.ge.predix.solsvc + rmd-ref-app + 2.0.255 + pom + + + rmd-datasource + data-exchange + data-exchange-simulator + + + + + + + + + + + + + + + + diff --git a/predix-sdks b/predix-sdks new file mode 160000 index 000000000..62798be05 --- /dev/null +++ b/predix-sdks @@ -0,0 +1 @@ +Subproject commit 62798be05ce7587114a556a87b22ee415bd0c685 diff --git a/predix-webapp-starter b/predix-webapp-starter new file mode 160000 index 000000000..761c1c11c --- /dev/null +++ b/predix-webapp-starter @@ -0,0 +1 @@ +Subproject commit 761c1c11c7fec935c55910c2ed744b2e5c8ee058 diff --git a/predix-websocket-server b/predix-websocket-server new file mode 160000 index 000000000..34e341b86 --- /dev/null +++ b/predix-websocket-server @@ -0,0 +1 @@ +Subproject commit 34e341b8641bc88b273ae50febfa538789844a8e diff --git a/rmd-datasource b/rmd-datasource new file mode 160000 index 000000000..2fa8f27b5 --- /dev/null +++ b/rmd-datasource @@ -0,0 +1 @@ +Subproject commit 2fa8f27b54669429e32902acf04c3c1f7b166827 diff --git a/scripts/.gitmodules_external b/scripts/.gitmodules_external new file mode 100644 index 000000000..b23f40283 --- /dev/null +++ b/scripts/.gitmodules_external @@ -0,0 +1,24 @@ +[submodule "predix-sdks"] + path = predix-sdks + url = https://github.com/PredixDev/predix-sdks.git + branch = master +[submodule "data-exchange"] + path = data-exchange + url = https://github.com/PredixDev/data-exchange.git + branch = master +[submodule "data-exchange-simulator"] + path = data-exchange-simulator + url = https://github.com/PredixDev/data-exchange-simulator.git + branch = master +[submodule "rmd-datasource"] + path = rmd-datasource + url = https://github.com/PredixDev/rmd-datasource.git + branch = master +[submodule "predix-webapp-starter"] + path = predix-webapp-starter + url = https://github.com/PredixDev/predix-webapp-starter.git + branch = master +[submodule "predix-websocket-server"] + path = predix-websocket-server + url = https://github.com/PredixDev/predix-websocket-server.git + branch = master diff --git a/scripts/merge.sh b/scripts/merge.sh new file mode 100755 index 000000000..b52ad8759 --- /dev/null +++ b/scripts/merge.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sed -i 's/develop\/images/master\/images/g' README.md diff --git a/scripts/pullSubModules.sh b/scripts/pullSubModules.sh new file mode 100755 index 000000000..68af56ff2 --- /dev/null +++ b/scripts/pullSubModules.sh @@ -0,0 +1,4 @@ +#! /usr/bin/env bash +set -x +git submodule init +git submodule update --rebase --remote diff --git a/scripts/quickstart-rmd-ref-app.bat b/scripts/quickstart-rmd-ref-app.bat new file mode 100644 index 000000000..b5c69a7a2 --- /dev/null +++ b/scripts/quickstart-rmd-ref-app.bat @@ -0,0 +1,160 @@ +@ECHO OFF +SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +set CURRENTDIR=%cd% +echo "currentdir=!CURRENTDIR!" +SET FILE_NAME=%0 +SET BRANCH=master +SET SKIP_SETUP=FALSE +SET CF_URL="" + +:GETOPTS + IF /I [%1] == [--skip-setup] SET SKIP_SETUP=TRUE + rem Here we call SHIFT twice to remove the switch and value, + rem since these are not needed by the .sh script. + IF /I [%1] == [-b] SET BRANCH=%2& SHIFT & SHIFT + IF /I [%1] == [--branch] SET BRANCH=%2& SHIFT & SHIFT + IF /I [%1] == [--cf-url] SET CF_URL=%2& SHIFT & SHIFT + IF /I [%1] == [--cf-user] SET CF_USER=%2& SHIFT & SHIFT + IF /I [%1] == [--cf-password] SET CF_PASSWORD=%2& SHIFT & SHIFT + IF /I [%1] == [--cf-org] SET CF_ORG=%2& SHIFT & SHIFT + IF /I [%1] == [--cf-space] SET CF_SPACE=%2& SHIFT & SHIFT + SET QUICKSTART_ARGS=!QUICKSTART_ARGS! %1 + rem echo "#### QUICKSTART_ARGS: !QUICKSTART_ARGS!" + SHIFT & IF NOT [%1]==[] GOTO :GETOPTS +GOTO :AFTERGETOPTS + +CALL :GETOPTS %* +:AFTERGETOPTS + +IF [!BRANCH!]==[] ( + ECHO "Usage: %FILE_NAME% -b/--branch " + EXIT /b 1 +) + +SET IZON_BAT=https://raw.githubusercontent.com/PredixDev/izon/master/izon.bat +SET TUTORIAL=https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1475^&tag^=1719^&journey^=Hello%%20World^&resources^=1475,1569,1523 +SET REPO_NAME=predix-rmd-ref-app +SET SHELL_SCRIPT_NAME=quickstart-rmd-ref-app.sh +SET APP_DIR="rmd-ref-app" +SET APP_NAME=RMD Asset Monitoring Reference App +SET TOOLS=Cloud Foundry CLI, Git, Java JDK, Maven, Node.js, Predix CLI +SET TOOLS_SWITCHES=/cf /git /jdk /maven /nodejs /predixcli + +SET SHELL_SCRIPT_URL=https://raw.githubusercontent.com/PredixDev/!REPO_NAME!/!BRANCH!/scripts/!SHELL_SCRIPT_NAME! +SET VERSION_JSON_URL=https://raw.githubusercontent.com/PredixDev/!REPO_NAME!/!BRANCH!/version.json + +GOTO START + +:CHECK_FAIL + IF NOT !errorlevel! EQU 0 ( + CALL :MANUAL + ) +GOTO :eof + +:MANUAL + ECHO. + ECHO. + ECHO Exiting tutorial. You can manually go through the tutorial steps here + ECHO !TUTORIAL! +GOTO :eof + +:CHECK_PERMISSIONS + echo Administrative permissions required. Detecting permissions... + + net session >nul 2>&1 + if %errorLevel% == 0 ( + echo Success: Administrative permissions confirmed. + ) else ( + echo Failure: Current permissions inadequate. This script installs tools, ensure you are launching Windows Command window by Right clicking and choosing 'Run as Administrator'. + EXIT /b 1 + ) +GOTO :eof + +:INIT + IF not "!CURRENTDIR!"=="!CURRENTDIR:System32=!" ( + ECHO. + ECHO. + ECHO Exiting tutorial. Looks like you are in the system32 directory, please change directories, e.g. \Users\your-login-name + EXIT /b 1 + ) + IF not "!CURRENTDIR!"=="!CURRENTDIR:\scripts=!" ( + ECHO. + ECHO. + ECHO Exiting tutorial. Please launch the script from the root dir of the project + EXIT /b 1 + ) + + mkdir !APP_DIR! + PUSHD !APP_DIR! + cd + + ECHO Let's start by verifying that you have the required tools installed. + SET /p answer=Should we install the required tools if not already installed (!TOOLS!)? + IF "!answer!"=="" ( + SET /p answer=Specify yes/no - + ) + IF "!answer:~0,1!"=="y" SET doInstall=Y + IF "!answer:~0,1!"=="Y" echo doInstall=Y + + if "!doInstall!"=="Y" ( + CALL :CHECK_PERMISSIONS + IF NOT !errorlevel! EQU 0 EXIT /b !errorlevel! + + CALL :GET_DEPENDENCIES + + ECHO Calling setup-windows.bat + CALL "setup-windows.bat" !TOOLS_SWITCHES! + IF NOT !errorlevel! EQU 0 ( + ECHO. + ECHO "Unable to install tools. Is there a proxy server? Perhaps if you go on a regular internet connection (turning off any proxy variables), the tools portion of the install will succeed. Please see detailed instructions about proxies at https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1565 " + EXIT /b !errorlevel! + ) + ECHO. + ECHO The required tools have been installed. Now you can proceed with the tutorial. + pause + ) + +GOTO :eof + +:GET_DEPENDENCIES + ECHO Getting Dependencies + + powershell -Command "(new-object net.webclient).DownloadFile('!IZON_BAT!','izon.bat')" + powershell -Command "(new-object net.webclient).DownloadFile('!VERSION_JSON_URL!','version.json')" + CALL izon.bat READ_DEPENDENCY local-setup LOCAL_SETUP_URL LOCAL_SETUP_BRANCH %cd% + ECHO "LOCAL_SETUP_BRANCH=!LOCAL_SETUP_BRANCH!" + SET SETUP_WINDOWS=https://raw.githubusercontent.com/PredixDev/local-setup/!LOCAL_SETUP_BRANCH!/setup-windows.bat + + ECHO !SETUP_WINDOWS! + powershell -Command "(new-object net.webclient).DownloadFile('!SETUP_WINDOWS!','setup-windows.bat')" + +GOTO :eof + +:START + + +ECHO. +ECHO Welcome to the %APP_NAME% Quickstart. +ECHO -------------------------------------------------------------- +ECHO. +ECHO This is an automated script which will guide you through the tutorial. +ECHO. + +if "!SKIP_SETUP!"=="FALSE" ( + CALL :INIT +) +CALL :CHECK_FAIL +IF NOT !errorlevel! EQU 0 EXIT /b !errorlevel! + +if !CF_URL!=="" ( + ECHO CF_URL=!CF_URL! +) else ( + rem this is here so jenkins can non-interactively log in to the cloud + cf login -a !CF_URL! -u !CF_USER! -p !CF_PASSWORD! -o !CF_ORG! -s !CF_SPACE! +) + +powershell -Command "(new-object net.webclient).DownloadFile('!SHELL_SCRIPT_URL!','!CURRENTDIR!\!SHELL_SCRIPT_NAME!')" +ECHO Running the !CURRENTDIR!\%SHELL_SCRIPT_NAME% script using Git-Bash +cd !CURRENTDIR! +ECHO. +"%PROGRAMFILES%\Git\bin\bash" --login -i -- "!CURRENTDIR!\%SHELL_SCRIPT_NAME%" -b !BRANCH! --skip-setup !QUICKSTART_ARGS! diff --git a/scripts/quickstart-rmd-ref-app.sh b/scripts/quickstart-rmd-ref-app.sh new file mode 100755 index 000000000..bb5b50412 --- /dev/null +++ b/scripts/quickstart-rmd-ref-app.sh @@ -0,0 +1,135 @@ +#!/bin/bash +set -e + +function local_read_args() { + while (( "$#" )); do + opt="$1" + case $opt in + -h|-\?|--\?--help) + PRINT_USAGE=1 + QUICKSTART_ARGS="$SCRIPT $1" + break + ;; + -b|--branch) + BRANCH="$2" + QUICKSTART_ARGS+=" $1 $2" + shift + ;; + -o|--override) + QUICKSTART_ARGS=" $SCRIPT" + ;; + --skip-setup) + SKIP_SETUP=true + ;; + --skip-pull) + SKIP_PULL=true + ;; + *) + QUICKSTART_ARGS+=" $1" + #echo $1 + ;; + esac + shift + done + + if [[ -z $BRANCH ]]; then + echo "Usage: $0 -b/--branch [--skip-setup]" + exit 1 + fi +} + +BRANCH="master" +PRINT_USAGE=0 +SKIP_SETUP=false +SKIP_PULL=false + +IZON_SH="https://raw.githubusercontent.com/PredixDev/izon/1.1.0/izon2.sh" +ASSET_MODEL="-amrmd predix-webapp-starter/server/sample-data/predix-asset/asset-model-metadata.json predix-webapp-starter/server/sample-data/predix-asset/asset-model.json" +SIMULATION_FILE="predix-rmd-ref-app/scripts/rmd-simulation.json" +SCRIPT="-script build-basic-app.sh -script-readargs build-basic-app-readargs.sh" +QUICKSTART_ARGS="-pxclimin 0.6.18 -uaa -asset -ts -dx -sim -rmd $ASSET_MODEL -psrmd $SCRIPT -sim-file $SIMULATION_FILE" +VERSION_JSON="version.json" +PREDIX_SCRIPTS=predix-scripts +REPO_NAME=predix-rmd-ref-app +VERSION_JSON="version.json" +APP_DIR="rmd-ref-app" +APP_NAME="RMD Asset Monitoring Reference App" +SCRIPT_NAME=quickstart-rmd-ref-app.sh +GITHUB_RAW="https://raw.githubusercontent.com/PredixDev" +TOOLS="Cloud Foundry CLI, Git, Java JDK, Maven, Node.js, Predix CLI" +TOOLS_SWITCHES="--cf --git --jdk --maven --nodejs --predixcli" + +# Process switches +local_read_args $@ + +#variables after processing switches +SCRIPT_LOC="$GITHUB_RAW/$REPO_NAME/$BRANCH/scripts/$SCRIPT_NAME" +VERSION_JSON_URL="$GITHUB_RAW/$REPO_NAME/$BRANCH/version.json" + + +function check_internet() { + set +e + echo "" + echo "Checking internet connection..." + curl "http://bing.com" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Unable to connect to internet, make sure you are connected to a network and check your proxy settings if behind a corporate proxy" + echo "If you are behind a corporate proxy, set the 'http_proxy' and 'https_proxy' environment variables." + exit 1 + fi + echo "OK" + echo "" + set -e +} + +function init() { + currentDir=$(pwd) + if [[ $currentDir == *"scripts" ]]; then + echo 'Please launch the script from the root dir of the project' + exit 1 + fi + + check_internet + + #get the script that reads version.json + eval "$(curl -s -L $IZON_SH)" + + #download the script and cd + getUsingCurl $SCRIPT_LOC + chmod 755 $SCRIPT_NAME; + if [[ ! $currentDir == *"$REPO_NAME" ]]; then + mkdir -p $APP_DIR + cd $APP_DIR + fi + + getVersionFile + getLocalSetupFuncs $GITHUB_RAW +} + +if [[ $PRINT_USAGE == 1 ]]; then + init + __print_out_standard_usage +else + if $SKIP_SETUP; then + init + else + init + __standard_mac_initialization + fi +fi + +getPredixScripts +#clone the repo itself if running from oneclick script +getCurrentRepo + +# cd predix-scripts/predix-rmd-ref-app +# echo "Pulling Submodules" +# if ! $SKIP_PULL; then +# ./scripts/pullSubModules.sh +# fi +# cd ../.. + +echo "quickstart_args=$QUICKSTART_ARGS" +source $PREDIX_SCRIPTS/bash/quickstart.sh $QUICKSTART_ARGS + +__append_new_line_log "Successfully completed $APP_NAME installation!" "$quickstartLogDir" diff --git a/scripts/rmd-simulation.json b/scripts/rmd-simulation.json new file mode 100644 index 000000000..70084f15f --- /dev/null +++ b/scripts/rmd-simulation.json @@ -0,0 +1,91 @@ +{ + "name": "RMD-Random-Simulation-1", + "tagSet": { + "tag": [ + { + "assetId": "Compressor-2017", + "nodeName": "CompressionRatio", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 2.4, + "upperThreshold": 3.2, + "duration": 30 + }] + }, + { + "assetId": "Compressor-2017", + "nodeName": "DischargePressure", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 0, + "upperThreshold": 25, + "duration": 30 + }] + }, + { + "assetId": "Compressor-2017", + "nodeName": "SuctionPressure", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 0, + "upperThreshold": 0.24, + "duration": 30 + }] + }, + { + "assetId": "Compressor-2017", + "nodeName": "MaximumPressure", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 21, + "upperThreshold": 27, + "duration": 30 + }] + }, + { + "assetId": "Compressor-2017", + "nodeName": "Velocity", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 0, + "upperThreshold": 0.09, + "duration": 30 + }] + }, + { + "assetId": "Compressor-2017", + "nodeName": "Temperature", + "assetNodeSeparator": ":", + "start": 0, + "interval": 3, + "dataType": "DOUBLE", + "simulationType": "RANDOM", + "range": [{ + "lowerThreshold": 63, + "upperThreshold": 84, + "duration": 30 + }] + } + ] + } +} diff --git a/scripts/submodules_checkout_develop b/scripts/submodules_checkout_develop new file mode 100755 index 000000000..c41f46309 --- /dev/null +++ b/scripts/submodules_checkout_develop @@ -0,0 +1,17 @@ +git status +pwd +cd ../data-exchange +git checkout manifest.yml +git checkout develop +cd ../data-exchange-simulator +git checkout manifest.yml +git checkout develop +cd ../predix-sdks +git checkout develop +cd ../rmd-datasource +git checkout manifest.yml +git checkout develop +cd ../predix-webapp-starter +git checkout manifest.yml +git checkout develop +cd .. diff --git a/scripts/submodules_checkout_master b/scripts/submodules_checkout_master new file mode 100755 index 000000000..3a7f48a08 --- /dev/null +++ b/scripts/submodules_checkout_master @@ -0,0 +1,15 @@ +git status + +cd predix-sdks +git checkout origin master +cd ../data-exchange +git checkout origin master +cd ../data-exchange-simulator +git checkout origin master +cd ../rmd-datasource +git checkout origin master +cd ../predix-webapp-starter +git checkout origin master +cd ../predix-websocket-server +git checkout origin master + diff --git a/scripts/submodules_pull_develop b/scripts/submodules_pull_develop new file mode 100755 index 000000000..953cca255 --- /dev/null +++ b/scripts/submodules_pull_develop @@ -0,0 +1,15 @@ +git status + +cd ../data-exchange +git pull origin develop +cd ../data-exchange-simulator +git pull origin develop +cd ../predix-sdks +git pull origin develop +cd ../predix-websocket-server +git pull origin develop +cd ../rmd-datasource +git pull origin develop +cd ../predix-webapp-starter +git pull origin develop +cd .. diff --git a/scripts/submodules_pull_master b/scripts/submodules_pull_master new file mode 100755 index 000000000..18790ec28 --- /dev/null +++ b/scripts/submodules_pull_master @@ -0,0 +1,16 @@ +git status + +cd predix-sdks +git pull origin master +cd ../data-exchange +git pull origin master +cd ../data-exchange-simulator +git pull origin master +cd ../rmd-datasource +git pull origin master +cd ../predix-webapp-starter +git pull origin master +cd ../predix-websocket-server +git pull origin master + + diff --git a/scripts/updateSubmodules.sh b/scripts/updateSubmodules.sh new file mode 100755 index 000000000..3c26eab1e --- /dev/null +++ b/scripts/updateSubmodules.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +GITHUB_REPO="$1" +GITHUB_REPO_BRANCH="$2" +REPO_NAME=$(echo $GITHUB_REPO | awk -F"/" '{print $NF}' | awk -F"." '{print $1}'); + +echo "GITHUB_REPO $GITHUB_REPO" +echo "REPO_NAME $REPO_NAME" +rm -rf $REPO_NAME +git clone $GITHUB_REPO -b $GITHUB_REPO_BRANCH --recursive +cd $REPO_NAME +git submodule foreach git pull origin develop +git commit -a -m "updating submodules" +git push diff --git a/version.json b/version.json new file mode 100644 index 000000000..3b0acc984 --- /dev/null +++ b/version.json @@ -0,0 +1,17 @@ +{ + "name": "Predix Asset Monitoring RMD Reference App", + "version": "2.0.254", + "private": true, + "dependencies": { + "data-exchange": "https://github.com/PredixDev/data-exchange#2.0.91", + "data-exchange-simulator": "https://github.com/PredixDev/data-exchange-simulator#1.0.91", + "data-exchange-ui": "https://github.com/PredixDev/data-exchange-ui#1.0.0", + "local-setup": "https://github.com/PredixDev/local-setup#1.0.101", + "predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.173", + "predix-webapp-starter": "https://github.com/PredixDev/predix-webapp-starter#2.0.53", + "rmd-datasource": "https://github.com/PredixDev/rmd-datasource#2.0.79", + "predix-websocket-server": "https://github.com/PredixDev/predix-websocket-server#2.1.41", + "predix-rmd-ref-app": "https://github.com/PredixDev/predix-rmd-ref-app#2.0.255" + }, + "author": "turnerth" +}