From 18a8c0801379ddc808ddfcf9329722a856c5acda Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 11:59:14 -0400 Subject: [PATCH 01/19] Added some custom configurations for Elastic Beanstalk --- .ebextensions/02_nodecommand.config | 4 ++++ .gitignore | 6 ++++++ .npmrc | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 .ebextensions/02_nodecommand.config create mode 100644 .npmrc diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config new file mode 100644 index 0000000..e4c9f0a --- /dev/null +++ b/.ebextensions/02_nodecommand.config @@ -0,0 +1,4 @@ +# 02_nodecommand.config +option_settings: + aws:elasticbeanstalk:container:nodejs: + NodeCommand: "npm run start:prod" \ No newline at end of file diff --git a/.gitignore b/.gitignore index ed072b6..9f1cbe5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,9 @@ lib-cov *.out *.pid package-lock.json + +# Elastic Beanstalk Files +.elasticbeanstalk/* +!.elasticbeanstalk/*.cfg.yml +!.elasticbeanstalk/*.global.yml +.ebextensions/01_envvar.config diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..f380845 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +# Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm@5 +unsafe-perm=true \ No newline at end of file From 10663fc21b5f333135bcefd94e11a2152e27447c Mon Sep 17 00:00:00 2001 From: Theodore Kluge Date: Mon, 8 Apr 2019 13:17:37 -0400 Subject: [PATCH 02/19] nom start --- .ebextensions/02_nodecommand.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index e4c9f0a..4cd2dc4 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config option_settings: aws:elasticbeanstalk:container:nodejs: - NodeCommand: "npm run start:prod" \ No newline at end of file + NodeCommand: "npm start" From fb8bb12ce1c0adf1a0ae68fbd2ff8834923281d2 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:05:16 -0400 Subject: [PATCH 03/19] Add start:eb script to package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 8e33ae8..16dc206 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "start:debug": "npm-run-all --parallel open:client debug", "start:prod": "npm-run-all --parallel build:prod lift", "start:client": "webpack-dev-server --mode development", + "start:eb": "npm run db:migrate && npm run build && npm start" "lift": "sails lift", "build": "npm run build:prod", "build:dev": "webpack --mode development", From 7b28690599462452d4fe005d775db74f026dc8ff Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:06:36 -0400 Subject: [PATCH 04/19] changed node command to run on eb --- .ebextensions/02_nodecommand.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index 4cd2dc4..40c7b7e 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config option_settings: aws:elasticbeanstalk:container:nodejs: - NodeCommand: "npm start" + NodeCommand: "npm start:eb" From 013c4ea43be8367303690646a16f6a3ec60c7492 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:09:54 -0400 Subject: [PATCH 05/19] fixed typo --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 16dc206..70766b3 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "start:debug": "npm-run-all --parallel open:client debug", "start:prod": "npm-run-all --parallel build:prod lift", "start:client": "webpack-dev-server --mode development", - "start:eb": "npm run db:migrate && npm run build && npm start" + "start:eb": "npm run db:migrate && npm run build && npm start", "lift": "sails lift", "build": "npm run build:prod", "build:dev": "webpack --mode development", From 2a00b7142366bd7021608981ff4439fda9529499 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:22:58 -0400 Subject: [PATCH 06/19] changed node command --- .ebextensions/02_nodecommand.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index 40c7b7e..c1cc08a 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config option_settings: aws:elasticbeanstalk:container:nodejs: - NodeCommand: "npm start:eb" + NodeCommand: npm run start:eb From ae7fa6e603c84776096b02aa82c76bb49a20641f Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:32:50 -0400 Subject: [PATCH 07/19] Added webpack to dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 70766b3..e59e945 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,8 @@ "sails-postgresql": "^1.0.2", "showdown": "^1.9.0", "ta-json-x": "^2.5.0", + "webpack": "^4.23.1", + "webpack-cli": "^3.1.2", "xmldom": "^0.1.27" }, "devDependencies": { @@ -77,8 +79,6 @@ "sass-loader": "^7.1.0", "standard": "^12.0.1", "style-loader": "^0.23.1", - "webpack": "^4.23.1", - "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" }, "main": "app.js", From 1631caa39cccb493dfc1ccbcba19f0a0ead0a3f1 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:39:37 -0400 Subject: [PATCH 08/19] moved devdependencies to dependencies --- package.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e59e945..ba0558a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "start:debug": "npm-run-all --parallel open:client debug", "start:prod": "npm-run-all --parallel build:prod lift", "start:client": "webpack-dev-server --mode development", - "start:eb": "npm run db:migrate && npm run build && npm start", + "start:eb": "npm run db:migrate && npm run build && npm start", "lift": "sails lift", "build": "npm run build:prod", "build:dev": "webpack --mode development", @@ -55,11 +55,9 @@ "sails-postgresql": "^1.0.2", "showdown": "^1.9.0", "ta-json-x": "^2.5.0", - "webpack": "^4.23.1", + "webpack": "^4.23.1", "webpack-cli": "^3.1.2", - "xmldom": "^0.1.27" - }, - "devDependencies": { + "xmldom": "^0.1.27", "@babel/core": "^7.1.2", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/polyfill": "^7.0.0", From 21a31f4bcdd47ac27264eb94421fafc618f33eae Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 15:56:18 -0400 Subject: [PATCH 09/19] Added config to allow sudo commands without tty/password --- .ebextensions/01_enableroot.config | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .ebextensions/01_enableroot.config diff --git a/.ebextensions/01_enableroot.config b/.ebextensions/01_enableroot.config new file mode 100644 index 0000000..5296f84 --- /dev/null +++ b/.ebextensions/01_enableroot.config @@ -0,0 +1,3 @@ +container_commands: + 001-enableroot: + command: echo Defaults:root \!requiretty >> /etc/sudoers \ No newline at end of file From f8977b874be8cd46716796d3ca72890b9c9597a8 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Mon, 8 Apr 2019 16:18:26 -0400 Subject: [PATCH 10/19] Attempting different configs --- .ebextensions/02_nodecommand.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index c1cc08a..17f2aa0 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config option_settings: aws:elasticbeanstalk:container:nodejs: - NodeCommand: npm run start:eb + NodeCommand: npm start From 3155ace139c4d3777968bdefc27573e15ee83243 Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Tue, 9 Apr 2019 17:57:23 -0400 Subject: [PATCH 11/19] Changing configs, ec2 is unresponsive after deployment --- .ebextensions/02_nodecommand.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index 17f2aa0..c1cc08a 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config option_settings: aws:elasticbeanstalk:container:nodejs: - NodeCommand: npm start + NodeCommand: npm run start:eb From aec66f1b651d7b8ae5c8f10cfbc15beec887cfdc Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Tue, 9 Apr 2019 18:18:38 -0400 Subject: [PATCH 12/19] Changing production port to 8081 --- config/env/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/env/production.js b/config/env/production.js index a70e4aa..18f6c02 100644 --- a/config/env/production.js +++ b/config/env/production.js @@ -318,7 +318,7 @@ module.exports = { * this, just try deploying without setting it and see if it works.) * * * ***************************************************************************/ - port: 80, + port: 8081, /************************************************************************** * * From 44980761a735bea6febde1217b3db247e6c751eb Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Tue, 9 Apr 2019 18:24:22 -0400 Subject: [PATCH 13/19] Removed sudo from run forever command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba0558a..9802f3b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build:dev": "webpack --mode development", "build:prod": "webpack --mode production", "clean": "rimraf .tmp && mkdirp .tmp/public", - "forever": "sudo ./node_modules/.bin/pm2 start ecosystem.config.js --env production", + "forever": "./node_modules/.bin/pm2 start ecosystem.config.js --env production", "stop": "sudo ./node_modules/.bin/pm2 delete roe-base", "test": "npm run lint && npm run custom-tests && echo 'Done.'", "lint": "standard && echo '✔ Your .js files look good.'", From 59e0b97a9bf44dda4f6c8923ac238a49aa88ba2a Mon Sep 17 00:00:00 2001 From: Dominik Michno Date: Sun, 14 Apr 2019 17:10:21 -0400 Subject: [PATCH 14/19] Readded sudo to npm run forever --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9802f3b..ba0558a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build:dev": "webpack --mode development", "build:prod": "webpack --mode production", "clean": "rimraf .tmp && mkdirp .tmp/public", - "forever": "./node_modules/.bin/pm2 start ecosystem.config.js --env production", + "forever": "sudo ./node_modules/.bin/pm2 start ecosystem.config.js --env production", "stop": "sudo ./node_modules/.bin/pm2 delete roe-base", "test": "npm run lint && npm run custom-tests && echo 'Done.'", "lint": "standard && echo '✔ Your .js files look good.'", From 567ee1b35d4a5a3eda744822c43b7fb5f8f7bfd6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Apr 2019 20:09:41 -0400 Subject: [PATCH 15/19] try removing ebext commands --- .ebextensions/01_enableroot.config | 6 +++--- .ebextensions/02_nodecommand.config | 6 +++--- package.json | 19 +++++++++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.ebextensions/01_enableroot.config b/.ebextensions/01_enableroot.config index 5296f84..5a4b314 100644 --- a/.ebextensions/01_enableroot.config +++ b/.ebextensions/01_enableroot.config @@ -1,3 +1,3 @@ -container_commands: - 001-enableroot: - command: echo Defaults:root \!requiretty >> /etc/sudoers \ No newline at end of file +#container_commands: +# 001-enableroot: +# command: echo Defaults:root \!requiretty >> /etc/sudoers diff --git a/.ebextensions/02_nodecommand.config b/.ebextensions/02_nodecommand.config index c1cc08a..ff3bb99 100644 --- a/.ebextensions/02_nodecommand.config +++ b/.ebextensions/02_nodecommand.config @@ -1,4 +1,4 @@ # 02_nodecommand.config -option_settings: - aws:elasticbeanstalk:container:nodejs: - NodeCommand: npm run start:eb +# option_settings: +# aws:elasticbeanstalk:container:nodejs: +# NodeCommand: npm run start:eb diff --git a/package.json b/package.json index ba0558a..bad0e05 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "roe-base", "private": true, - "version": "0.0.0", + "version": "0.0.1", "description": "a Sails application", "keywords": [], "scripts": { @@ -10,7 +10,7 @@ "start:debug": "npm-run-all --parallel open:client debug", "start:prod": "npm-run-all --parallel build:prod lift", "start:client": "webpack-dev-server --mode development", - "start:eb": "npm run db:migrate && npm run build && npm start", + "start:eb": "npm run db:migrate && npm run build:prod && npm run forever", "lift": "sails lift", "build": "npm run build:prod", "build:dev": "webpack --mode development", @@ -103,5 +103,20 @@ "mocha" ], "parser": "babel-eslint" + }, + "babel": { + "presets": [ + [ + "@babel/preset-env", + { + "useBuiltIns": "usage", + "corejs": 2 + } + ], + "@babel/preset-react" + ], + "plugins": [ + "@babel/plugin-proposal-object-rest-spread" + ] } } From f963758a4b385cfc49365eed91f6cc542690f967 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Apr 2019 20:40:36 -0400 Subject: [PATCH 16/19] link node and npm to path --- .ebextensions/01_enableroot.config | 3 --- .ebextensions/01_node_bin.config | 3 +++ package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 .ebextensions/01_enableroot.config create mode 100644 .ebextensions/01_node_bin.config diff --git a/.ebextensions/01_enableroot.config b/.ebextensions/01_enableroot.config deleted file mode 100644 index 5a4b314..0000000 --- a/.ebextensions/01_enableroot.config +++ /dev/null @@ -1,3 +0,0 @@ -#container_commands: -# 001-enableroot: -# command: echo Defaults:root \!requiretty >> /etc/sudoers diff --git a/.ebextensions/01_node_bin.config b/.ebextensions/01_node_bin.config new file mode 100644 index 0000000..a44295e --- /dev/null +++ b/.ebextensions/01_node_bin.config @@ -0,0 +1,3 @@ +container_commands: + 01_node_binary: + command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node" diff --git a/package.json b/package.json index bad0e05..1218b94 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "main": "app.js", "repository": { "type": "git", - "url": "git://github.com/vagrant/roe-base.git" + "url": "git://github.com/ebookfoundation/riverofebooks.git" }, "author": "vagrant", "license": "", From ae839b893b066e38e1543963cb9eb7b42080a7c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Apr 2019 20:51:23 -0400 Subject: [PATCH 17/19] babelrc is separate file --- .babelrc | 10 +++++++--- package.json | 15 --------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/.babelrc b/.babelrc index 09acf26..4f2e582 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,15 @@ { "presets": [ [ - "@babel/preset-env", { - "useBuiltIns": "usage" + "@babel/preset-env", + { + "useBuiltIns": "usage", + "corejs": 2 } ], "@babel/preset-react" ], - "plugins": ["@babel/plugin-proposal-object-rest-spread"], + "plugins": [ + "@babel/plugin-proposal-object-rest-spread" + ] } diff --git a/package.json b/package.json index 1218b94..a72f88b 100644 --- a/package.json +++ b/package.json @@ -103,20 +103,5 @@ "mocha" ], "parser": "babel-eslint" - }, - "babel": { - "presets": [ - [ - "@babel/preset-env", - { - "useBuiltIns": "usage", - "corejs": 2 - } - ], - "@babel/preset-react" - ], - "plugins": [ - "@babel/plugin-proposal-object-rest-spread" - ] } } From 3bd5f3a576766c777fe1cddf9c25164a09786e01 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Apr 2019 21:02:54 -0400 Subject: [PATCH 18/19] include npm --- .ebextensions/01_node_bin.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ebextensions/01_node_bin.config b/.ebextensions/01_node_bin.config index a44295e..1e44911 100644 --- a/.ebextensions/01_node_bin.config +++ b/.ebextensions/01_node_bin.config @@ -1,3 +1,5 @@ container_commands: 01_node_binary: command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node" + 02_npm_binary: + command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/npm /bin/npm" From 4c4b5b39d4224bfe47685cc8a218f50b27dde3e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Apr 2019 21:27:43 -0400 Subject: [PATCH 19/19] try regular lift --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a72f88b..795762c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "start:debug": "npm-run-all --parallel open:client debug", "start:prod": "npm-run-all --parallel build:prod lift", "start:client": "webpack-dev-server --mode development", - "start:eb": "npm run db:migrate && npm run build:prod && npm run forever", + "start:eb": "npm run db:migrate && npm run build:prod && npm run lift", "lift": "sails lift", "build": "npm run build:prod", "build:dev": "webpack --mode development",