@routr/one 2.0.10 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/envs.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export declare const BIND_ADDR: string;
2
+ export declare const PROCESSOR_ADDR: string;
2
3
  export declare const EDGEPORT_RUNNER: string;
3
4
  export declare const RTPENGINE_HOST: string;
4
5
  export declare const RTPENGINE_PORT: number;
6
+ export declare const DOCKER: string | boolean;
package/dist/envs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- var _a, _b;
2
+ var _a, _b, _c, _d;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RTPENGINE_PORT = exports.RTPENGINE_HOST = exports.EDGEPORT_RUNNER = exports.BIND_ADDR = void 0;
4
+ exports.DOCKER = exports.RTPENGINE_PORT = exports.RTPENGINE_HOST = exports.EDGEPORT_RUNNER = exports.PROCESSOR_ADDR = exports.BIND_ADDR = void 0;
5
5
  /*
6
6
  * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
7
7
  * http://github.com/fonoster
@@ -23,8 +23,10 @@ exports.RTPENGINE_PORT = exports.RTPENGINE_HOST = exports.EDGEPORT_RUNNER = expo
23
23
  const common_1 = require("@routr/common");
24
24
  common_1.Assertions.assertEnvsAreSet(["RTPENGINE_HOST", "DATABASE_URL"]);
25
25
  exports.BIND_ADDR = (_a = process.env.BIND_ADDR) !== null && _a !== void 0 ? _a : "0.0.0.0:51904";
26
- exports.EDGEPORT_RUNNER = (_b = process.env.EDGEPORT_RUNNER) !== null && _b !== void 0 ? _b : "/opt/routr/edgeport.sh";
26
+ exports.PROCESSOR_ADDR = (_b = process.env.PROCESSOR_ADDR) !== null && _b !== void 0 ? _b : "localhost:51901";
27
+ exports.EDGEPORT_RUNNER = (_c = process.env.EDGEPORT_RUNNER) !== null && _c !== void 0 ? _c : "/opt/routr/edgeport.sh";
27
28
  exports.RTPENGINE_HOST = process.env.RTPENGINE_HOST;
28
29
  exports.RTPENGINE_PORT = process.env.RTPENGINE_PORT
29
30
  ? parseInt(process.env.RTPENGINE_PORT)
30
31
  : 2223;
32
+ exports.DOCKER = (_d = process.env.DOCKER) !== null && _d !== void 0 ? _d : false;
package/dist/runner.js CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
4
7
  /*
5
8
  * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
@@ -28,13 +31,33 @@ const pgdata_1 = require("@routr/pgdata");
28
31
  const rtprelay_1 = require("@routr/rtprelay");
29
32
  const envs_1 = require("./envs");
30
33
  const configs_1 = require("./configs");
34
+ const fs_1 = __importDefault(require("fs"));
31
35
  const logger = (0, logger_1.getLogger)({ service: "one", filePath: __filename });
32
36
  logger.info("routr v2 // one distribution");
37
+ const PATH_TO_CERTS = "/etc/routr/domains-cert.jks";
38
+ if (envs_1.DOCKER && !fs_1.default.existsSync(PATH_TO_CERTS)) {
39
+ logger.info("creating a set of self-signed certs for edgeport", {
40
+ path: PATH_TO_CERTS
41
+ });
42
+ (0, child_process_1.execSync)("sh /service/generate_certs.sh /dev/null 2>&1");
43
+ (0, child_process_1.execSync)("mv domains-cert.jks /etc/routr/");
44
+ }
33
45
  (0, dispatcher_1.messageDispatcher)(configs_1.dispatcherConfig);
34
46
  (0, connect_1.connectProcessor)(configs_1.connectConfig);
35
47
  (0, location_1.locationService)(configs_1.locationConfig);
36
48
  (0, pgdata_1.pgDataService)(configs_1.apiServerConfig);
37
49
  (0, rtprelay_1.rtprelay)("0.0.0.0:51903", configs_1.rtprelayConfig);
38
- (0, child_process_1.spawn)(envs_1.EDGEPORT_RUNNER).stdout.on("data", (data) => {
50
+ const edgeportProcess = (0, child_process_1.spawn)(envs_1.EDGEPORT_RUNNER);
51
+ edgeportProcess.stdout.on("data", (data) => {
39
52
  process.stdout.write(`${data}`);
40
53
  });
54
+ edgeportProcess.on("error", (err) => {
55
+ logger.error(`failed to spawn edgeport process: ${err}`);
56
+ process.exit(1);
57
+ });
58
+ edgeportProcess.on("exit", (code) => {
59
+ if (code !== 0) {
60
+ logger.error(`edgeport process exited with code ${code}`);
61
+ process.exit(code);
62
+ }
63
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/one",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "Bundle server with everything needed to run Routr Connect",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@fonoster/logger": "0.3.20",
23
+ "@routr/common": "^2.0.9",
23
24
  "@routr/connect": "^2.0.10",
24
25
  "@routr/dispatcher": "^2.0.10",
25
26
  "@routr/location": "^2.0.10",
@@ -39,5 +40,5 @@
39
40
  "bugs": {
40
41
  "url": "https://github.com/fonoster/routr/issues"
41
42
  },
42
- "gitHead": "2886cad085d6beecea03b33b0b4241e9ea00f38e"
43
+ "gitHead": "b49772ebb2b016d83ab65fc063d8fb4be004b722"
43
44
  }