Cleaning and improvements on setup development environment on Windows and source-code sharing with direct download links.
This commit is contained in:
parent
9027c9c39e
commit
7bcb6d9f85
5 changed files with 56 additions and 123 deletions
41
README.md
41
README.md
|
@ -29,12 +29,43 @@ Office tools like Word or Excel to edit your Bot - using code (JavaScript or Typ
|
||||||
How To
|
How To
|
||||||
------
|
------
|
||||||
|
|
||||||
### Run the server
|
### Run the server locally
|
||||||
|
|
||||||
1. `git clone https://github.com/pragmatismo-io/BotServer.git` or just download the files to a folder;
|
1. Install [Node.js](https://www.npmjs.com/get-npm) the current generation General Bots code execution platform;
|
||||||
2. Run `npm install` on that folder;
|
2. Open a **Terminal** on Linux and Mac or a **Command Prompt** window on Windows;npm
|
||||||
3. Enter './deploy/default.gbui' folder and run `npm install` folled by `npm run build` (To build default Bot UI);
|
3. Type `npm install -g botserver` and press *ENTER*;
|
||||||
4. On the downloaded folder (../..), run the bot server by `npm start`.
|
4. Type `gbot` to run the server core.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
* [*nodejs.install* Chocolatey Package](https://chocolatey.org/packages/nodejs.install) is also available.
|
||||||
|
* The zip source code of general bots is also available for [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master);
|
||||||
|
|
||||||
|
### Setup development environment (Windows)
|
||||||
|
|
||||||
|
1. [Optional] Install [Chocolatey](https://chocolatey.org/install), a Windows Package Manager;
|
||||||
|
2. Install [git](`https://git-scm.com/`), a Software Configuration Management (SCM).;
|
||||||
|
3. Install [Node.js](npmjs.com/get-npm), a [Runtime system](https://en.wikipedia.org/wiki/Runtime_system).
|
||||||
|
(https://www.npmjs.com/get-npm);
|
||||||
|
4. Install [Visual Studio Code](https://chocolatey.org/packages/nodejs.install), Brackets or Atom as an editor of your choice;
|
||||||
|
5. [Fork](https://en.wikipedia.org/wiki/Fork_(software_development)) by visiting https://github.com/pragmatismo-io/BotServer/fork
|
||||||
|
6. Clone the just forked repository by running `git clone <your-forked-repository-url>/BotServer.git` ;
|
||||||
|
7. Run `npm install` on Command Prompt or PowerShell on the General Bots source-code folder;
|
||||||
|
8. Enter './deploy/default.gbui' folder;
|
||||||
|
9. Run `npm install` folled by `npm run build` (To build default Bot UI);
|
||||||
|
10. Enter the On the downloaded folder (../..);
|
||||||
|
11. Run the bot server by `npm start`.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|
||||||
|
* Whenever you is ready to your open-source ideas in form of .gbapp (source-code) and artifacts
|
||||||
|
like .gbkb, .gbtheme, .gbot or the .gbai full package read [CONTRIBUTING.md](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) about performing Pull Requests (PR)
|
||||||
|
and creating other public custom packages repositories of your own personal
|
||||||
|
or organization General Bots Community Edition powered packages.
|
||||||
|
|
||||||
|
### Just copy the source code to your machine
|
||||||
|
|
||||||
|
1. [Download] the Zip file of (https://codeload.github.com/pragmatismo-io/BotServer/zip/master)
|
||||||
|
|
||||||
### Updating the Bot Knoledge Base (.gbkb folder)
|
### Updating the Bot Knoledge Base (.gbkb folder)
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ export class GBMinService {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
let botsToProcess = 0, botsProcessed = 0;
|
let totalPackages = 0;
|
||||||
let additionalPath = GBConfigService.get("ADDITIONAL_DEPLOY_PATH");
|
let additionalPath = GBConfigService.get("ADDITIONAL_DEPLOY_PATH");
|
||||||
let paths = [this.deployFolder];
|
let paths = [this.deployFolder];
|
||||||
if (additionalPath) {
|
if (additionalPath) {
|
||||||
|
@ -323,7 +323,7 @@ export class GBMinService {
|
||||||
logger.trace(`Starting looking for generalPackages...`);
|
logger.trace(`Starting looking for generalPackages...`);
|
||||||
paths.forEach(e => {
|
paths.forEach(e => {
|
||||||
logger.trace(`Looking in: ${e}...`);
|
logger.trace(`Looking in: ${e}...`);
|
||||||
doIt(e)
|
doIt(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Deploys all .gbot files first. */
|
/** Deploys all .gbot files first. */
|
||||||
|
@ -331,7 +331,8 @@ export class GBMinService {
|
||||||
botPackages.forEach(e => {
|
botPackages.forEach(e => {
|
||||||
logger.trace(`Deploying bot: ${e}...`);
|
logger.trace(`Deploying bot: ${e}...`);
|
||||||
this.deployer.deployBot(e, (data, err) => {
|
this.deployer.deployBot(e, (data, err) => {
|
||||||
botsProcessed++;
|
botPackages.length++;
|
||||||
|
logger.trace(`Bot: ${e} deployed...`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -384,18 +385,23 @@ export class GBMinService {
|
||||||
let err = new Error(`Package type not handled: ${filename}.`);
|
let err = new Error(`Package type not handled: ${filename}.`);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
botsProcessed++;
|
totalPackages++;
|
||||||
});
|
});
|
||||||
|
|
||||||
WaitUntil()
|
WaitUntil()
|
||||||
.interval(100)
|
.interval(1000)
|
||||||
.times(50)
|
.times(5)
|
||||||
.condition(function (cb) {
|
.condition(function (cb) {
|
||||||
logger.trace(`Waiting for package deployment...`);
|
logger.trace(`Waiting for package deployment...`);
|
||||||
cb(botsProcessed == (generalPackages.length + botPackages.length));
|
cb(totalPackages == (generalPackages.length + botPackages.length));
|
||||||
})
|
})
|
||||||
.done(function (result) {
|
.done(function (result) {
|
||||||
|
if (botPackages.length === 0){
|
||||||
|
logger.info(`The bot server is running empty: No bot instances have been found, at least one .gbot file must be deployed.`);
|
||||||
|
}
|
||||||
|
else{
|
||||||
logger.trace(`Package deployment done.`);
|
logger.trace(`Package deployment done.`);
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
109
dist/src/app.js
vendored
109
dist/src/app.js
vendored
|
@ -1,109 +0,0 @@
|
||||||
/*****************************************************************************\
|
|
||||||
| ( )_ _ |
|
|
||||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
|
||||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
|
||||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
|
||||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
|
||||||
| | | ( )_) | |
|
|
||||||
| (_) \___/' |
|
|
||||||
| |
|
|
||||||
| General Bots Copyright (c) Pragmatismo.io. All rights reserved. |
|
|
||||||
| Licensed under the AGPL-3.0. |
|
|
||||||
| |
|
|
||||||
| According to our dual licensing model, this program can be used either |
|
|
||||||
| under the terms of the GNU Affero General Public License, version 3, |
|
|
||||||
| or under a proprietary license. |
|
|
||||||
| |
|
|
||||||
| The texts of the GNU Affero General Public License with an additional |
|
|
||||||
| permission and of our proprietary license can be found at and |
|
|
||||||
| in the LICENSE file you have received along with this program. |
|
|
||||||
| |
|
|
||||||
| This program is distributed in the hope that it will be useful, |
|
|
||||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
||||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
||||||
| GNU Affero General Public License for more details. |
|
|
||||||
| |
|
|
||||||
| "General Bots" is a registered trademark of Pragmatismo.io. |
|
|
||||||
| The licensing of the program under the AGPLv3 does not imply a |
|
|
||||||
| trademark license. Therefore any rights, title and interest in |
|
|
||||||
| our trademarks remain entirely with us. |
|
|
||||||
| |
|
|
||||||
\*****************************************************************************/
|
|
||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const UrlJoin = require("url-join");
|
|
||||||
const logger = require("./logger");
|
|
||||||
const express = require("express");
|
|
||||||
const GBConfigService_1 = require("../deploy/core.gbapp/services/GBConfigService");
|
|
||||||
const GBConversationalService_1 = require("../deploy/core.gbapp/services/GBConversationalService");
|
|
||||||
const GBMinService_1 = require("../deploy/core.gbapp/services/GBMinService");
|
|
||||||
const GBDeployer_1 = require("../deploy/core.gbapp/services/GBDeployer");
|
|
||||||
const GBCoreService_1 = require("../deploy/core.gbapp/services/GBCoreService");
|
|
||||||
const GBImporter_1 = require("../deploy/core.gbapp/services/GBImporter");
|
|
||||||
const analytics_gblib_1 = require("../deploy/analytics.gblib");
|
|
||||||
const core_gbapp_1 = require("../deploy/core.gbapp");
|
|
||||||
const kb_gbapp_1 = require("../deploy/kb.gbapp");
|
|
||||||
const security_gblib_1 = require("../deploy/security.gblib");
|
|
||||||
const index_1 = require("../deploy/admin.gbapp/index");
|
|
||||||
const customer_satisfaction_gbapp_1 = require("../deploy/customer-satisfaction.gbapp");
|
|
||||||
/**
|
|
||||||
* General Bots open-core entry point.
|
|
||||||
*/
|
|
||||||
class GBServer {
|
|
||||||
/** Program entry-point. */
|
|
||||||
static run() {
|
|
||||||
logger.info("Starting General Bots Open Core (Guaribas)...");
|
|
||||||
// Creates a basic HTTP server that will serve several URL, one for each
|
|
||||||
// bot instance. This allows the same server to attend multiple Bot on
|
|
||||||
// the Marketplace until GB get serverless.
|
|
||||||
let port = process.env.port || process.env.PORT || 4242;
|
|
||||||
logger.info(`Starting GeneralBots HTTP server...`);
|
|
||||||
let server = express();
|
|
||||||
server.listen(port, () => {
|
|
||||||
logger.info(`General Bots Server - RUNNING on ${port}...`);
|
|
||||||
logger.info(`Starting instances...`);
|
|
||||||
// Reads basic configuration, initialize minimal services.
|
|
||||||
GBConfigService_1.GBConfigService.init();
|
|
||||||
let core = new GBCoreService_1.GBCoreService();
|
|
||||||
core.initDatabase(() => {
|
|
||||||
// Boot a bot package if any.
|
|
||||||
let deployer = new GBDeployer_1.GBDeployer(core, new GBImporter_1.GBImporter(core));
|
|
||||||
// Build a minimal bot instance for each .gbot deployment.
|
|
||||||
let conversationalService = new GBConversationalService_1.GBConversationalService(core);
|
|
||||||
let minService = new GBMinService_1.GBMinService(core, conversationalService, deployer);
|
|
||||||
let sysPackages = new Array();
|
|
||||||
[index_1.GBAdminPackage, analytics_gblib_1.GBAnalyticsPackage, core_gbapp_1.GBCorePackage, security_gblib_1.GBSecurityPackage, kb_gbapp_1.GBKBPackage, customer_satisfaction_gbapp_1.GBCustomerSatisfactionPackage].forEach(e => {
|
|
||||||
logger.trace(`Loading sys package: ${e.name}...`);
|
|
||||||
let p = Object.create(e.prototype);
|
|
||||||
p.loadPackage(core, core.sequelize);
|
|
||||||
sysPackages.push(p);
|
|
||||||
});
|
|
||||||
(() => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
let appPackages = new Array();
|
|
||||||
yield minService.deployPackages(core, server, appPackages, sysPackages);
|
|
||||||
minService.buildMin(instance => {
|
|
||||||
logger.info(`Instance loaded: ${instance.botId}...`);
|
|
||||||
}, server, appPackages);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
logger.log(err);
|
|
||||||
}
|
|
||||||
}))();
|
|
||||||
});
|
|
||||||
return core;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.GBServer = GBServer;
|
|
||||||
// First line to run.
|
|
||||||
GBServer.run();
|
|
||||||
//# sourceMappingURL=C:/Sources/opensource/BotServer/dist/src/app.js.map
|
|
|
@ -1,10 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "botserver",
|
"name": "botserver",
|
||||||
"version": "0.0.15",
|
"version": "0.0.16",
|
||||||
"description": "General Bots Community Edition open-core server.",
|
"description": "General Bots Community Edition open-core server.",
|
||||||
"author": "me@rodrigorodriguez.com",
|
"author": "me@rodrigorodriguez.com",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "./src/app.ts",
|
"main": "./src/app.ts",
|
||||||
|
"preferGlobal": "true",
|
||||||
|
"bin": {
|
||||||
|
"gbot" : "./dist/src/app.js"
|
||||||
|
},
|
||||||
"homepage": "http://pragmatismo.io",
|
"homepage": "http://pragmatismo.io",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#! /usr/bin/env node
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
| ( )_ _ |
|
| ( )_ _ |
|
||||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||||
|
|
Loading…
Add table
Reference in a new issue