Skip to content

Commit 09ff5f0

Browse files
authored
version release 1.0.25 (#408)
* Update .gitignore * Delete package-lock.json * remove unused environment * EWC-369 correct controller version in cli (#394) * Saeid's unit tests sample (#399) * unit tests kick off * instanbul coverage * isTest() in decorators (#398) * EWC-362 closing routes before deleting microservice (#395) * EWC-371 validation of microservice uuid on update (#396) * EWC-372 port mapping cli fix (#397) * installation scripts fix (#400) * `whereis iofog-controller` -> `npm root -g iofog-controller` * EWC-378 fixed validation for email settings in config CLI (#401) * whereis -> npm root (#402) * EWC-373 microservice cli error message for volume mapping fix * EWC-361 logger not found in microservice service fix * EWC-361 abbility to delete route without closing ports on connector * EWC-361 recreating routes on update microservice only if necessary * EWC-384 connector devMode verification before using certificate * EWC-377 cli config add ssl-key message fix * EWC-386 cli connector add devMode is required now * EWC-387 hiding SQL queries output for dev environment (#405) * EWC-379 cross-platform npm scripts (#407) * EWC-379 cross-platform npm scripts * EWC-379 windows path fix
1 parent c7dbbb3 commit 09ff5f0

34 files changed

+1270
-240
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.vscode
33
*.sqlite
4+
.nyc_output
45
package-lock.json

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ stages:
1919
- name: dev_deploy
2020
if: branch = develop AND type = push
2121
- name: package_build
22-
if: (branch = develop AND type = cron) OR (branch = master and type = push)
22+
if: branch = master and type = push
2323

2424
jobs:
2525
include:
@@ -48,7 +48,5 @@ jobs:
4848
on:
4949
tags: false
5050
after_deploy:
51-
- if [ "$TRAVIS_BRANCH" == "develop" ]; then sshpass -p $PRE_PROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no
52-
$PRE_PROD_MACHINE_USERNAME@$PRE_PROD_MACHINE_IP "iofog-controller stop; npm update -g --unsafe-perm iofogcontroller; iofog-controller start";
53-
else sshpass -p $PROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no
54-
$PROD_MACHINE_USERNAME@$PROD_MACHINE_IP "iofog-controller stop; npm update -g --unsafe-perm iofogcontroller; iofog-controller start"; fi
51+
- sshpass -p $PROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no
52+
$PROD_MACHINE_USERNAME@$PROD_MACHINE_IP "iofog-controller stop; npm update -g --unsafe-perm iofogcontroller; iofog-controller start"

package.json

Lines changed: 94 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,96 @@
11
{
2-
"name": "iofogcontroller",
3-
"version": "1.0.24",
4-
"description": "ioFog Controller project for Eclipse IoFog @ iofog.org \\nCopyright (c) 2018 Edgeworx, Inc.",
5-
"main": "./src/main.js",
6-
"author": "Saeid Baghbidi",
7-
"contributors": [
8-
"Kilton Hopkins <[email protected]>",
9-
"Saeid Baghbidi",
10-
"Pavel Kazlou",
11-
"Egor Krylovich",
12-
"Iryna Laryionava",
13-
"Maryna Lipnitskaya",
14-
"Dmitriy Kudasov",
15-
"Dmitry Stolbunov",
16-
"Darya Busel",
17-
"Alexander Shpak",
18-
"Kate Lukashick",
19-
"Eugene Pankov",
20-
"Maksim Chepelev",
21-
"Tetiana Yatsiuk",
22-
"Sergey Valevich"
23-
],
24-
"license": {
25-
"type": "EPL-2.0",
26-
"url": "https://www.eclipse.org/legal/epl-v20.html"
27-
},
28-
"bugs": {
29-
"email": "[email protected]"
30-
},
31-
"homepage": "https://www.iofog.org",
32-
"repository": {
33-
"type": "git",
34-
"url": "https://github.com/ioFog/Controller"
35-
},
36-
"scripts": {
37-
"start": "NODE_ENV=production node ./src/main.js start",
38-
"start-dev": "NODE_ENV=development node ./src/main.js start",
39-
"build": "export NODE_ENV=production && cd src/sequelize && ../../node_modules/.bin/sequelize db:migrate && ../../node_modules/.bin/sequelize db:seed:all",
40-
"preuninstall": "bash scripts/preuninstall.sh",
41-
"postinstall": "bash scripts/postinstall.sh && NODE_ENV=production node ./src/main.js init",
42-
"lint": "./node_modules/.bin/eslint \"**/*.js\"",
43-
"automatic-release": "automatic-release",
44-
"test": ""
45-
},
46-
"preferGlobal": true,
47-
"bin": {
48-
"iofog-controller": "src/main.js"
49-
},
50-
"dependencies": {
51-
"body-parser": "^1.18.3",
52-
"command-line-args": "^5.0.2",
53-
"command-line-usage": "^5.0.5",
54-
"continuation-local-storage": "^3.2.1",
55-
"cookie-parser": "^1.4.3",
56-
"daemonize2": "^0.4.2",
57-
"ejs": "^2.6.1",
58-
"express": "^4.16.3",
59-
"formidable": "^1.2.1",
60-
"fs": "^0.0.1-security",
61-
"ftp": "^0.3.10",
62-
"helmet": "^3.13.0",
63-
"jsonschema": "^1.2.4",
64-
"morgan": "^1.9.1",
65-
"nconf": "^0.10.0",
66-
"nodemailer": "^4.6.8",
67-
"nodemailer-smtp-transport": "^2.7.4",
68-
"path": "^0.12.7",
69-
"portscanner": "^2.2.0",
70-
"retry-as-promised": "^3.1.0",
71-
"sequelize": "^4.39.0",
72-
"sequelize-cli": "^4.1.1",
73-
"sqlite3": "^4.0.2",
74-
"string-format": "^2.0.0",
75-
"umzug": "^2.1.0",
76-
"underscore": "^1.9.1",
77-
"winston": "^3.1.0",
78-
"xss-clean": "^0.1.1",
79-
"qs": "^6.5.2"
80-
},
81-
"devDependencies": {
82-
"automatic-release": "^1.1.1",
83-
"eslint": "^5.6.1"
84-
}
2+
"name": "iofogcontroller",
3+
"version": "1.0.24",
4+
"description": "ioFog Controller project for Eclipse IoFog @ iofog.org \\nCopyright (c) 2018 Edgeworx, Inc.",
5+
"main": "./src/main.js",
6+
"author": "Saeid Baghbidi",
7+
"contributors": [
8+
"Kilton Hopkins <[email protected]>",
9+
"Saeid Baghbidi",
10+
"Pavel Kazlou",
11+
"Egor Krylovich",
12+
"Iryna Laryionava",
13+
"Maryna Lipnitskaya",
14+
"Dmitriy Kudasov",
15+
"Dmitry Stolbunov",
16+
"Darya Busel",
17+
"Alexander Shpak",
18+
"Kate Lukashick",
19+
"Eugene Pankov",
20+
"Maksim Chepelev",
21+
"Tetiana Yatsiuk",
22+
"Sergey Valevich"
23+
],
24+
"license": {
25+
"type": "EPL-2.0",
26+
"url": "https://www.eclipse.org/legal/epl-v20.html"
27+
},
28+
"bugs": {
29+
"email": "[email protected]"
30+
},
31+
"homepage": "https://www.iofog.org",
32+
"repository": {
33+
"type": "git",
34+
"url": "https://github.com/ioFog/Controller"
35+
},
36+
"scripts": {
37+
"start": "node scripts/start.js",
38+
"start-dev": "node scripts/start-dev.js",
39+
"build": "node scripts/init.js",
40+
"preuninstall": "node scripts/preuninstall.js",
41+
"postinstall": "node scripts/postinstall.js",
42+
"lint": "./node_modules/.bin/eslint \"**/*.js\"",
43+
"automatic-release": "automatic-release",
44+
"test": "node scripts/test.js",
45+
"coverage": "node scripts/coverage.js"
46+
},
47+
"preferGlobal": true,
48+
"bin": {
49+
"iofog-controller": "src/main.js"
50+
},
51+
"dependencies": {
52+
"body-parser": "^1.18.3",
53+
"command-line-args": "^5.0.2",
54+
"command-line-usage": "^5.0.5",
55+
"continuation-local-storage": "^3.2.1",
56+
"cookie-parser": "^1.4.3",
57+
"daemonize2": "^0.4.2",
58+
"ejs": "^2.6.1",
59+
"express": "^4.16.3",
60+
"formidable": "^1.2.1",
61+
"fs": "^0.0.1-security",
62+
"ftp": "^0.3.10",
63+
"helmet": "^3.13.0",
64+
"jsonschema": "^1.2.4",
65+
"morgan": "^1.9.1",
66+
"nconf": "^0.10.0",
67+
"nodemailer": "^4.6.8",
68+
"nodemailer-smtp-transport": "^2.7.4",
69+
"path": "^0.12.7",
70+
"portscanner": "^2.2.0",
71+
"retry-as-promised": "^3.1.0",
72+
"sequelize": "^4.39.0",
73+
"sequelize-cli": "^4.1.1",
74+
"sqlite3": "^4.0.2",
75+
"string-format": "^2.0.0",
76+
"umzug": "^2.1.0",
77+
"underscore": "^1.9.1",
78+
"winston": "^3.1.0",
79+
"xss-clean": "^0.1.1",
80+
"qs": "^6.5.2",
81+
"child_process": "^1.0.2",
82+
"os": "^0.1.1"
83+
},
84+
"devDependencies": {
85+
"automatic-release": "^1.1.1",
86+
"bdd-lazy-var": "^2.5.0",
87+
"chai": "^4.2.0",
88+
"chai-as-promised": "^7.1.1",
89+
"chai-http": "^4.2.0",
90+
"eslint": "^5.6.1",
91+
"mocha": "^5.2.0",
92+
"nyc": "^13.1.0",
93+
"sinon": "^7.1.1",
94+
"sinon-chai": "^3.2.0"
95+
}
8596
}

scripts/coverage.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* *******************************************************************************
3+
* * Copyright (c) 2018 Edgeworx, Inc.
4+
* *
5+
* * This program and the accompanying materials are made available under the
6+
* * terms of the Eclipse Public License v. 2.0 which is available at
7+
* * http://www.eclipse.org/legal/epl-2.0
8+
* *
9+
* * SPDX-License-Identifier: EPL-2.0
10+
* *******************************************************************************
11+
*
12+
*/
13+
14+
const execSync = require('child_process').execSync;
15+
16+
const options = {
17+
env: {
18+
'NODE_ENV': 'test',
19+
"PATH": process.env.PATH
20+
},
21+
stdio: [process.stdin, process.stdout, process.stderr]
22+
};
23+
24+
execSync('nyc mocha', options);

scripts/init.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* *******************************************************************************
3+
* * Copyright (c) 2018 Edgeworx, Inc.
4+
* *
5+
* * This program and the accompanying materials are made available under the
6+
* * terms of the Eclipse Public License v. 2.0 which is available at
7+
* * http://www.eclipse.org/legal/epl-2.0
8+
* *
9+
* * SPDX-License-Identifier: EPL-2.0
10+
* *******************************************************************************
11+
*
12+
*/
13+
14+
const execSync = require('child_process').execSync;
15+
16+
const options = {
17+
env: {
18+
'NODE_ENV': 'production',
19+
"PATH": process.env.PATH
20+
},
21+
stdio: [process.stdin, process.stdout, process.stderr]
22+
};
23+
24+
execSync('node ./src/main.js init', options);

scripts/postinstall.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* *******************************************************************************
3+
* * Copyright (c) 2018 Edgeworx, Inc.
4+
* *
5+
* * This program and the accompanying materials are made available under the
6+
* * terms of the Eclipse Public License v. 2.0 which is available at
7+
* * http://www.eclipse.org/legal/epl-2.0
8+
* *
9+
* * SPDX-License-Identifier: EPL-2.0
10+
* *******************************************************************************
11+
*
12+
*/
13+
14+
15+
const os = require('os');
16+
const execSync = require('child_process').execSync;
17+
const fs = require('fs');
18+
19+
const rootDir = `${__dirname}/../`;
20+
let installation_variables_file_name = 'iofogcontroller_install_variables';
21+
let installation_variables_file;
22+
let tempDir;
23+
24+
if (os.type() === 'Linux') {
25+
tempDir = '/tmp/';
26+
} else if (os.type() === 'Darwin') {
27+
tempDir = '/tmp/';
28+
} else if (os.type() === 'Windows_NT') {
29+
tempDir = `${process.env.APPDATA}/`;
30+
} else {
31+
throw new Error("Unsupported OS found: " + os.type());
32+
}
33+
34+
installation_variables_file = tempDir + installation_variables_file_name;
35+
36+
37+
const devDbBackup = `${tempDir}dev_database.sqlite`;
38+
if (fs.existsSync(devDbBackup)) {
39+
fs.renameSync(devDbBackup, `${rootDir}/src/sequelize/dev_database.sqlite`)
40+
}
41+
42+
const prodDbBackup = `${tempDir}prod_database.sqlite`;
43+
if (fs.existsSync(prodDbBackup)) {
44+
fs.renameSync(prodDbBackup, `${rootDir}/src/sequelize/prod_database.sqlite`)
45+
}
46+
47+
//TODO: add version migrations

scripts/postinstall.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
##TODO: remove after js scripts finished
4+
35
vercomp () {
46
if [[ $1 == $2 ]]
57
then
@@ -37,9 +39,8 @@ vercomp () {
3739

3840
#START
3941
#restore db
40-
IOFOG_CONTROLLER_BIN_DIR=$(whereis iofog-controller | awk -F " " '{print $2}')
41-
IOFOG_CONTROLLER_BIN_DIR=${IOFOG_CONTROLLER_BIN_DIR%"iofog-controller"}
42-
IOFOG_CONTROLLER_SEQUELIZE_DIR=$IOFOG_CONTROLLER_BIN_DIR'../lib/node_modules/iofogcontroller/src/sequelize'
42+
IOFOG_CONTROLLER_NODE_MODULES=$(npm root -g iofog-controller)
43+
IOFOG_CONTROLLER_SEQUELIZE_DIR=$IOFOG_CONTROLLER_NODE_MODULES'/iofogcontroller/src/sequelize'
4344

4445
DEV_DB_FILE=$IOFOG_CONTROLLER_SEQUELIZE_DIR'/dev_database.sqlite'
4546
DEV_DB_FILE_BACKUP='/tmp/dev_database.sqlite'
@@ -54,16 +55,18 @@ if [ -f $PROD_DB_FILE_BACKUP ]; then
5455
fi
5556

5657
#prev versions migrations
57-
PREV_IOFOG_CONTROLLER_VER=$(grep prev_ver /tmp/iofogcontroller_install_variables | awk '{print $2}')
58-
echo "Prev ver: "${PREV_IOFOG_CONTROLLER_VER}
58+
if [ -f /tmp/iofogcontroller_install_variables ]; then
59+
PREV_IOFOG_CONTROLLER_VER=$(grep prev_ver /tmp/iofogcontroller_install_variables | awk '{print $2}')
60+
fi
5961

6062
if [[ -z "${PREV_IOFOG_CONTROLLER_VER// }" ]]
6163
then
62-
echo "No prev ver"
64+
echo "No previous version"
6365
else
66+
echo "Previous version: "${PREV_IOFOG_CONTROLLER_VER}
6467
if [[ $(vercomp $PREV_IOFOG_CONTROLLER_VER 1.0.0) = '<' ]] || [[ $(vercomp $PREV_IOFOG_CONTROLLER_VER 1.0.0) = '=' ]]
6568
then
66-
echo "Upgrading from ver 1.0.0"
69+
echo "Upgrading from version 1.0.0"
6770
sqlite3 src/sequelize/prod_database.sqlite "insert into SequelizeMeta (name) values ('20180928110125-insert-registry.js');"
6871
sqlite3 src/sequelize/prod_database.sqlite "insert into SequelizeMeta (name) values ('20180928111532-insert-catalog-item.js');"
6972
sqlite3 src/sequelize/prod_database.sqlite "insert into SequelizeMeta (name) values ('20180928112152-insert-iofog-type.js');"

scripts/preinstall.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)