From bf6cff13f0901eb225bfb389b9b3cb43a86ebdd9 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 10:28:47 -0800 Subject: [PATCH 1/9] allow runtime folder to be configurable --- Composer/packages/server/src/settings/env.ts | 5 +++-- Composer/packages/server/src/settings/index.ts | 4 ++-- docker-compose.yml | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Composer/packages/server/src/settings/env.ts b/Composer/packages/server/src/settings/env.ts index 7414e92f98..7e505f51cc 100644 --- a/Composer/packages/server/src/settings/env.ts +++ b/Composer/packages/server/src/settings/env.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import path from 'path'; +import { Path } from '../utility/path'; export const absHosted = process.env.COMPOSER_AUTH_PROVIDER === 'abs-h'; export const absHostRoot = process.env.WEBSITE_HOSTNAME @@ -16,4 +16,5 @@ if (folder && folder.endsWith(':')) { export const environment = process.env.NODE_ENV || 'development'; export const botsFolder = folder; export const botEndpoint = process.env.BOT_ENDPOINT || 'http://localhost:3979'; -export const appDataPath = process.env.COMPOSER_APP_DATA || path.resolve(__dirname, '../../data.json'); +export const appDataPath = process.env.COMPOSER_APP_DATA || Path.resolve(__dirname, '../../data.json'); +export const runtimeFolder = process.env.COMPOSER_RUNTIME_FOLDER || Path.resolve('../../../BotProject/Templates'); diff --git a/Composer/packages/server/src/settings/index.ts b/Composer/packages/server/src/settings/index.ts index c68381dffa..e9d5231635 100644 --- a/Composer/packages/server/src/settings/index.ts +++ b/Composer/packages/server/src/settings/index.ts @@ -8,7 +8,7 @@ import merge from 'lodash/merge'; import log from '../logger'; import { Path } from '../utility/path'; -import { botsFolder, botEndpoint, appDataPath, environment } from './env'; +import { botsFolder, botEndpoint, appDataPath, environment, runtimeFolder } from './env'; interface Settings { botAdminEndpoint: string; @@ -24,8 +24,8 @@ const envSettings: { [env: string]: Settings } = { botAdminEndpoint: botEndpoint, botEndpoint: 'http://localhost:3979', //botEndpoint, assetsLibray: Path.resolve('./assets'), - runtimeFolder: Path.resolve('../../../BotProject/Templates'), botsFolder: botsFolder || Path.join(os.homedir(), 'Documents', 'Composer'), + runtimeFolder, appDataPath, }, }; diff --git a/docker-compose.yml b/docker-compose.yml index c28457b54c..d5f6c88df3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - ./.appdata:/appdata environment: COMPOSER_BOTS_FOLDER: /Bots + COMPOSER_RUNTIME_FOLDER: /BotProject/Templates COMPOSER_APP_DATA: /appdata/data.json BOT_ENDPOINT: http://botruntime:80 PORT: 3000 From f3c01f7791af3b0351835b170bb519a3c02c3738 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 10:29:06 -0800 Subject: [PATCH 2/9] remove dead server webpack config --- Composer/packages/server/webpack.config.js | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 Composer/packages/server/webpack.config.js diff --git a/Composer/packages/server/webpack.config.js b/Composer/packages/server/webpack.config.js deleted file mode 100644 index aa209ccb9d..0000000000 --- a/Composer/packages/server/webpack.config.js +++ /dev/null @@ -1,30 +0,0 @@ -const path = require('path'); -const CopyPlugin = require('copy-webpack-plugin'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); - -const SrcPath = path.resolve(__dirname, 'src'); -const BuildPath = path.resolve(__dirname, './../../dist'); -const ProjPath = __dirname; - -module.exports = { - target: 'node', - mode: 'production', - entry: path.resolve(SrcPath, 'server.ts'), - output: { - path: BuildPath, - filename: 'server.js', - }, - module: { - rules: [{ test: /\.tsx?$/, exclude: [/node_modules/], loader: 'ts-loader' }], - }, - plugins: [ - new CleanWebpackPlugin(), - new CopyPlugin([ - { from: path.resolve(ProjPath, 'settings.json'), to: BuildPath }, - { from: path.resolve(ProjPath, 'storage.json'), to: BuildPath }, - ]), - ], - resolve: { - extensions: ['.ts', '.js'], - }, -}; From cd4349b709361dbd2240fb76286026823d48034e Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 10:30:34 -0800 Subject: [PATCH 3/9] remove unused dev dependencies --- Composer/packages/server/package.json | 3 -- Composer/yarn.lock | 54 ++------------------------- 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/Composer/packages/server/package.json b/Composer/packages/server/package.json index a87658097c..e4e05b49de 100644 --- a/Composer/packages/server/package.json +++ b/Composer/packages/server/package.json @@ -19,7 +19,6 @@ "lint:fix": "yarn lint --fix" }, "author": "", - "license": "ISC", "nodemonConfig": { "exec": "cross-env TS_NODE_FILES=true node --inspect=9228 -r ts-node/register src/server.ts", "watch": [ @@ -46,8 +45,6 @@ "@types/morgan": "^1.7.35", "@types/node": "^11.9.6", "@types/rimraf": "^2.0.2", - "clean-webpack-plugin": "^2.0.1", - "copy-webpack-plugin": "^5.0.2", "mock-fs": "^4.10.1", "nodemon": "^1.18.11", "rimraf": "^2.6.3", diff --git a/Composer/yarn.lock b/Composer/yarn.lock index bf0b31c472..16e4fcb8cc 100644 --- a/Composer/yarn.lock +++ b/Composer/yarn.lock @@ -4683,7 +4683,7 @@ bytes@3.1.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== -cacache@^11.0.2, cacache@^11.3.1: +cacache@^11.0.2: version "11.3.2" resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.2.tgz#2d81e308e3d258ca38125b676b98b2ac9ce69bfa" integrity sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg== @@ -5102,13 +5102,6 @@ clean-stack@^2.0.0: resolved "https://botbuilder.myget.org/F/botbuilder-declarative/npm/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha1-7oRy27Ep5yezHooQpCfe6d/kAIs= -clean-webpack-plugin@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-2.0.1.tgz#2241526b0030aa0249e78714471298f867fc2829" - integrity sha512-vway5pXGVd91bicwjaf8j188Al6VMf9R9Ekl6q0qeiaWStRsOOXuh4qtjX1UrUvmz5XevQVCdjBuzr4Tzsnpog== - dependencies: - del "^4.0.0" - cli-boxes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" @@ -5508,23 +5501,6 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-webpack-plugin@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.0.2.tgz#56186dfddbf9aa1b29c97fa4c796c1be98870da4" - integrity sha512-7nC7EynPrnBTtBwwbG1aTqrfNS1aTb9eEjSmQDqFtKAsJrR3uDb+pCDIFT2LzhW+SgGJxQcYzThrmXzzZ720uw== - dependencies: - cacache "^11.3.1" - find-cache-dir "^2.0.0" - glob-parent "^3.1.0" - globby "^7.1.1" - is-glob "^4.0.0" - loader-utils "^1.1.0" - minimatch "^3.0.4" - normalize-path "^3.0.0" - p-limit "^2.1.0" - serialize-javascript "^1.4.0" - webpack-log "^2.0.0" - copyfiles@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.1.0.tgz#0e2a4188162d6b2f3c5adfe34e9c0bd564d23164" @@ -6760,18 +6736,6 @@ del@^3.0.0: pify "^3.0.0" rimraf "^2.2.8" -del@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-4.0.0.tgz#4fa27e92c366cb45b9bdaa56a9b8703dced17437" - integrity sha512-/BnSJ+SuZyLu7xMn48kZY0nMXDi+5KNmR4g8n21Wivsl8+B9njV6/5kcTNE9juSprp0zRWBU28JuHUq0FqK1Nw== - dependencies: - globby "^6.1.0" - is-path-cwd "^2.0.0" - is-path-in-cwd "^2.0.0" - p-map "^2.0.0" - pify "^4.0.1" - rimraf "^2.6.2" - del@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" @@ -6873,7 +6837,7 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" -dir-glob@^2.0.0, dir-glob@^2.2.1: +dir-glob@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== @@ -8553,18 +8517,6 @@ globby@^6.1.0: pify "^2.0.0" pinkie-promise "^2.0.0" -globby@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-7.1.1.tgz#fb2ccff9401f8600945dfada97440cca972b8680" - integrity sha1-+yzP+UAfhgCUXfral0QMypcrhoA= - dependencies: - array-union "^1.0.1" - dir-glob "^2.0.0" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" - got@^6.7.1: version "6.7.1" resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" @@ -12452,7 +12404,7 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0, p-limit@^2.1.0: +p-limit@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== From 54e326bf85595e1b87a3a4bd66789d1600be07d4 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 10:45:28 -0800 Subject: [PATCH 4/9] add simple e2e check for docker --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 221d8c17e5..d5daa3a426 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,3 +78,10 @@ jobs: uses: actions/checkout@v1 - name: docker-compose build run: docker-compose build + - name: Health check + run: | + docker-compose up -d + curl -Is http://localhost:3000 | grep -q "200 OK" + - name: Cleanup + if: always() + run: docker-compose down From 680e4694171152ad658ff13fa5f637f98ff0580e Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 11:06:11 -0800 Subject: [PATCH 5/9] add sleep to wait for docker-compose to start up --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5daa3a426..36d12ed01f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,6 +81,7 @@ jobs: - name: Health check run: | docker-compose up -d + sleep 10 curl -Is http://localhost:3000 | grep -q "200 OK" - name: Cleanup if: always() From 3f16fb6ec1dcda573fccc4499a02da5fe796ec01 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 11:10:30 -0800 Subject: [PATCH 6/9] run docker build on all platforms --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36d12ed01f..0715e7989c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,8 +70,10 @@ jobs: docker-build: name: Docker Build - runs-on: ubuntu-latest timeout-minutes: 20 + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout @@ -83,6 +85,7 @@ jobs: docker-compose up -d sleep 10 curl -Is http://localhost:3000 | grep -q "200 OK" + shell: bash - name: Cleanup if: always() run: docker-compose down From 43ccbc05352d355de8e2cbd214d5254b6da5a562 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 11:18:20 -0800 Subject: [PATCH 7/9] add missing runs-on property --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0715e7989c..528e139d76 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,6 +71,7 @@ jobs: docker-build: name: Docker Build timeout-minutes: 20 + runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] From e1af8035ed2fd38765150a742b88780311d9525f Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 11:25:36 -0800 Subject: [PATCH 8/9] do not run docker build on mac apparently docker is not installed on the github mac agents /shrug --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 528e139d76..799847273d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,7 +74,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] steps: - name: Checkout From 6873a0bf79d7cb4ad0d57ddca3da1984df9c7b06 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 6 Dec 2019 11:41:00 -0800 Subject: [PATCH 9/9] only run on ubuntu-latest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it wasn't working with the windows vm either 😭 --- .github/workflows/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 799847273d..b3de1d17bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,10 +71,7 @@ jobs: docker-build: name: Docker Build timeout-minutes: 20 - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] + runs-on: ubuntu-latest steps: - name: Checkout