From 507e91a66f4574193a94a81e862a14c67ee46fe6 Mon Sep 17 00:00:00 2001 From: zyevegor Date: Tue, 21 Nov 2017 14:59:26 +0300 Subject: [PATCH 1/2] https://chronobank.atlassian.net/browse/MD-65 - Middleware (ETH) - bugs and features --- .dockerignore | 1 + .travis.yml | 15 +++++++++++++++ Dockerfile | 19 +++++++++++++++++++ gcregistry.json | 12 ++++++++++++ package.json | 4 ++-- 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 gcregistry.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 41457e4..ec4144e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,21 @@ after_script: - pm2 logs --nostream - pm2 kill && pkill PM2 +after_success: + - FULL_GCR_KEY="-----BEGIN PRIVATE KEY-----\n"$GCR_KEY"\n-----END PRIVATE KEY-----\n" + - sed -i -e "s%\PWD%$FULL_GCR_KEY%g" gcregistry.json + - docker login -u _json_key -p "$(cat gcregistry.json)" https://gcr.io + - rm -rf gcregistry.json + - | + if [ "$TRAVIS_TAG" == "" ]; then + IMAGE_TAG_NAME="latest" + elif [ "$TRAVIS_TAG" != "" ]; then + IMAGE_TAG_NAME="develop" + fi; + - docker build --quiet -t gcr.io/deep-wares-144610/middleware-eth:$IMAGE_TAG_NAME . + - docker push gcr.io/deep-wares-144610/middleware-eth:$IMAGE_TAG_NAME + + notifications: email: false diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32d400e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:8-slim +ENV NETWORK_TYPE DEFAULT_NETWORK_TYPE +ENV NPM_CONFIG_LOGLEVEL warn +RUN apt update && \ + apt install -y python make g++ git build-essential && \ + npm install -g pm2@2.7.1 && \ + mkdir /app +WORKDIR /app +RUN git clone https://github.com/ChronoBank/Middleware.git src +RUN cd src && \ + npm -g install --unsafe-perm=true && \ + node . middleware-eth-blockprocessor && \ + node . middleware-eth-rest && \ + node . middleware-eth-chrono-sc-processor && \ + node . middleware-eth-balance-processor && \ + node . middleware-eth-ipfs && \ + node . middleware-eth-erc20 +EXPOSE 8080 +CMD pm2-docker start /mnt/config/${NETWORK_TYPE}/ecosystem.config.js \ No newline at end of file diff --git a/gcregistry.json b/gcregistry.json new file mode 100644 index 0000000..93ce44a --- /dev/null +++ b/gcregistry.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "deep-wares-144610", + "private_key_id": "38f307c2c65b4e266864eac58f29f846a01841ef", + "client_email": "gcregistry@deep-wares-144610.iam.gserviceaccount.com", + "client_id": "100093443474996797417", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://accounts.google.com/o/oauth2/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gcregistry%40deep-wares-144610.iam.gserviceaccount.com", + "private_key": "PWD" +} diff --git a/package.json b/package.json index 210bae7..11afe09 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,10 @@ "description": "", "devDependencies": { "babel-eslint": "^8.0.0", + "chai": "^4.1.1", "eslint": "^4.6.1", "eslint-plugin-chronobank": "github:chronobank/eslint-plugin-chronobank", - "chai": "^4.1.1", - "ethereumjs-testrpc": "mikefluff/testrpc", + "ethereumjs-testrpc": "^6.0.3", "mocha": "^3.5.0", "sockjs-client": "^1.1.4", "webstomp-client": "^1.0.6" From f47ed18d6185cb232b7963cac1e812a8fe26ae5c Mon Sep 17 00:00:00 2001 From: zyevegor Date: Tue, 21 Nov 2017 15:44:32 +0300 Subject: [PATCH 2/2] https://chronobank.atlassian.net/browse/MD-70 - Middleware (ETH) - custom sc handle flow --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec4144e..1538af5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,8 +41,8 @@ after_success: elif [ "$TRAVIS_TAG" != "" ]; then IMAGE_TAG_NAME="develop" fi; - - docker build --quiet -t gcr.io/deep-wares-144610/middleware-eth:$IMAGE_TAG_NAME . - - docker push gcr.io/deep-wares-144610/middleware-eth:$IMAGE_TAG_NAME + - docker build --quiet -t gcr.io/deep-wares-144610/middleware-ethereum:$IMAGE_TAG_NAME . + - docker push gcr.io/deep-wares-144610/middleware-ethereum:$IMAGE_TAG_NAME notifications: