From c4b6eee31827ab828da45554632e4bcef30f2aa1 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:25:22 +0100 Subject: [PATCH 1/8] Add a simple Procfile to serve static assets --- Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 000000000..3c846d89a --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: ruby -run -e httpd -- -p $PORT build/ From af281116a4c5909c4503f00b59a1e46a0b051bd4 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:33:30 +0100 Subject: [PATCH 2/8] Add an app.json too --- app.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 000000000..cd70c227c --- /dev/null +++ b/app.json @@ -0,0 +1,27 @@ +{ + "name": "editor-ui", + "scripts": { + "postdeploy": "yarn build:wc" + }, + "env": { + "HEROKU_APP_NAME": { + "required": true + }, + "NODE_ENV": { + "value": "production" + }, + "BABEL_ENV": { + "value": "production" + } + }, + "formation": { + "web": { + "quantity": 1 + } + }, + "buildpacks": [ + { + "url": "heroku/nodejs" + } + ] +} From 83129f8bb56057bbb87d2d9712d39bcfc6de8361 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:34:55 +0100 Subject: [PATCH 3/8] Add a dockerignore too --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..8b5b5ec05 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +build/ +dist/ +.git/ +node_modules/ From 93d30545c09acdba8d8c587ac55ea29aa3de74cb Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:50:33 +0100 Subject: [PATCH 4/8] Add heroku-postbuild job that runs instead of build This then builds both the web component and the app itself. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 647ae475d..0c6149119 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,8 @@ "test": "node scripts/test.js --transformIgnorePatterns 'node_modules/(?!three)/'", "test:integration": "cd e2e; docker compose up --exit-code-from cypress", "start:wc": "NODE_ENV=development BABEL_ENV=development webpack serve -c ./webpack.component.config.js", - "build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js" + "build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js", + "heroku-postbuild": "yarn run build && yarn run build:wc" }, "eslintConfig": { "extends": [ From dceab6a695d8e5f922c287ab3b920c503b5a9b76 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:55:32 +0100 Subject: [PATCH 5/8] Add a little para about review apps --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 69db39d30..ec7436aa1 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,6 @@ Open [http://localhost:3001](http://localhost:3001) to view it in the browser. There is no production build setup for the web component at present. +## Review apps + +Currently the build is deployed to both S3 and Heroku. The PR should get updated with the Heroku URL, and the web component demo is at `/web-component.html` on the Heroku review app domain. From 4c72eb9809dc04971e7ecd19c7c2e1b311411311 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 11:56:34 +0100 Subject: [PATCH 6/8] Simplified app.json --- app.json | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app.json b/app.json index cd70c227c..07357db42 100644 --- a/app.json +++ b/app.json @@ -1,19 +1,5 @@ { "name": "editor-ui", - "scripts": { - "postdeploy": "yarn build:wc" - }, - "env": { - "HEROKU_APP_NAME": { - "required": true - }, - "NODE_ENV": { - "value": "production" - }, - "BABEL_ENV": { - "value": "production" - } - }, "formation": { "web": { "quantity": 1 From a254756e1107bcd9a383fa42e3846a89baa01227 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 12:14:03 +0100 Subject: [PATCH 7/8] Set PUBLIC_URL for the heroku build --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0c6149119..a7e89cc9e 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "test:integration": "cd e2e; docker compose up --exit-code-from cypress", "start:wc": "NODE_ENV=development BABEL_ENV=development webpack serve -c ./webpack.component.config.js", "build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js", - "heroku-postbuild": "yarn run build && yarn run build:wc" + "heroku-postbuild": "PUBLIC_URL='' NODE_ENV=production BABEL_ENV=production yarn run build && yarn run build:wc" }, "eslintConfig": { "extends": [ From 779a8d8c0141a48589fb2c7776524b03e82ac220 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 3 Aug 2022 12:48:35 +0100 Subject: [PATCH 8/8] Make sure PUBLIC_URL is set in the sub-processes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7e89cc9e..4a8f5787b 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "test:integration": "cd e2e; docker compose up --exit-code-from cypress", "start:wc": "NODE_ENV=development BABEL_ENV=development webpack serve -c ./webpack.component.config.js", "build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js", - "heroku-postbuild": "PUBLIC_URL='' NODE_ENV=production BABEL_ENV=production yarn run build && yarn run build:wc" + "heroku-postbuild": "export PUBLIC_URL='' && yarn build && yarn build:wc" }, "eslintConfig": { "extends": [