Skip to content

Commit

Permalink
Merge pull request #110 from smartdevicelink/develop
Browse files Browse the repository at this point in the history
Release 2.6.0
  • Loading branch information
crokita authored May 28, 2020
2 parents 26c6b25 + c30fb56 commit a326f0c
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017 - 2018 SmartDeviceLink Consortium, Inc.
Copyright (c) 2017 - 2020 SmartDeviceLink Consortium, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
50 changes: 45 additions & 5 deletions api/v2/app/interfaces/job/manticore/core-image-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ function generateJobFile (jobName, body) {
//resource settings depending on the core build type
const resourceSettings = {
default: { //default build resource requirements
cpu: 100,
memory: 200,
cpu: 120,
memory: 250,
mbits: 2,
disk: 500,
disk: 1000,
logFiles: 2,
logSize: 20
}
Expand All @@ -83,7 +83,10 @@ function configurationToImageInfo (coreVersion, coreBuild, id) {
tcp: 12345,
file: 3001,
log: 8888,
policy: 9898
policy: 9898,
wsServer: 2020,
store: 3000,
python: 8081
},
services: [
{
Expand Down Expand Up @@ -138,7 +141,44 @@ function configurationToImageInfo (coreVersion, coreBuild, id) {
Protocol: "http"
}
]
}
},
{
name: `core-ws-server-${id}`,
port: "wsServer",
checks: [
{
Type: "tcp",
Interval: 3000000000, //3 seconds
Timeout: 1000000000, //1 second
Protocol: "ws"
}
]
},
{
name: `core-store-${id}`,
port: "store",
checks: [
{
Type: "http",
Interval: 3000000000, //3 seconds
Timeout: 1000000000, //1 second
Path: "/",
Protocol: "http"
}
]
},
{
name: `core-python-${id}`,
port: "python",
checks: [
{
Type: "tcp",
Interval: 3000000000, //3 seconds
Timeout: 1000000000, //1 second
Protocol: "ws"
}
]
},
],
envs: {},
resources: resourceSettings[coreBuild]
Expand Down
3 changes: 2 additions & 1 deletion api/v2/app/interfaces/job/manticore/hmi-image-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ function configurationToImageInfo (version, type, id, envs) {
Protocol: "http"
}
]
},
}
],
envs: {
BROKER_ADDR: envs.brokerAddress,
CORE_FILE_ADDR: envs.coreFileAddress,
PYTHON_ADDRESS: envs.pythonAddress,
},
resources: resourceSettings[type]
}
Expand Down
30 changes: 25 additions & 5 deletions api/v2/app/interfaces/job/manticore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ const CORE_HEALTH_TIME = 8000;
const HMI_ALLOCATION_TIME = 5000;
const HMI_HEALTH_TIME = 8000;


const jobInfo = {
core: {
versions: ["6.0.1"], //ex. 5.0.1, master, develop
versions: ["6.1.1"], //ex. 5.0.1, master, develop
builds: ["default"]
},
hmis: [{
type: "generic",
versions: ["minimal-0.7.2"] //ex. master, minimal-0.5.1
versions: ["minimal-0.8.1"] //ex. master, minimal-0.5.1
}]
};

Expand Down Expand Up @@ -156,6 +155,16 @@ async function advance (ctx) {
currentRequest.services.manticore[`core-tcp-${id}-0`].external = coreTcpPort;
currentRequest.services.manticore[`core-tcp-${id}-0`].isHttp = false;

// shorten this URL to make it easier to type
currentRequest.services.manticore[`core-ws-server-${id}-0`].external = randomString(PATTERN, 6);
currentRequest.services.manticore[`core-ws-server-${id}-0`].isHttp = true;

currentRequest.services.manticore[`core-store-${id}-0`].external = randomString(PATTERN, 16);
currentRequest.services.manticore[`core-store-${id}-0`].isHttp = true;

currentRequest.services.manticore[`core-python-${id}-0`].external = randomString(PATTERN, 16);
currentRequest.services.manticore[`core-python-${id}-0`].isHttp = true;

currentRequest.state = "pending-2";
ctx.updateStore = true;
ctx.removeUser = false;
Expand All @@ -167,30 +176,38 @@ async function advance (ctx) {
if (currentRequest.state === "pending-2") { //this stage causes an hmi job to run
const brokerAddress = currentRequest.services.manticore[`core-broker-${id}-0`].internal;
const coreFileAddress = currentRequest.services.manticore[`core-file-${id}-0`].internal;
const pythonAddress = currentRequest.services.manticore[`core-python-${id}-0`].internal;

let fullBrokerAddress = `ws:\\/\\/${brokerAddress}`; //internal address
let fullPythonAddress = `ws:\\/\\/${pythonAddress}`; //internal address

//if haproxy is configured, generate the external addresses
if (config.modes.haproxy) {
//domain addresses
const externalBrokerAddress = currentRequest.services.manticore[`core-broker-${id}-0`].external;
const externalPythonAddress = currentRequest.services.manticore[`core-python-${id}-0`].external;
const brokerDomainAddress = `${externalBrokerAddress}.${config.haproxyDomain}`;
const pythonDomainAddress = `${externalPythonAddress}.${config.haproxyDomain}`;

//external address (HAProxy)
fullBrokerAddress = `ws:\\/\\/${brokerDomainAddress}:${config.haproxyPort}`;
fullPythonAddress = `ws:\\/\\/${pythonDomainAddress}:${config.haproxyPort}`;

if (config.modes.elb) { //external address (ELB)
fullBrokerAddress = `ws:\\/\\/${brokerDomainAddress}:${config.wsPort}`;
fullPythonAddress = `ws:\\/\\/${pythonDomainAddress}:${config.wsPort}`;
}

if (config.modes.elbEncryptWs) { //secure external address (ELB)
fullBrokerAddress = `wss:\\/\\/${brokerDomainAddress}:${config.wsPort}`;
fullPythonAddress = `wss:\\/\\/${pythonDomainAddress}:${config.wsPort}`;
}
}

const envs = { //extract service addresses found from the previous stage
brokerAddress: fullBrokerAddress,
coreFileAddress: coreFileAddress,
pythonAddress: fullPythonAddress,
};

let job = coreSettings.generateJobFile(jobName, currentRequest);
Expand Down Expand Up @@ -285,6 +302,9 @@ function formatAddresses (id, services) {
"core-file": utils.formatHttpAddress(services.manticore[`core-file-${id}-0`]),
"core-log": utils.formatWsAddress(services.manticore[`core-log-${id}-0`]),
"core-policy": utils.formatHttpAddress(services.manticore[`core-policy-${id}-0`]),
"core-ws-server": utils.formatWsAddress(services.manticore[`core-ws-server-${id}-0`]),
"core-store": utils.formatHttpAddress(services.manticore[`core-store-${id}-0`]),
"core-python": utils.formatWsAddress(services.manticore[`core-python-${id}-0`]),
"hmi-user": utils.formatHttpAddress(services.manticore[`hmi-user-${id}-0`]),
};
}
Expand All @@ -293,12 +313,12 @@ function formatAddresses (id, services) {
function exampleJobOption () {
return {
core: {
version: "6.0.1",
version: "6.1.1",
build: "default"
},
hmi: {
type: "generic",
version: "minimal-0.7.2"
version: "minimal-0.8.1"
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manticore",
"version": "2.5.0",
"version": "2.6.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a326f0c

Please sign in to comment.