Skip to content

Commit 1ed119b

Browse files
Release 1.0.6
1 parent 7ed2013 commit 1ed119b

9 files changed

+65
-27
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.5"
11+
LABEL version="1.0.6"
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: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ The manual steps for Edge are in the Manual Set Up section below. (The cloud ma
155155

156156
For DevBox, Mac and Linux
157157

158+
For DevBox install the yq tool
159+
160+
```bash
161+
sudo pip install yq
162+
```
163+
158164
If you have a Predix Cloud account with an org/space:
159165

160166
```bash
@@ -181,9 +187,16 @@ To get started developing locally you will need to pull the core Predix Edge Doc
181187

182188
Install the Predix Edge Broker
183189

184-
Using a browser, log in to https://artifactory.predix.io using your predix username and password. GE users will use the SSO feature to login, use your SSO where it says your-predix-account below.
190+
Check the version of the Broker in the docker-compose-edge-broker.yml
191+
192+
```bash
193+
cat docker-compose-edge-broker.yml
194+
```
195+
196+
Using a browser, log in to https://artifactory.predix.io using your predix username and password. GE users will use the SSO feature to login, use your SSO where it says your-predix-account below.
197+
198+
Click the `Artifacts` icon and navigate to the `predix-ext/predix-edge/<edgeos-version-here>/os` folder and `Download` the `edge-broker` container version that matches the docker-compose-edge-broker.yml.
185199

186-
Click the `Artifacts` icon and navigate to the predix-ext/predix-edge/<latest-version-here>/os folder and Download the `edge-broker` container.
187200
**Changing the** command to use the **version** you downloaded, using a tool on your computer, untar it, e.g.
188201

189202
```bash
@@ -203,11 +216,18 @@ docker load -i *.tar
203216
```
204217

205218
Now repeat the steps for the OPCUA Adapter and Cloud Gateway
219+
220+
Check the version of the OPCUA Adapter and Cloud Gateway in the docker-compose-local.yml
221+
206222
```bash
207-
predix-ext/predix-edge/<latest-version-here>/apps/adapters/<latest-opcua-adapter-here>
223+
cat docker-compose-edge-local.yml
208224
```
225+
209226
```bash
210-
predix-ext/predix-edge/<latest-version-here>/apps/gateway/<latest-cloud-gateway-here>
227+
predix-ext/predix-edge/<edgeos-version-here>/apps/adapters/<opcua-adapter-version-here>
228+
```
229+
```bash
230+
predix-ext/predix-edge/<edgeos-version-here>/apps/gateway/<cloud-gateway-version-here>
211231
```
212232

213233
Finally, create a [Docker Swarm](https://docs.docker.com/engine/swarm/) on your machine. You only need to do this once on your machine. If you have done so in the past you can disregard this step.
@@ -367,7 +387,15 @@ This file is used by the Cloud Gateway service and contains properties indicatin
367387

368388
### Step 6. Run the App and Validate the Results
369389

370-
#### Step 1: Get Access Token
390+
#### Step 1: Make data Dir Writeable
391+
392+
First let's make the data dir writeable. This is needed when running the app because the username inside the container does not match your username.
393+
394+
```bash
395+
chmod 777 ./data
396+
```
397+
398+
#### Step 2: Get Access Token
371399

372400
The result of this app is to publish a scaled value to Predix Cloud Time Series. In order to do so, the app requires a UAA token with permissions to ingest data. On a Predix Edge device, apps obtain this token from the device once it is enrolled to Edge Manager.
373401

@@ -376,10 +404,10 @@ During development, though, you must generate a token to be used by the app. To
376404
The script takes three input parameters:
377405
- `my-client-id` - the client id for your instance of UAA: it must have permissions to ingest data into your Time Series instance
378406
- `my-secret` - the client secret for that client id
379-
- `my-uaa-url` - must be the full URL including the /oauth/token ending
407+
- `my-uaa-issuerid-url` - must be the full URL including the /oauth/token ending
380408

381409
```bash
382-
./scripts/get-access-token.sh my-client-id my-secret my-uaa-url
410+
./scripts/get-access-token.sh my-client-id my-secret my-uaa-issuerid-url
383411
```
384412

385413
After you run the script, a file named *access_token* will be created in the data folder of the app. The app is configured to use this file to obatin the token for transmitting data to the cloud.

config/config-cloud-gateway.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"timeseries": {
2222
"transport_addr": "wss://gateway-predix-data-services.run.aws-usw02-pr.ice.predix.io/v1/stream/messages",
23-
"predix_zone_id": "your-predix-zone-id"
23+
"predix_zone_id": "your-predix-zone-id",
2424
"token_file": "/edge-agent/access_token",
2525
"proxy_url": "$https_proxy"
2626
}

docker-compose-local.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
- predix-edge-broker_net
3838

3939
edge-app:
40-
image: "predixedge/predix-edge-sample-scaler-python:1.0.5"
40+
image: "predixedge/predix-edge-sample-scaler-python:1.0.6"
4141
environment:
4242
- PYTHONUNBUFFERED=0 # To shows print statements in docker logs
4343
- BROKER=predix-edge-broker

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
networks:
2525
- predix-edge-broker_net
2626
edge-app:
27-
image: "predixedge/predix-edge-sample-scaler-python:1.0.5"
27+
image: "predixedge/predix-edge-sample-scaler-python:1.0.6"
2828
environment:
2929
- PYTHONUNBUFFERED=0 # To shows print statements in docker logs
3030
- BROKER=predix-edge-broker

scripts/get-access-token.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# get command line paramaters
2+
3+
set -e
4+
25
CLIENT_ID=$1
36
SECRET=$2
47
UAA_URL=$3
58

9+
echo "usage: createAccessTokenFile <clientId> <secret> <uaa-issuerid-url>"
610

711
# base64 encide the client and secret
812
AUTH='Authorization: Basic '$(echo -n $CLIENT_ID:$SECRET | base64)
@@ -11,10 +15,20 @@ AUTH='Authorization: Basic '$(echo -n $CLIENT_ID:$SECRET | base64)
1115
RESULT=$(curl -X POST $UAA_URL -H "$AUTH" -H 'Content-Type: application/x-www-form-urlencoded' -d grant_type=client_credentials)
1216

1317
# parse out the access token from the result - this requires jq to be installed on your machine (brew install jq)
14-
ACCESS_TOKEN=$( echo "$RESULT" | jq -r '.["access_token"]' )
15-
16-
# copy the access token to the access_token file in the data folder of your app - where the Cloud Gateway container will look for it
17-
mkdir -p data
18-
printf "%s" "$ACCESS_TOKEN" > ./data/access_token
19-
20-
echo 'token refreshed'
18+
if [[ $( echo "$RESULT" | jq 'has("access_token")') == true ]]; then
19+
ACCESS_TOKEN=$( echo "$RESULT" | jq -r '.["access_token"]' )
20+
# copy the access token to the access_token file in the data folder of your app - where the Cloud Gateway container will look for it
21+
mkdir -p ./data
22+
printf "%s" "$ACCESS_TOKEN" > ./data/access_token
23+
chmod -R 777 data
24+
echo 'token refreshed'
25+
else
26+
echo "Coult not fetch token : $RESULT"
27+
echo "Please check if the paramters passed are correct"
28+
echo "$CLIENT_ID $SECRET $UAA_URL"
29+
echo "CURL COMAND : curl -X POST $UAA_URL -H "$AUTH" -H 'Content-Type: application/x-www-form-urlencoded' -d grant_type=client_credentials"
30+
mkdir -p ./data
31+
printf "%s" "" > ./data/access_token
32+
chmod -R 777 data
33+
exit 1
34+
fi

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ function init() {
103103
echo 'Please launch the script from the root dir of the project'
104104
exit 1
105105
fi
106-
if [[ ! $currentDir == *"$REPO_NAME" ]]; then
107-
mkdir -p $APP_DIR
108-
cd $APP_DIR
109-
fi
110106

111107
check_internet
112108

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.5',
14+
version='1.0.6',
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.5",
3+
"version": "1.0.6",
44
"private": true,
55
"dependencies": {
6-
"local-setup": "https://github.com/PredixDev/local-setup#1.0.106",
7-
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.242",
6+
"local-setup": "https://github.com/PredixDev/local-setup#1.0.107",
7+
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.246",
88
"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.5",
9+
"predix-edge-sample-scaler-python": "https://github.com/PredixDev/predix-edge-sample-scaler-python.git#1.0.6",
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)