fix(core.gbapp): Self-replication on Azure

This commit is contained in:
Rodrigo Rodriguez 2019-05-27 08:46:17 -03:00
parent 3cca5044ee
commit bf602c6b7d
7 changed files with 24 additions and 29 deletions

14
.vscode/launch.json vendored
View file

@ -5,14 +5,20 @@
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"name": "Debug Program", "name": "Debug Program",
"program": "${workspaceRoot}/dist/src/app.js", "program": "${workspaceRoot}/boot.js",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"env": { "env": {
"NODE_ENV": "development" "NODE_ENV": "development"
}, },
"args":["--no-deprecation"], "args": [
"skipFiles": ["node_modules/**/*.js"], "--no-deprecation"
"outFiles": ["${workspaceRoot}/dist/*.js"], ],
"skipFiles": [
"node_modules/**/*.js"
],
"outFiles": [
"${workspaceRoot}/dist/*.js"
],
"stopOnEntry": false, "stopOnEntry": false,
"console": "integratedTerminal" "console": "integratedTerminal"
} }

4
boot.js Normal file
View file

@ -0,0 +1,4 @@
#! /usr/bin / env node
const GBServer = require("./dist/src/app").GBServer
process.env.PWD = __dirname;
GBServer.run();

View file

@ -12,4 +12,4 @@ ECHO Compiling...
CALL tsc CALL tsc
:ALLSET :ALLSET
node dist/src/app.js node app.js

View file

@ -2,7 +2,7 @@
"name": "botserver", "name": "botserver",
"version": "1.3.0", "version": "1.3.0",
"description": "General Bot Community Edition open-core server.", "description": "General Bot Community Edition open-core server.",
"main": "./src/app.ts", "main": "./boot.js",
"bugs": "https://github.com/pragmatismo-io/BotServer/issues", "bugs": "https://github.com/pragmatismo-io/BotServer/issues",
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme", "homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
"contributors": [ "contributors": [
@ -15,7 +15,7 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {
"gbot": "./dist/src/app.js" "gbot": "./boot.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -31,7 +31,7 @@
"test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ", "test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ",
"pretest": "npm run build", "pretest": "npm run build",
"coveralls": "npm run test && nyc report --reporter=text-lcov | coveralls", "coveralls": "npm run test && nyc report --reporter=text-lcov | coveralls",
"start": "node ./dist/src/app.js", "start": "node ./boot.js",
"watch:build": "tsc --watch", "watch:build": "tsc --watch",
"watch:server": "nodemon './dist/index.js' --watch './dist'", "watch:server": "nodemon './dist/index.js' --watch './dist'",
"posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll", "posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll",

View file

@ -93,7 +93,7 @@ export class GBDeployer {
(resolve: any, reject: any): any => { (resolve: any, reject: any): any => {
GBLog.info(`PWD ${process.env.PWD}...`); GBLog.info(`PWD ${process.env.PWD}...`);
let totalPackages = 0; let totalPackages = 0;
let paths = [urlJoin(process.env.PWD, '..', GBDeployer.deployFolder)]; let paths = [urlJoin(process.env.PWD, GBDeployer.deployFolder)];
const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH');
if (additionalPath !== undefined && additionalPath !== '') { if (additionalPath !== undefined && additionalPath !== '') {
paths = paths.concat(additionalPath.toLowerCase().split(';')); paths = paths.concat(additionalPath.toLowerCase().split(';'));

View file

@ -1,4 +1,3 @@
#! /usr/bin / env node
/*****************************************************************************\ /*****************************************************************************\
| ( )_ _ | | ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
@ -72,19 +71,11 @@ export class GBServer {
public static run() { public static run() {
GBLog.info(`The Bot Server is in STARTING mode...`); GBLog.info(`The Bot Server is in STARTING mode...`);
process.env.PWD = __dirname;
// Creates a basic HTTP server that will serve several URL, one for each bot instance.
GBServer.globals = new RootData(); GBServer.globals = new RootData();
const port = GBConfigService.getServerPort(); const port = GBConfigService.getServerPort();
const server = express(); const server = express();
server.use(bodyParser.json()); server.use(bodyParser.json());
server.use( server.use(bodyParser.urlencoded({ extended: true }));
bodyParser.urlencoded({
extended: true
})
);
server.listen(port, () => { server.listen(port, () => {
(async () => { (async () => {
@ -171,7 +162,3 @@ export class GBServer {
}); });
} }
} }
// First line to run.
GBServer.run();

View file

@ -2,7 +2,7 @@
<configuration> <configuration>
<system.webServer> <system.webServer>
<handlers> <handlers>
<add name="iisnode" path="dist/src/app.js" verb="*" modules="iisnode"/> <add name="iisnode" path="boot.js" verb="*" modules="iisnode"/>
</handlers> </handlers>
<rewrite> <rewrite>
<rules> <rules>
@ -19,7 +19,7 @@
<conditions> <conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions> </conditions>
<action type="Rewrite" url="dist/src/app.js"/> <action type="Rewrite" url="boot.js"/>
</rule> </rule>
</rules> </rules>
</rewrite> </rewrite>
@ -35,5 +35,3 @@
<httpErrors existingResponse="PassThrough" /> <httpErrors existingResponse="PassThrough" />
</system.webServer> </system.webServer>
</configuration> </configuration>