Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 51e2007

Browse files
authored
Vehicle Lifecycle Demo - First Release (#44)
* Added Initial Vehicle Lifecycle files * Renamed packages * Conversion to open source * Updated install * Updated gitignore * Force build * Do the needful * Updated travis.yml * Update docker version * Docker update * Updated v1 deploy user
1 parent dbb5fde commit 51e2007

File tree

369 files changed

+211448
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+211448
-23
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ build/Release
2828

2929
# Dependency directories
3030
node_modules
31+
bower_components
3132
jspm_packages
3233

3334
# Optional npm cache directory

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ before_install: |
77
set -o pipefail
88
npm install -g npm@4
99
npm install -g @alrra/travis-scripts
10+
npm install -g cordova
1011
1112
script: ./.travis/script.sh
13+
deploy:
14+
provider: script
15+
script: ./.travis/deploy.sh
16+
skip_cleanup: true
17+
on:
18+
all_branches: true
1219
after_failure: |
1320
tail -n +1 -- /home/travis/.npm/_logs/*-debug.log
1421
sudo: required

.travis/build.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ABORT_BUILD=true

.travis/deploy.sh

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/bin/bash
2+
3+
# Exit on first error, print all commands.
4+
set -ev
5+
set -o pipefail
6+
7+
# Grab the parent (root) directory.
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
9+
date
10+
ME=`basename "$0"`
11+
12+
source ${DIR}/build.cfg
13+
14+
if [ "${ABORT_BUILD}" = "true" ]; then
15+
echo exiting early from ${ME}
16+
exit ${ABORT_CODE}
17+
fi
18+
19+
# Check that this is the right node.js version.
20+
if [ "${TRAVIS_NODE_VERSION}" != "" -a "${TRAVIS_NODE_VERSION}" != "6" ]; then
21+
echo Not executing as not running primary node.js version.
22+
exit 0
23+
fi
24+
25+
# Check that this is not the system tests.
26+
if [ "${SYSTEST}" != "" ]; then
27+
echo Not executing as running system tests.
28+
exit 0
29+
fi
30+
31+
# Check that this is the main repository.
32+
if [[ "${TRAVIS_REPO_SLUG}" != hyperledger* ]]; then
33+
echo "Skipping deploy; wrong repository slug."
34+
exit 0
35+
fi
36+
37+
# are we building the docs?
38+
if [ "${DOCS}" != "" ]; then
39+
if [ -z "${TRAVIS_TAG}" ]; then
40+
DOCS="unstable"
41+
else
42+
DOCS="full"
43+
fi
44+
./.travis/deploy_docs.sh
45+
exit 0
46+
fi
47+
48+
49+
# Set the GitHub deploy key we will use to publish.
50+
set-up-ssh --key "$encrypted_c6d9af089ec4_key" \
51+
--iv "$encrypted_c6d9af089ec4_iv" \
52+
--path-encrypted-key ".travis/github_deploy_key.enc"
53+
54+
# Change from HTTPS to SSH.
55+
./.travis/fix_github_https_repo.sh
56+
57+
# Test the GitHub deploy key.
58+
git ls-remote
59+
60+
# Log in to Docker Hub.
61+
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
62+
63+
# This is the list of Docker images to build.
64+
export DOCKER_IMAGES=(vehicle-lifecycle-car-builder vehicle-lifecycle-manufacturing vehicle-lifecycle-vda)
65+
export VERSION=($(node -e "console.log(require('${DIR}/package.json').version)"))
66+
67+
# Push the code to npm.
68+
if [ -z "${TRAVIS_TAG}" ]; then
69+
70+
npm run pkgstamp
71+
for image in ${DOCKER_IMAGES}; do
72+
73+
# Build the image and tag it with the version and unstable.
74+
docker build --build-arg VERSION=${VERSION} -t hyperledger/${image}:${VERSION}${DIR}/packages/${image}/docker
75+
docker tag hyperledger/${image}:${VERSION} hyperledger/${image}:unstable
76+
77+
# Push both the version and unstable.
78+
docker push hyperledger/${image}:${VERSION}
79+
docker push hyperledger/${image}:unstable
80+
81+
done
82+
83+
else
84+
85+
# Build, tag, and publish Docker images.
86+
for image in ${DOCKER_IMAGES}; do
87+
88+
# Build the image and tag it with the version and latest.
89+
docker build --build-arg VERSION=${VERSION} -t hyperledger/${image}:${VERSION} ${DIR}/packages/${image}/docker
90+
docker tag hyperledger/${image}:${VERSION} hyperledger/${image}:latest
91+
92+
# Push both the version and latest.
93+
docker push hyperledger/${image}:${VERSION}
94+
docker push hyperledger/${image}:latest
95+
96+
done
97+
98+
# Configure the Git repository and clean any untracked and unignored build files.
99+
git config user.name "${GH_USER_NAME}"
100+
git config user.email "${GH_USER_EMAIL}"
101+
git checkout -b master
102+
git reset --hard
103+
git clean -d -f
104+
105+
# Bump the version number.
106+
npm run pkgbump
107+
export NEW_VERSION=$(node -e "console.log(require('${DIR}/package.json').version)")
108+
109+
# Add the version number changes and push them to Git.
110+
git add .
111+
git commit -m "Automatic version bump to ${NEW_VERSION}"
112+
git push origin master
113+
114+
fi
115+
date

.travis/fix_github_https_repo.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#/bin/bash
2+
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
3+
4+
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
5+
if [ -z "$REPO_URL" ]; then
6+
echo "-- ERROR: Could not identify Repo url."
7+
echo " It is possible this repo is already using SSH instead of HTTPS."
8+
exit
9+
fi
10+
11+
USER=`echo $REPO_URL | sed -Ene's#https://github.com/([^/]*)/(.*).git#\1#p'`
12+
if [ -z "$USER" ]; then
13+
echo "-- ERROR: Could not identify User."
14+
exit
15+
fi
16+
17+
REPO=`echo $REPO_URL | sed -Ene's#https://github.com/([^/]*)/(.*).git#\2#p'`
18+
if [ -z "$REPO" ]; then
19+
echo "-- ERROR: Could not identify Repo."
20+
exit
21+
fi
22+
23+
NEW_URL="[email protected]:$USER/$REPO.git"
24+
echo "Changing repo url from "
25+
echo " '$REPO_URL'"
26+
echo " to "
27+
echo " '$NEW_URL'"
28+
echo ""
29+
30+
CHANGE_CMD="git remote set-url origin $NEW_URL"
31+
`$CHANGE_CMD`
32+
33+
echo "Success"

.travis/script.sh

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44
set -ev
55
set -o pipefail
66

7+
export DOCKER_COMPOSE_VERSION=1.11.2
8+
sudo rm /usr/local/bin/docker-compose
9+
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
10+
chmod +x docker-compose
11+
sudo mv docker-compose /usr/local/bin
12+
echo "Docker-compose version: "
13+
docker-compose --version
14+
15+
# Update docker
16+
sudo apt-get update
17+
sudo apt-get remove docker docker-engine
18+
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
19+
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
20+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
21+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
22+
sudo apt-get update
23+
sudo apt-get install docker-ce
24+
echo "Docker version: "
25+
docker --version
26+
27+
728
# Grab the root (parent) directory.
829
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
930
ME=`basename "$0"`

info.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
'use strict'
33
var chalk = require('chalk');
4-
var shell = require('shelljs');
54
var fs = require('fs');
65
var path= require('path');
76
var pretty = require('prettyjson');

lerna.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"lerna": "2.0.0-beta.38",
2+
"lerna": "2.0.0-rc.4",
33
"packages": [
44
"packages/*"
55
],
6-
"version": "0.0.0"
6+
"version": "0.0.1"
77
}

package.json

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
{
2+
"version": "0.0.1",
3+
"private": true,
4+
"author": "Hyperledger Composer",
5+
"license": "Apache-2.0",
26
"scripts": {
3-
"postinstall": "npm run bootstrap",
4-
"bootstrap": "lerna bootstrap",
7+
"start": "node info",
8+
"postinstall": "npm run pkgcheck && npm run bootstrap",
9+
"bootstrap": "git submodule init && git submodule update && lerna bootstrap",
510
"test": "lerna run test",
6-
"start": "node info"
11+
"pkgcheck": "node ./scripts/pkgcheck.js",
12+
"pkgstamp": "node ./scripts/pkgstamp.js",
13+
"pkgbump": "node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix"
714
},
815
"dependencies": {
916
"chalk": "^1.1.3",
10-
"prettyjson": "^1.2.1",
11-
"shelljs": "^0.7.7"
17+
"prettyjson": "^1.2.1"
18+
},
19+
"devDependencies": {
20+
"lerna": "^2.0.0-rc.4"
1221
},
1322
"repository": {
1423
"type": "git",
1524
"url": "[email protected]:hyperledger/composer-sample-applications"
16-
},
17-
"author": "Hyperledger Composer",
18-
"license": "Apache-2.0",
19-
"devDependencies": {
20-
"lerna": "^2.0.0-rc.4"
2125
}
22-
}
26+
}

packages/digitalproperty-app/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "digitalproperty-app",
3-
"version": "1.0.0",
3+
"version": "0.0.1",
44
"config": {
55
"fabricversion": "hlfv1"
66
},
77
"description": "Hyperledger Composer - Digital Property console application",
8-
"bin" : {
9-
"digitalproperty" : "cli.js"
8+
"bin": {
9+
"digitalproperty": "cli.js"
1010
},
1111
"main": "cli.js",
1212
"scripts": {
@@ -19,7 +19,7 @@
1919
"submitTransaction:hlfv0.6": "NODE_ENV=hlfv0.6 node cli.js landregistry submit && NODE_ENV=hlfv0.6 node cli.js landregistry list",
2020
"listAssets:hlfv0.6": "NODE_ENV=hlfv0.6 node cli.js landregistry list",
2121
"bootstrapAssets:hlfv0.6": "NODE_ENV=hlfv0.6 node cli.js landregistry bootstrap",
22-
"deployNetwork": "composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network deploy -p hlfv1 --archiveFile digitalPropertyNetwork.bna --enrollId admin --enrollSecret adminpw && composer network list -n digitalproperty-network --enrollId admin --enrollSecret adminpw -p hlfv1",
22+
"deployNetwork": "composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network deploy -p hlfv1 --archiveFile digitalPropertyNetwork.bna --enrollId PeerAdmin --enrollSecret adminpw && composer network list -n digitalproperty-network --enrollId admin --enrollSecret adminpw -p hlfv1",
2323
"deployNetwork:hlfv0.6": "composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d",
2424
"updateNetwork": "composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network update -p hlfv1 --archiveFile digitalPropertyNetwork.bna --enrollId admin --enrollSecret adminpw && composer network list -n digitalproperty-network --enrollId admin --enrollSecret adminpw -p hlfv1"
2525
},
@@ -38,8 +38,8 @@
3838
"license": "Apache-2.0",
3939
"dependencies": {
4040
"cli-table": "^0.3.1",
41-
"composer-cli":"unstable",
42-
"composer-client":"unstable",
41+
"composer-cli": "unstable",
42+
"composer-client": "unstable",
4343
"config": "^1.24.0",
4444
"digitalproperty-network": "latest",
4545
"fabric-ca-client": "1.0.0-alpha.1",
@@ -55,12 +55,12 @@
5555
"chai": "^3.5.0",
5656
"chai-as-promised": "^6.0.0",
5757
"chai-things": "^0.2.0",
58-
"composer-connector-embedded":"unstable",
58+
"composer-connector-embedded": "unstable",
5959
"mocha": "^3.2.0",
6060
"sinon": "^1.17.6",
6161
"sinon-as-promised": "^4.0.2"
6262
},
6363
"pkg": {
64-
"scripts" : "lib/**/*.js"
64+
"scripts": "lib/**/*.js"
6565
}
6666
}

packages/getting-started/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getting-started",
3-
"version": "1.0.0",
3+
"version": "0.0.1",
44
"description": "The repository for the Hyperledger Composer Getting Started application - DEPRECATED",
55
"main": "index.js",
66
"scripts": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Specifies intentionally untracked files to ignore when using Git
2+
# http://git-scm.com/docs/gitignore
3+
4+
*~
5+
*.sw[mnpcod]
6+
*.log
7+
*.tmp
8+
*.tmp.*
9+
log.txt
10+
*.sublime-project
11+
*.sublime-workspace
12+
.vscode/
13+
npm-debug.log*
14+
15+
.idea/
16+
.sass-cache/
17+
.tmp/
18+
.versions/
19+
coverage/
20+
dist/
21+
node_modules/
22+
tmp/
23+
temp/
24+
hooks/
25+
platforms/
26+
plugins/
27+
plugins/android.json
28+
plugins/ios.json
29+
src/
30+
resources/
31+
# www/
32+
$RECYCLE.BIN/
33+
34+
.DS_Store
35+
Thumbs.db
36+
UserInterfaceState.xcuserstate
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
10+
# We recommend you to keep these unchanged
11+
end_of_line = lf
12+
charset = utf-8
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
[*.md]
17+
trim_trailing_whitespace = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:6-alpine
2+
ENV NPM_CONFIG_LOGLEVEL warn
3+
RUN mkdir -p /usr/src/app
4+
WORKDIR /usr/src/app
5+
COPY package.json /usr/src/app/
6+
RUN npm install --production && \
7+
npm cache clean
8+
COPY app.js /usr/src/app/
9+
COPY www /usr/src/app/www
10+
EXPOSE 6001
11+
CMD [ "npm", "start" ]

0 commit comments

Comments
 (0)