Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Start Botproject runtime in bot folder #1672

Merged
merged 54 commits into from
Jan 9, 2020
Merged

Conversation

VanyLaw
Copy link
Contributor

@VanyLaw VanyLaw commented Nov 28, 2019

Description

This PR is for starting runtime by csharp botproject in bot folder rather than by common botproject.

Solution

  1. When a call to /connect api. Check whether the port 3979 has been used. If port is valid, use it as the endpoint to start runtime, otherwise use another valid port instead.
  2. Check whether the .net core version >=3.0, init user secret and build runtime.
  3. Stop previous bot runtime and start current bot runtime.

Task Item

related to #1516
close #483

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code refactor (non-breaking change which improve code quality, clean up, add tests, etc)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Doc update (document update)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have functionally tested my change

Screenshots

Please include screenshots or gifs if your PR include UX changes.

@github-actions
Copy link

Coverage Status

Coverage decreased (-0.08%) to 39.937% when pulling 6b04384 on wenyluo/csConnector into f492bef on master.

@VanyLaw VanyLaw changed the title Start Botproject runtime in bot folder [feat]Start Botproject runtime in bot folder Nov 28, 2019
@VanyLaw VanyLaw changed the title [feat]Start Botproject runtime in bot folder feat: Start Botproject runtime in bot folder Nov 28, 2019
Copy link

@compulim compulim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am seeing a lot of coalesce of SensitiveProperties.

You can also consider coalesce at earlier code to reduce these coalesces.

Composer/packages/client/src/store/reducer/index.ts Outdated Show resolved Hide resolved
Composer/packages/client/src/store/reducer/index.ts Outdated Show resolved Hide resolved
Composer/packages/client/src/store/reducer/index.ts Outdated Show resolved Hide resolved
Composer/packages/client/src/store/action/setting.ts Outdated Show resolved Hide resolved
@VanyLaw
Copy link
Contributor Author

VanyLaw commented Dec 20, 2019

We shouldn't combine dockerfile for Composer and C# runtime because we'll have multiple languages for runtimes. If we need to have 1 container which runs both (which I think we should avoid), then we should build the composer container, then have the dotnet one extend the base composer container. That pattern would work for other language as well.

Hi @christopheranderson , Is there a solution for the "dockerfile spliting" problem? Like I said before, I have a build error when using two dockerfile, so, Is that ok to use multi-stage instead?

@cwhitten
Copy link
Member

cwhitten commented Jan 6, 2020

@VanyLaw have any commands changed to make this work? I'm seeing errors locally, but may be in a bad state:

~/src/BotFramework-Composer/Composer (wenyluo/csConnector) $ docker-compose build
Building composer
Step 1/27 : FROM node:12-alpine as build
 ---> 69c8cc9212ec
Step 2/27 : WORKDIR /src/Composer
 ---> Using cache
 ---> 71bb946b33f5
Step 3/27 : COPY . .
 ---> Using cache
 ---> 7f2deaf0fbd6
Step 4/27 : RUN yarn install --frozen-lock-file
 ---> Using cache
 ---> 2c35707c2fe0
Step 5/27 : ENV NODE_OPTIONS "--max-old-space-size=4096"
 ---> Using cache
 ---> f9d9d45b2d56
Step 6/27 : ENV NODE_ENV "production"
 ---> Using cache
 ---> d9984da779af
Step 7/27 : RUN yarn build:prod
 ---> Running in 45d73df91d2d
yarn run v1.19.1
$ yarn build:dev && yarn build:server && yarn build:client
$ yarn build:tools && yarn build:lib && yarn build:extensions
$ yarn workspace @bfc/tools build:all
$ concurrently --kill-others-on-fail "yarn:build:language-servers"
[build:language-servers] $ cd language-servers && yarn build
[build:language-servers] $ yarn build:lg
[build:language-servers] $ cd language-generation && yarn build
[build:language-servers] $ tsc --build tsconfig.build.json
[build:language-servers] yarn run build:language-servers exited with code 0
$ yarn workspace @bfc/libs build:all
$ yarn build:indexers && yarn build:shared && yarn build:code-editor
$ cd indexers && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ cd shared && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ cd code-editor && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ yarn workspace @bfc/extensions build:all
$ concurrently --kill-others-on-fail "yarn:build:obiformeditor" "yarn:build:visual-designer"
[build:obiformeditor] $ cd obiformeditor && yarn build
[build:visual-designer] $ cd visual-designer && yarn build
[build:obiformeditor] $ yarn clean && yarn build:css && yarn build:ts
[build:visual-designer] $ yarn clean && yarn build:css && yarn build:ts
[build:obiformeditor] $ rimraf lib demo/dist
[build:visual-designer] $ rimraf lib demo/dist
[build:obiformeditor] $ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
[build:visual-designer] $ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
[build:visual-designer] $ tsc --build tsconfig.build.json
[build:obiformeditor] $ tsc --build tsconfig.build.json
[build:visual-designer] yarn run build:visual-designer exited with code 0
[build:obiformeditor] yarn run build:obiformeditor exited with code 0
$ yarn workspace @bfc/server build
$ tsc -p tsconfig.build.json
$ yarn workspace @bfc/client build
$ node scripts/build.js
Creating an optimized production build. This may take a few minutes..
error Command failed with signal "SIGKILL".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /opt/yarn-v1.19.1/lib/cli.js build
Directory: /src/Composer/packages/client
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: Service 'composer' failed to build: The command '/bin/sh -c yarn build:prod' returned a non-zero code: 1

@boydc2014
Copy link
Contributor

@VanyLaw have any commands changed to make this work? I'm seeing errors locally, but may be in a bad state:

~/src/BotFramework-Composer/Composer (wenyluo/csConnector) $ docker-compose build
Building composer
Step 1/27 : FROM node:12-alpine as build
 ---> 69c8cc9212ec
Step 2/27 : WORKDIR /src/Composer
 ---> Using cache
 ---> 71bb946b33f5
Step 3/27 : COPY . .
 ---> Using cache
 ---> 7f2deaf0fbd6
Step 4/27 : RUN yarn install --frozen-lock-file
 ---> Using cache
 ---> 2c35707c2fe0
Step 5/27 : ENV NODE_OPTIONS "--max-old-space-size=4096"
 ---> Using cache
 ---> f9d9d45b2d56
Step 6/27 : ENV NODE_ENV "production"
 ---> Using cache
 ---> d9984da779af
Step 7/27 : RUN yarn build:prod
 ---> Running in 45d73df91d2d
yarn run v1.19.1
$ yarn build:dev && yarn build:server && yarn build:client
$ yarn build:tools && yarn build:lib && yarn build:extensions
$ yarn workspace @bfc/tools build:all
$ concurrently --kill-others-on-fail "yarn:build:language-servers"
[build:language-servers] $ cd language-servers && yarn build
[build:language-servers] $ yarn build:lg
[build:language-servers] $ cd language-generation && yarn build
[build:language-servers] $ tsc --build tsconfig.build.json
[build:language-servers] yarn run build:language-servers exited with code 0
$ yarn workspace @bfc/libs build:all
$ yarn build:indexers && yarn build:shared && yarn build:code-editor
$ cd indexers && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ cd shared && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ cd code-editor && yarn build
$ yarn clean && yarn build:css && yarn build:ts
$ rimraf lib demo/dist
$ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
$ tsc --build tsconfig.build.json
$ yarn workspace @bfc/extensions build:all
$ concurrently --kill-others-on-fail "yarn:build:obiformeditor" "yarn:build:visual-designer"
[build:obiformeditor] $ cd obiformeditor && yarn build
[build:visual-designer] $ cd visual-designer && yarn build
[build:obiformeditor] $ yarn clean && yarn build:css && yarn build:ts
[build:visual-designer] $ yarn clean && yarn build:css && yarn build:ts
[build:obiformeditor] $ rimraf lib demo/dist
[build:visual-designer] $ rimraf lib demo/dist
[build:obiformeditor] $ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
[build:visual-designer] $ copyfiles --up 1 "src/**/*.css" "src/**/*.scss" lib
[build:visual-designer] $ tsc --build tsconfig.build.json
[build:obiformeditor] $ tsc --build tsconfig.build.json
[build:visual-designer] yarn run build:visual-designer exited with code 0
[build:obiformeditor] yarn run build:obiformeditor exited with code 0
$ yarn workspace @bfc/server build
$ tsc -p tsconfig.build.json
$ yarn workspace @bfc/client build
$ node scripts/build.js
Creating an optimized production build. This may take a few minutes..
error Command failed with signal "SIGKILL".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /opt/yarn-v1.19.1/lib/cli.js build
Directory: /src/Composer/packages/client
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: Service 'composer' failed to build: The command '/bin/sh -c yarn build:prod' returned a non-zero code: 1

Looks highly likely a memory issue, can you check did you alloc enough memory to docker-compose? In windows, the correct way to do that is
image

you need to make sure your memory is set to more than 4GB, the value we set on node.js limitation.

@VanyLaw
Copy link
Contributor Author

VanyLaw commented Jan 7, 2020

Hi @cwhitten, The error was throw when client build, it seems like a out of memory issue, maybe extending the memory for docker can fix it.

Copy link
Contributor

@a-b-r-o-w-n a-b-r-o-w-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composer/packages/server/ComposerDialogs/settings/appsettings.json keeps getting created when launching or restarting the bot. Not sure what is happening.

@a-b-r-o-w-n
Copy link
Contributor

Other than that one thing, this is looking good to me.

@VanyLaw
Copy link
Contributor Author

VanyLaw commented Jan 9, 2020

Composer/packages/server/ComposerDialogs/settings/appsettings.json keeps getting created when launching or restarting the bot. Not sure what is happening.

Hi @a-b-r-o-w-n , I debug and find it's because I get the localStorage setting in sync api. but EnvironmentProvider.getCurrent() return the default environment which used null basePath, instead of the current botproject environment.
image

So I used BotProjectService.getCurrentBotProject()?.environment instead to fix it.

@a-b-r-o-w-n a-b-r-o-w-n merged commit 89faea0 into master Jan 9, 2020
@a-b-r-o-w-n a-b-r-o-w-n deleted the wenyluo/csConnector branch January 9, 2020 17:55
@a-b-r-o-w-n a-b-r-o-w-n mentioned this pull request Jan 27, 2020
cwhitten added a commit that referenced this pull request Jan 28, 2020
### 01-27-2020

#### Added

- feat: enrich prebuilt memory paths and add user defined memory paths ([#1868](#1868)) ([@lei9444](https://github.com/lei9444))
- feat: Language-Understanding LSP ([#1711](#1711)) ([@cosmicshuai](https://github.com/cosmicshuai))
- feat: lu shell api ([#1810](#1810)) ([@zhixzhan](https://github.com/zhixzhan))
- feat: Start Botproject runtime in bot folder ([#1672](#1672)) ([@VanyLaw](https://github.com/VanyLaw))
- feat: Schema-driven visual editor - migrates 15 simple types ([#1811](#1811)) ([@yeze322](https://github.com/yeze322))
- feat: Update OnConversationUpdate actions ([#1794](#1794)) ([@luhan2017](https://github.com/luhan2017))
- feat: Update LG and built in expression functions in LSP ([#1790](#1790)) ([@Danieladu](https://github.com/Danieladu))
- feat: Add dynamic choices to Choice Prompt ([#1777](#1777)) ([@tdurnford](https://github.com/tdurnford))
- feat: update ui for new schema ([#1775](#1775)) ([@alanlong9278](https://github.com/alanlong9278))
- feat: lu all up view ux enhancement ([#1879](#1879)) ([@zhixzhan](https://github.com/zhixzhan))
- feat: add autoClosingPairs for lg editor ([#1789](#1789)) ([@cosmicshuai](https://github.com/cosmicshuai))

#### Fixed

- fix: update the lg content to store when editor editing ([#1884](#1884)) ([@lei9444](https://github.com/lei9444))
- fix: Aligned elements in prompt settings ([#1893](#1893)) ([@tdurnford](https://github.com/tdurnford))
- fix: remove label from validations ([#1891](#1891)) ([@tdurnford](https://github.com/tdurnford))
- fix: Undo / redo behavior on LG resources ([#1813](#1813)) ([@lei9444](https://github.com/lei9444))
- fix: botproject build script powershell version limit ([#1857](#1857)) ([@VanyLaw](https://github.com/VanyLaw))
- fix: Add support of auto suggestion memory variable ([#1819](#1819)) ([@cosmicshuai](https://github.com/cosmicshuai))
- fix: Fixed Multiple Choice Type undo/redo functionality ([#1844](#1844)) ([@tdurnford](https://github.com/tdurnford))
- fix: RepeatDialog not shown ([#1835](#1835)) ([@yeze322](https://github.com/yeze322))
- fix: do not preset name when creating a dialog ([#1805](#1805)) ([@liweitian](https://github.com/liweitian))
- fix: luis authoringRegion not update in popup form ([#1818](#1818)) ([@VanyLaw](https://github.com/VanyLaw))
- fix: Check all expressions in dialog ([#1798](#1798)) ([@lei9444](https://github.com/lei9444))
- fix: TextWidget hover ([#1825](#1825)) ([@tdurnford](https://github.com/tdurnford))
- fix: Create bot from scratch may create a non-empty bot ([#1796](#1796)) ([@liweitian](https://github.com/liweitian))
- fix: Updated release version on about page ([#1788](#1788)) ([@tdurnford](https://github.com/tdurnford))
- fix: Remove the unused lufiles in notifications ([#1760](#1760)) ([@lei9444](https://github.com/lei9444))
- fix: update form correctly when undo or redo changes ([#1808](#1808)) ([@lei9444](https://github.com/lei9444))
- fix: handle multiple ctrl+z in lg editor ([#1804](#1804)) ([@zhixzhan](https://github.com/zhixzhan))

#### Changed

- refactor: re-provide `getLgTemplates` api ([#1746](#1746)) ([@yeze322](https://github.com/yeze322))
- style: updated delete icon ([#1892](#1892)) ([@tdurnford](https://github.com/tdurnford))
- refactor: let ElementWrapper control the focus state ([#1880](#1880)) ([@yeze322](https://github.com/yeze322))
- refactor: render Elements with composition strategy (ElementRenderer -> ElementWrapper) ([#1873](#1873)) ([@yeze322](https://github.com/yeze322))

#### Other

- chore: migrate IfCondition, SwitchCondition, Foreach(Page) to uischema ([#1899](#1899)) ([@yeze322](https://github.com/yeze322))
- chore: migrate TextInput and all other \*Input types to uischema ([#1874](#1874)) ([@yeze322](https://github.com/yeze322))
- chore: migrate SendActivity, BeginDialog, ReplaceDialog to uischema ([#1840](#1840)) ([@yeze322](https://github.com/yeze322))
- chore: retire 'DefaultRenderer' in visual editor ([#1836](#1836)) ([@yeze322](https://github.com/yeze322))
- chore: update lu/lg all up view ([#1806](#1806)) ([@liweitian](https://github.com/liweitian))
- chore: share server's resource to lsp server ([#1793](#1793)) ([@zhixzhan](https://github.com/zhixzhan))
- chore: refactor lg page route & url ([#1756](#1756)) ([@zhixzhan](https://github.com/zhixzhan))
- chore: convert ludown to bf-lu ([#1608](#1608)) ([@lei9444](https://github.com/lei9444))
- chore: proxy lsp ws request in dev ([#1754](#1754)) ([@zhixzhan](https://github.com/zhixzhan))
- docs: fix a typo ([#1901](#1901)) ([@HiltonGiesenow](https://github.com/HiltonGiesenow))
- docs: use correct link in events and triggers documentation ([#1832](#1832)) ([@arafattehsin](https://github.com/arafattehsin))
- docs: fix memory documentation link and typo ([#1833](#1833)) ([@arafattehsin](https://github.com/arafattehsin))
- docs: fix the links to intents and advanced definitions ([#1854](#1854)) ([@arafattehsin](https://github.com/arafattehsin))
- chore: bump immer to 5.2.0 ([#1846](#1846)) ([@cwhitten](https://github.com/cwhitten))
- chore: update botproject packages ([#1809](#1809)) ([@luhan2017](https://github.com/luhan2017))
- chore: update github templates ([@a-b-r-o-w-n](https://github.com/a-b-r-o-w-n))
- chore: update schema and samples ([@luhan2017](https://github.com/luhan2017))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants