Skip to content

Commit

Permalink
Release 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
predix-adoption-bot committed Mar 16, 2019
1 parent 68b2c66 commit b787eec
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL maintainer="Predix Edge Adoption"
LABEL hub="https://hub.docker.com"
LABEL org="https://hub.docker.com/u/predixedge"
LABEL repo="predix-edge-sample-scaler-go"
LABEL version="1.0.3"
LABEL version="1.0.4"
LABEL support="https://forum.predix.io"
LABEL license="https://github.com/PredixDev/predix-docker-samples/blob/master/LICENSE.md"

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ Feb 28 03:23:52 predixedge b35f5fc9ed5b[319]: {"messageId":"flex-pipe","body":[{
## Software You will Need

In order to develop and run this sample locally you will need:
* [**Go**](https://golang.org/)
* [**Docker**](https://www.docker.com/)
* The *UAA URL*, *ClientID* and *Secret* for the Predix Cloud Time Series service to which you wish to ingest the app's output.

Expand Down Expand Up @@ -409,6 +408,13 @@ docker logs 0000000000

#### Option 2: Run all the containers on your machine, except for the Go code

This is very similar to Option 1, only instead of running the application in a Docker container, you run it locally on your machine.

## Software You will Need

In order to develop and run this sample locally you will need:
* [**Go**](https://golang.org/)

##### Step 1: Run the other containers of the Application

Start the Data Broker. It is recommended to run this as a separate docker stack becuase the broker can be used with multiple applications and Predix Edge OS is shipped with the Broker already running. Execute the following command from the command line.
Expand Down
4 changes: 2 additions & 2 deletions config/config-cloud-gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "timeseries",
"config": {
"log_name": "time_series_sender",
"log_level": "warn",
"log_level": "debug",
"mqtt": {
"transport_addr": "mqtt-tcp://predix-edge-broker",
"qos": 0,
Expand All @@ -22,7 +22,7 @@
"transport_addr": "wss://gateway-predix-data-services.run.aws-usw02-pr.ice.predix.io/v1/stream/messages",
"predix_zone_id": "your-predix-zone-id"
"token_file": "/edge-agent/access_token",
"proxy_url": "<<Put your proxy url>>"
"proxy_url": "$https_proxy"
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: "3.0"
#This file combines all the edge services and our services so that it can be deployed as a unit

services:
opcua-simulator:
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
hostname: "opcua-simulator"
volumes:
- ./config:/config
networks:
- predix-edge-broker_net
ports:
- 4334:4334
#entrypoint: ["sh", "-c", "sleep 500000"]
opcua:
image: "dtr.predix.io/predix-edge/protocol-adapter-opcua:amd64-1.1.0"
environment:
Expand All @@ -24,7 +24,11 @@ services:
image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
environment:
config: "/config/config-cloud-gateway.json"
https_proxy: "$https_proxy"
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
HTTP_PROXY: ${HTTP_PROXY}
HTTPS_PROXY: ${HTTP_PROXY}
no_proxy: ${no_proxy}
volumes:
- ./config:/config
- ./data:/data
Expand Down
16 changes: 7 additions & 9 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ version: "3.0"
#This file combines all the edge services and our services so that it can be deployed as a unit
services:
opcua-simulator:
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
hostname: "opcua-simulator"
volumes:
- ./config:/config
networks:
- predix-edge-broker_net
ports:
- 4334:4334
#entrypoint: ["sh", "-c", "sleep 500000"]
opcua:
image: "dtr.predix.io/predix-edge/protocol-adapter-opcua:amd64-1.1.0"
environment:
Expand All @@ -24,14 +23,19 @@ services:
image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
environment:
config: "/config/config-cloud-gateway.json"
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
HTTP_PROXY: ${HTTP_PROXY}
HTTPS_PROXY: ${HTTP_PROXY}
no_proxy: ${no_proxy}
volumes:
- ./config:/config
- ./data:/data
- ./data:/edge-agent
networks:
- predix-edge-broker_net
edge-app:
image: "predixedge/predix-edge-sample-scaler-go:1.0.3"
image: "predixedge/predix-edge-sample-scaler-go:1.0.4"
environment:
CLIENT_ID: "go-simple"
BROKER: "predix-edge-broker:1883"
Expand All @@ -42,12 +46,6 @@ services:
- ./config:/config
- ./data:/data
- ./data:/edge-agent
environment:
CLIENT_ID: "go-simple"
BROKER: "predix-edge-broker:1883"
PUB_TOPIC: "timeseries_data"
SUB_TOPIC: "app_data"
TAG_NAME: "My.App.DOUBLE1"
networks:
- predix-edge-broker_net
#entrypoint: ["sh", "-c", "sleep 500000"]
Expand Down
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ version: "3.0"

services:
opcua-simulator:
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
hostname: "opcua-simulator"
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
networks:
- predix-edge-broker_net
ports:
- 4334:4334
#entrypoint: ["sh", "-c", "sleep 500000"]
opcua:
image: "dtr.predix.io/predix-edge/protocol-adapter-opcua:amd64-1.1.0"

environment:
config: "/config/config-opcua.json"
networks:
Expand All @@ -24,7 +23,7 @@ services:
networks:
- predix-edge-broker_net
edge-app:
image: "predixedge/predix-edge-sample-scaler-go:1.0.3"
image: "predixedge/predix-edge-sample-scaler-go:1.0.4"
environment:
CLIENT_ID: "go-simple"
BROKER: "predix-edge-broker:1883"
Expand Down
Binary file modified images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 23 additions & 18 deletions scripts/quickstart-edge-starter-sample-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ function local_read_args() {
BRANCH="master"
PRINT_USAGE=0
SKIP_SETUP=false
GITHUB_RAW="https://raw.githubusercontent.com"
VERSION_JSON="version.json"
PREDIX_SCRIPTS_ORG="PredixDev"
PREDIX_SCRIPTS="predix-scripts"
GITHUB_RAW="https://raw.githubusercontent.com"
IZON_SH="https://raw.githubusercontent.com/PredixDev/izon/1.5.0/izon2.sh"

GITHUB_ORG="PredixDev"
REPO_NAME="predix-edge-sample-scaler-go"
IZON_SH="https://raw.githubusercontent.com/PredixDev/izon/1.5.0/izon2.sh"
DOCKER_STACK_NAME="predix-edge-sample-scaler-go"
SCRIPT="-script edge-starter-deploy.sh -script-readargs edge-starter-deploy-readargs.sh"
SCRIPT_NAME="quickstart-edgesample-scaler-go-local.sh"
SCRIPT_NAME="quickstart-edge-starter-sample-app.sh"
APP_DIR="edge-sample-scaler-go"
APP_NAME="Predix Edge Sample Scaler App - Go"

TOOLS="Cloud Foundry CLI, Docker, Git, jq, yq, Go, Predix CLI"
TOOLS_SWITCHES="--cf --docker --git --jq --yq --go --predixcli"

Expand All @@ -75,10 +75,11 @@ local_read_args $@
SCRIPT_LOC="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/scripts/$SCRIPT_NAME"
VERSION_JSON_URL="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/version.json"

if [[ "$SKIP_PREDIX_SERVICES" == "false" ]]; then
QUICKSTART_ARGS="$QUICKSTART_ARGS -uaa -ts -psts -app-name $REPO_NAME --run-edge-app -p $SCRIPT"
if [[ "$SKIP_PREDIX_SERVICES" == "true" ]]; then
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT -uaa -ts -psts --run-edge-app -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
else
QUICKSTART_ARGS="$QUICKSTART_ARGS -app-name $REPO_NAME --run-edge-app -p $SCRIPT"
PS_MODEL="sample-data/predix-asset/Compressor-CMMS-Compressor-2018-Scaled.json"
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT -uaa -ts -psts -psmodel $PS_MODEL --run-edge-app -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
fi

function check_internet() {
Expand Down Expand Up @@ -134,31 +135,35 @@ fi

getPredixScripts
#clone the repo itself if running from oneclick script
rm -rf predix-scripts/$REPO_NAME
getCurrentRepo

docker images
if ! [ -d "$logDir" ]; then
mkdir "$logDir"
chmod 744 "$logDir"
fi

########### custom logic starts here ###########
if [[ "$BUILD_APP" == "true" ]]; then
cd $PREDIX_SCRIPTS/$REPO_NAME
dockerVersion=$(grep version Dockerfile | awk -F"=" '{print $2}' | tr -d "\"")
echo "$dockerVersion"
docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY --build-arg http_proxy --build-arg https_proxy -t predixedge/predix-edge-sample-scaler-go:latest .
version=$(jq -r .version version.json)
echo "version : $version"
docker tag predixedge/predix-edge-sample-scaler-go:latest predixedge/predix-edge-sample-scaler-go:${version}
cd ../..
fi
echo "quickstart_args=$QUICKSTART_ARGS"
source $PREDIX_SCRIPTS/bash/quickstart.sh $QUICKSTART_ARGS

docker stack ls
docker stack services $REPO_NAME
docker ps
docker service ls
echo ""
echo ""
docker network ls
########### custom logic ends here ###########

echo "quickstart_args=$QUICKSTART_ARGS"
source $PREDIX_SCRIPTS/bash/quickstart.sh $QUICKSTART_ARGS

cat $SUMMARY_TEXTFILE
if [[ $SKIP_PREDIX_SERVICES == false ]]; then
__append_new_line_log "To see the data in the cloud, using a browser, open the Front-end App URL shown above. With login=app_user_1, password=App_User_111" "$quickstartLogDir"
fi
__append_new_line_log "" "$logDir"
__append_new_line_log "Successfully completed Edge Sample Scaler Go installation!" "$quickstartLogDir"
__append_new_line_log "Successfully completed $APP_NAME installation!" "$quickstartLogDir"
__append_new_line_log "" "$logDir"
6 changes: 0 additions & 6 deletions scripts/quickstart-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ SCRIPT_LOC="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/scripts/$SCRIPT_NAME"
VERSION_JSON_URL="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/version.json"


#if [[ "$SKIP_PREDIX_SERVICES" == "false" ]]; then
# QUICKSTART_ARGS="$QUICKSTART_ARGS --run-edge-app -p $SCRIPT"
#else
# QUICKSTART_ARGS="$QUICKSTART_ARGS -uaa -ts -psts --run-edge-app -p $SCRIPT"
#fi

function check_internet() {
set +e
echo ""
Expand Down
2 changes: 1 addition & 1 deletion src/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var defaultMessageHandler MQTT.MessageHandler = func(client MQTT.Client, msg MQT
doubleData = doubleData * 1000
//put datapoint back into data
m.Body[i].Datapoints[0][1] = doubleData
//m.Body[0].Name = tagName + ".scaled_by_1000" //Rename tag
m.Body[i].Name = m.Body[i].Name + ".scaled_x_1000" //Rename tag
fmt.Println("Changed data for "+m.Body[i].Name)
}
}
Expand Down
8 changes: 4 additions & 4 deletions version.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "Predix Edge Sample Scaler Go",
"version": "1.0.3",
"version": "1.0.4",
"private": true,
"dependencies": {
"local-setup": "https://github.com/PredixDev/local-setup#1.0.106",
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.231",
"predix-webapp-starter": "https://github.com/PredixDev/predix-webapp-starter.git#2.0.80",
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.241",
"predix-webapp-starter": "https://github.com/PredixDev/predix-webapp-starter.git#2.0.92",
"predix-edge-broker": "https://artifactory.predix.io/artifactory/PREDIX-EXT/predix-edge/2_1_0/os/predix-edge-broker-amd64-20180917-1.0.2.tar.gz#",
"opcua": "https://artifactory.predix.io/artifactory/PREDIX-EXT/predix-edge/2_1_0/apps/adapters/predix-edge-opc-ua-adapter-amd64-20181002-1.1.0.tar.gz#",
"predix-edge-sample-scaler-go": "https://github.com/PredixDev/predix-edge-sample-scaler-go.git#1.0.3",
"predix-edge-sample-scaler-go": "https://github.com/PredixDev/predix-edge-sample-scaler-go.git#1.0.4",
"cloud_gateway": "https://artifactory.predix.io/artifactory/PREDIX-EXT/predix-edge/2_1_0/apps/gateway/predix-edge-cloud-gateway-amd64-20181002-1.1.0.tar.gz#"
},
"author": "gedesigntech"
Expand Down

0 comments on commit b787eec

Please sign in to comment.