From 56a02d166212e347c67ede376578c836ef0cb9ac Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 7 Oct 2020 12:51:25 +0300 Subject: [PATCH 1/2] Fix and add remote messages logs --- .../src/business-layer/remoteConnectionBl.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/backend/src/business-layer/remoteConnectionBl.ts b/backend/src/business-layer/remoteConnectionBl.ts index 694425a8..27807d2b 100644 --- a/backend/src/business-layer/remoteConnectionBl.ts +++ b/backend/src/business-layer/remoteConnectionBl.ts @@ -78,6 +78,10 @@ export class RemoteConnectionBl { /** Subscribe to minions feed, to forward remote server */ this.minionsBl.minionFeed.subscribe((minionFeed: MinionFeed) => { + if (this.remoteConnectionStatus !== 'connectionOK') { + return; + } + const localMessage: LocalMessage = { localMessagesType: 'feed', message: { @@ -92,6 +96,10 @@ export class RemoteConnectionBl { /** Subscribe to timings feed, to forward remote server */ this.timingsBl.timingFeed.subscribe((timingFeed: TimingFeed) => { + if (this.remoteConnectionStatus !== 'connectionOK') { + return; + } + const localMessage: LocalMessage = { localMessagesType: 'feed', message: { @@ -302,10 +310,14 @@ export class RemoteConnectionBl { */ private sendMessage(localMessage: LocalMessage) { if (this.remoteConnectionStatus !== 'connectionOK' && this.remoteConnectionStatus !== 'cantReachRemoteServer') { + logger.debug(`[RemoteConnection.sendMessage] cant send message "${localMessage.localMessagesType}" to remote since remote status is "${this.remoteConnectionStatus}"`); return; } try { - logger.debug(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}"`); + // Don't log al ack messages... + if (localMessage.localMessagesType !== 'ack') { + logger.debug(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}"`); + } this.webSocketClient.sendData(JSON.stringify(localMessage)); } catch (error) { logger.error(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}" failed, ${error.message}`); @@ -373,7 +385,10 @@ export class RemoteConnectionBl { private async onRemoteServerMessage(rawRemoteMessage: string) { /** Parse message and send to correct method handle */ const remoteMessage: RemoteMessage = JSON.parse(rawRemoteMessage); - logger.debug(`[RemoteServerBl] message arrived "${remoteMessage.remoteMessagesType}"`); + // Don't log all ack messages... + if (remoteMessage.remoteMessagesType !== 'ackOk') { + logger.debug(`[RemoteServerBl] message arrived "${remoteMessage.remoteMessagesType}"`); + } switch (remoteMessage.remoteMessagesType) { case 'readyToInitialization': await this.onInitReady(); From 7c5f78614187b8cc7ba5f1b526bff8e691bd680c Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 7 Oct 2020 12:54:41 +0300 Subject: [PATCH 2/2] Build artifact and use it for the release --- .github/workflows/nodejs.yml | 58 ++++++++++++++++-------------------- README.md | 3 +- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 574765c0..3975fbd2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,4 +1,4 @@ -name: casanet server BE+FE CI +name: casanet server CI CD on: [push] @@ -8,23 +8,35 @@ jobs: strategy: matrix: node-version: [12.x] - if: github.ref != 'refs/heads/master' steps: - uses: actions/checkout@v1 - name: Install node uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: build backend - run: | - cd backend - npm ci - npm run build - - name: build frontend + - name: Bundle packages run: | + mkdir casanet_bin + mkdir .pkg-cache + cd .pkg-cache + export PKG_CACHE_PATH=$(pwd) + echo $PKG_CACHE_PATH + mkdir v2.6 + cd v2.6 + curl -L https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v12.2.0-linux-armv7 --output fetched-v12.18.1-linux-armv7 + chmod 777 fetched-v12.18.1-linux-armv7 + cd ../../ cd frontend npm ci - npm run build:internal + cd ../ + cd backend + npm ci + npm run bundle + cp -v bundle/* ../casanet_bin + - uses: actions/upload-artifact@v2 + with: + name: casanet_bin + path: casanet_bin tests: runs-on: ubuntu-latest @@ -44,7 +56,8 @@ jobs: npm ci npm run test - bundle: + bundle: + needs: build runs-on: ubuntu-latest strategy: matrix: @@ -52,29 +65,10 @@ jobs: if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v1 - - name: Install node - uses: actions/setup-node@v1 + - uses: actions/download-artifact@master with: - node-version: ${{ matrix.node-version }} - - name: Bundle packages - run: | - mkdir casanet_bin - mkdir .pkg-cache - cd .pkg-cache - export PKG_CACHE_PATH=$(pwd) - echo $PKG_CACHE_PATH - mkdir v2.6 - cd v2.6 - curl -L https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v12.2.0-linux-armv7 --output fetched-v12.18.1-linux-armv7 - chmod 777 fetched-v12.18.1-linux-armv7 - cd ../../ - cd frontend - npm ci - cd ../ - cd backend - npm ci - npm run bundle - cp -v bundle/* ../casanet_bin + name: casanet_bin + path: casanet_bin - name: Get the version id: get_version run: | diff --git a/README.md b/README.md index be3651e2..71360d61 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ Let's create a smart home, without giving anyone access to our house 😊. ## CASA-NET. Open-source server to control IoT devices in a local home network. - +[![CI CD Status](https://github.com/casanet/casanet-server/workflows/casanet%20server%20CI%20CD/badge.svg?branch=master)](https://github.com/casanet/casanet-server/actions) [![Build Status](https://travis-ci.org/casanet/casanet-server.svg?branch=master)](https://travis-ci.org/casanet/casanet-server) [![Coverage Status](https://coveralls.io/repos/github/casanet/casanet-server/badge.svg?branch=master)](https://coveralls.io/github/casanet/casanet-server?branch=master) +The latest release binaries available to download from [casanet-server releases](https://github.com/casanet/casanet-server/releases) ## Philosophy. In this project, I wanted to solve a number of troubles. first of all, anyone who uses a number of smart devices (smart IR, smart socket, or anything of that kind) of different companies is familiar with the problem of dealing with a number of different applications;