Skip to content

Commit 9fee4b8

Browse files
Release 1.0.4
1 parent 63a833d commit 9fee4b8

9 files changed

+80
-61
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LABEL maintainer="Predix Edge Adoption"
88
LABEL hub="https://hub.docker.com"
99
LABEL org="https://hub.docker.com/u/predixedge"
1010
LABEL repo="predix-edge-sample-scaler-python"
11-
LABEL version="1.0.1"
11+
LABEL version="1.0.4"
1212
LABEL support="https://forum.predix.io"
1313
LABEL license="https://github.com/PredixDev/predix-docker-samples/blob/master/LICENSE.md"
1414

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,9 @@ Feb 28 03:23:52 predixedge b35f5fc9ed5b[319]: {"messageId":"flex-pipe","body":[{
140140
### Software You will Need
141141

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

147-
To download dependencies, run `pip3 install -r requirements.txt`. Unit tests are in the [test](test/) directory. To run the tests, run `python3 setup.py test`.
148-
149146
### Step 1: Install the core Predix Edge components
150147

151148
To get started developing locally you will need to pull the core Predix Edge Docker images onto your local machine.
@@ -389,6 +386,14 @@ $ docker logs 0000000000
389386

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

389+
### Software You will Need
390+
391+
In order to develop and run this sample locally you will need:
392+
* [**Python 3**](https://www.python.org/)
393+
394+
To download dependencies, run `pip3 install -r requirements.txt`. Unit tests are in the [test](test/) directory. To run the tests, run `python3 setup.py test`.
395+
396+
392397
##### Step 1: Run the other containers of the Application
393398

394399
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.

docker-compose-dev.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
version: "3.0"
2+
#This file combines all the edge services and our services so that it can be deployed as a unit
23

34
services:
45
opcua-simulator:
5-
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
6+
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
7+
hostname: "opcua-simulator"
68
volumes:
79
- ./config:/config
810
networks:
@@ -22,6 +24,11 @@ services:
2224
image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
2325
environment:
2426
config: "/config/config-cloud-gateway.json"
27+
http_proxy: ${http_proxy}
28+
https_proxy: ${https_proxy}
29+
HTTP_PROXY: ${HTTP_PROXY}
30+
HTTPS_PROXY: ${HTTP_PROXY}
31+
no_proxy: ${no_proxy}
2532
volumes:
2633
- ./config:/config
2734
- ./data:/data

docker-compose-local.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
version: "3.0"
2+
#This file combines all the edge services and our services so that it can be deployed as a unit
23

34
services:
45
opcua-simulator:
5-
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
6+
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
7+
hostname: "opcua-simulator"
68
volumes:
79
- ./config:/config
810
networks:
@@ -18,11 +20,15 @@ services:
1820
- ./data:/data
1921
networks:
2022
- predix-edge-broker_net
21-
2223
cloud_gateway:
2324
image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
2425
environment:
2526
config: "/config/config-cloud-gateway.json"
27+
http_proxy: ${http_proxy}
28+
https_proxy: ${https_proxy}
29+
HTTP_PROXY: ${HTTP_PROXY}
30+
HTTPS_PROXY: ${HTTP_PROXY}
31+
no_proxy: ${no_proxy}
2632
volumes:
2733
- ./config:/config
2834
- ./data:/data
@@ -31,7 +37,7 @@ services:
3137
- predix-edge-broker_net
3238

3339
edge-app:
34-
image: "predixedge/predix-edge-sample-scaler-python:1.0.1"
40+
image: "predixedge/predix-edge-sample-scaler-python:1.0.4"
3541
environment:
3642
- PYTHONUNBUFFERED=0 # To shows print statements in docker logs
3743
- BROKER=predix-edge-broker

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
version: "3.0"
2+
#This file combines all the edge services and our services so that it can be deployed as a unit
23

34
services:
45
opcua-simulator:
5-
image: "predixedge/predix-edge-opcua-simulator:1.0.9"
6+
image: "predixedge/predix-edge-opcua-simulator:1.0.10"
67
networks:
78
- predix-edge-broker_net
89
ports:
910
- 4334:4334
1011
opcua:
1112
image: "dtr.predix.io/predix-edge/protocol-adapter-opcua:amd64-1.1.0"
13+
1214
environment:
1315
config: "/config/config-opcua.json"
1416
networks:
1517
- predix-edge-broker_net
16-
1718
cloud_gateway:
1819
image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
1920
environment:
@@ -22,9 +23,8 @@ services:
2223
- /etc/environment
2324
networks:
2425
- predix-edge-broker_net
25-
2626
edge-app:
27-
image: "predixedge/predix-edge-sample-scaler-python:1.0.1"
27+
image: "predixedge/predix-edge-sample-scaler-python:1.0.4"
2828
environment:
2929
- PYTHONUNBUFFERED=0 # To shows print statements in docker logs
3030
- BROKER=predix-edge-broker

scripts/quickstart-edge-starter-sample-app.sh

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,35 @@ function local_read_args() {
5151
BRANCH="master"
5252
PRINT_USAGE=0
5353
SKIP_SETUP=false
54-
54+
VERSION_JSON="version.json"
55+
PREDIX_SCRIPTS="predix-scripts"
56+
PREDIX_SCRIPTS_ORG="PredixDev"
57+
GITHUB_RAW="https://raw.githubusercontent.com"
5558
IZON_SH="https://raw.githubusercontent.com/PredixDev/izon/1.5.0/izon2.sh"
56-
#ASSET_MODEL="-amrmd predix-ui-seed/server/sample-data/predix-asset/asset-model-metadata.json predix-ui-seed/server/sample-data/predix-asset/asset-model.json"
59+
60+
GITHUB_ORG="PredixDev"
5761
REPO_NAME="predix-edge-sample-scaler-python"
5862
DOCKER_ORG="predixedge"
5963
DOCKER_STACK_NAME="predix-edge-sample-scaler-python"
60-
SCRIPT="-script edge-starter-deploy.sh -script-readargs edge-starter-deploy-readargs.sh --run-edge-app"
61-
VERSION_JSON="version.json"
62-
PREDIX_SCRIPTS="predix-scripts"
63-
PREDIX_SCRIPTS_ORG="PredixDev"
64-
VERSION_JSON="version.json"
64+
SCRIPT="-script edge-starter-deploy.sh -script-readargs edge-starter-deploy-readargs.sh"
65+
SCRIPT_NAME="quickstart-edge-starter-sample-app.sh"
6566
APP_DIR="edge-python-scaler"
6667
APP_NAME="Edge_Python_Scaler"
67-
GITHUB_RAW="https://raw.githubusercontent.com"
68-
GITHUB_ORG="PredixDev"
69-
GITHUB_RAW_REPO="https://raw.githubusercontent.com/PredixDev"
70-
71-
TOOLS="Docker, Git, Python"
72-
TOOLS_SWITCHES="--docker --git --python"
68+
TOOLS="Cloud Foundry CLI, Docker, Git, jq, Predix CLI, yq"
69+
TOOLS_SWITCHES="--cf --docker --git --jq --predixcli --yq"
70+
TIMESERIES_CHART_ONLY="true"
7371

7472
# Process switches
7573
local_read_args $@
7674

75+
SCRIPT_LOC="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/scripts/$SCRIPT_NAME"
7776
VERSION_JSON_URL="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/version.json"
7877

7978
if [[ "$SKIP_PREDIX_SERVICES" == "true" ]]; then
80-
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
79+
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT --run-edge-app -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
8180
else
82-
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT -uaa -ts -psts -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
81+
PS_MODEL="sample-data/predix-asset/Compressor-CMMS-Compressor-2018-Scaled.json"
82+
QUICKSTART_ARGS="$QUICKSTART_ARGS $SCRIPT -uaa -ts -psts -psmodel $PS_MODEL --run-edge-app -repo-name $REPO_NAME -app-name $DOCKER_STACK_NAME"
8383
fi
8484

8585
function check_internet() {
@@ -113,6 +113,14 @@ function init() {
113113
#get the script that reads version.json
114114
eval "$(curl -s -L $IZON_SH)"
115115

116+
#download script and cd
117+
getUsingCurl $SCRIPT_LOC
118+
chmod 755 $SCRIPT_NAME;
119+
if [[ ! $currentDir == *"$REPO_NAME" ]]; then
120+
mkdir -p $APP_DIR
121+
cd $APP_DIR
122+
fi
123+
116124
getVersionFile
117125
getLocalSetupFuncs $GITHUB_RAW $PREDIX_SCRIPTS_ORG
118126
}
@@ -131,40 +139,40 @@ fi
131139

132140
getPredixScripts
133141
#clone the repo itself if running from oneclick script
134-
#if [[ ! -d "$PREDIX_SCRIPTS/$REPO_NAME" ]]; then
135-
# echo "repo not present"
136142
getCurrentRepo
137-
#fi
138-
139-
echo "pwd after copy -> $(pwd)"
140-
echo "quickstart_args=$QUICKSTART_ARGS"
141-
cd $PREDIX_SCRIPTS/$REPO_NAME
142-
dockerVersion=$(grep version Dockerfile | awk -F"=" '{print $2}' | tr -d "\"")
143-
echo "$dockerVersion"
144-
if [[ "$BUILD_APP" == "true" ]]; then
145-
docker build --no-cache -t "$DOCKER_ORG/$DOCKER_STACK_NAME:latest" -t "$DOCKER_ORG/$DOCKER_STACK_NAME:$dockerVersion" -f ./Dockerfile . --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy
146-
fi
147-
cd ../..
148-
149-
export TIMESERIES_CHART_ONLY="true"
150143

151-
source $PREDIX_SCRIPTS/bash/quickstart.sh $QUICKSTART_ARGS
152-
153-
########### custom logic starts here ###########
154144
if ! [ -d "$logDir" ]; then
155145
mkdir "$logDir"
156146
chmod 744 "$logDir"
157147
fi
158148

159-
########### custom logic ends here ###########
149+
########### custom logic starts here ###########
150+
if [[ "$BUILD_APP" == "true" ]]; then
151+
cd $PREDIX_SCRIPTS/$REPO_NAME
152+
dockerVersion=$(grep version Dockerfile | awk -F"=" '{print $2}' | tr -d "\"")
153+
echo "$dockerVersion"
154+
docker build --no-cache -t "$DOCKER_ORG/$DOCKER_STACK_NAME:latest" -t "$DOCKER_ORG/$DOCKER_STACK_NAME:$dockerVersion" -f ./Dockerfile . --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy
155+
cd ../..
156+
fi
157+
160158
docker service ls
161159
echo ""
162160
echo ""
163161
docker network ls
162+
########### custom logic ends here ###########
163+
164+
echo "quickstart_args=$QUICKSTART_ARGS"
165+
source $PREDIX_SCRIPTS/bash/quickstart.sh $QUICKSTART_ARGS
164166

165167
echo "" >> $SUMMARY_TEXTFILE
166-
echo "Edge to Cloud App " >> $SUMMARY_TEXTFILE
168+
echo "$APP_NAME App quickstart complete " >> $SUMMARY_TEXTFILE
167169
echo "" >> $SUMMARY_TEXTFILE
168170

169171
cat $SUMMARY_TEXTFILE
170-
echo "......................................Done......................................"
172+
173+
if [[ $SKIP_PREDIX_SERVICES == false ]]; then
174+
__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"
175+
fi
176+
__append_new_line_log "" "$logDir"
177+
__append_new_line_log "Successfully completed $APP_NAME installation!" "$quickstartLogDir"
178+
__append_new_line_log "" "$logDir"

scripts/quickstart-package.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ GITHUB_ORG="PredixDev"
5959
APP_DIR="edge-python-scaler"
6060
APP_NAME="Edge_Python_Scaler"
6161
TOOLS="Docker, Git, JQ, YQ"
62-
TOOLS_SWITCHES="--cf --docker --git --jq --python2 --python3 --predixcli --yq"
62+
TOOLS_SWITCHES="--docker --git --jq --yq"
6363
TIMESERIES_CHART_ONLY="true"
6464

6565
# Process switches
@@ -69,13 +69,6 @@ local_read_args $@
6969
SCRIPT_LOC="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/scripts/$SCRIPT_NAME"
7070
VERSION_JSON_URL="$GITHUB_RAW/$GITHUB_ORG/$REPO_NAME/$BRANCH/version.json"
7171

72-
73-
#if [[ "$SKIP_PREDIX_SERVICES" == "false" ]]; then
74-
# QUICKSTART_ARGS="$QUICKSTART_ARGS --run-edge-app -p $SCRIPT"
75-
#else
76-
# QUICKSTART_ARGS="$QUICKSTART_ARGS -uaa -ts -psts --run-edge-app -p $SCRIPT"
77-
#fi
78-
7972
function check_internet() {
8073
set +e
8174
echo ""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
setup(
1313
name='predix-edge-sample-scaler-python',
14-
version='1.0.1',
14+
version='1.0.4',
1515
description='Predix Edge Sample Python App',
1616
long_description=long_description,
1717
install_requires=install_requires,

version.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "Predix Edge Sample Scaler Python",
3-
"version": "1.0.1",
3+
"version": "1.0.4",
44
"private": true,
55
"dependencies": {
66
"local-setup": "https://github.com/PredixDev/local-setup#1.0.106",
7-
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.230",
8-
"predix-webapp-starter": "https://github.com/PredixDev/predix-webapp-starter.git#2.0.80",
9-
"predix-edge-sample-scaler-python": "https://github.com/PredixDev/predix-edge-sample-scaler-python.git#1.0.1",
7+
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.241",
8+
"predix-webapp-starter": "https://github.com/PredixDev/predix-webapp-starter.git#2.0.92",
9+
"predix-edge-sample-scaler-python": "https://github.com/PredixDev/predix-edge-sample-scaler-python.git#1.0.4",
1010
"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#",
1111
"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#",
1212
"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#"

0 commit comments

Comments
 (0)