@fishawack/lab-env 1.11.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.14.0 (2021-12-03)
4
+ * [Change] Bumped core `0.0.19` to `0.0.20`
5
+
6
+ ### 1.13.0 (2021-12-03)
7
+ * [Feature] Installed elastic beanstalk cli into the core image
8
+ * [Feature] Core image now mounts the .aws folder
9
+ * [Change] Switched mysql to 8.0.23 for Drupal builds
10
+
11
+ ### 1.12.1 (2021-11-26)
12
+ * [Bug] Pass along errors thrown in new _.up function so commands correctly come to a stop when errors are thrown
13
+
14
+ ### 1.12.0 (2021-11-17)
15
+ * [Feature] Test for watertight-node-auto access
16
+ * [Feature] Test for multiple ssh keys
17
+
3
18
  ### 1.11.0 (2021-10-26)
4
19
  * [Feature] Show ports on up command if -v flag given
5
20
  * [Feature] Added compose command
@@ -44,6 +44,10 @@ module.exports = [
44
44
  while(!await test.egnyte() || !await egnyte.check()){
45
45
  await guide.egnyte();
46
46
  };
47
+
48
+ while(!await test.watertight()){
49
+ await guide.watertight();
50
+ }
47
51
 
48
52
  if(preset === "permanent"){
49
53
  while(!await test.misc()){
@@ -293,4 +293,20 @@ module.exports.key = async () => {
293
293
  } else {
294
294
  throw('');
295
295
  }
296
+ }
297
+
298
+ module.exports.watertight = async () => {
299
+ let inputs = await inquirer.prompt([
300
+ {
301
+ type: 'confirm',
302
+ name: 'confirm',
303
+ message: 'Re-run watertight check? (ensure your ssh key is uploaded to bitbucket)',
304
+ default: true
305
+ }
306
+ ]);
307
+
308
+ if(inputs.confirm){
309
+ } else {
310
+ throw('');
311
+ }
296
312
  }
@@ -1,8 +1,10 @@
1
1
  const os = require('os');
2
2
  const fs = require('fs');
3
+ const glob = require("glob");
3
4
 
4
5
  const utils = require('../libs/utilities');
5
6
  const vars = require('../libs/vars');
7
+ const { execSync, exec } = require('child_process');
6
8
 
7
9
  module.exports.targets = async () => {
8
10
  // Check targets folder exists
@@ -127,12 +129,31 @@ module.exports.ssh = async () => {
127
129
 
128
130
  module.exports.key = async () => {
129
131
  // Check misc.json exists
130
- let spinner = new utils.Spinner('Looking for id_rsa file in .ssh');
131
-
132
+ let spinner = new utils.Spinner('Looking for id_rsa key in .ssh');
133
+
132
134
  if (fs.existsSync(`${os.homedir()}/.ssh/id_rsa`)) {
133
- spinner.update('Found \'id_rsa\' file');
135
+ spinner.update('Found \'id_rsa\' key');
136
+ return true;
137
+ } else if (glob.sync(`${os.homedir()}/.ssh/**/*.pub`).length) {
138
+ spinner.update('Found multiple ssh keys');
134
139
  return true;
135
140
  } else {
136
- spinner.update('Could not find \'id_rsa\' file', 'fail');
141
+ spinner.update('Could not find \'id_rsa\' key', 'fail');
142
+ }
143
+ }
144
+
145
+ module.exports.watertight = async () => {
146
+ // Check misc.json exists
147
+ let spinner = new utils.Spinner('Testing access to watertight-node-auto repository');
148
+
149
+ try{
150
+ !await new Promise((resolve, reject) => exec('git clone --bare git@bitbucket.org:fishawackdigital/watertight-node-auto ./.tmp/watertight-node-auto', (error, stdout, stderr) => (error) ? reject(error) : resolve()));
151
+
152
+ spinner.update('Successfully accessed watertight-node-auto repository');
153
+ return true;
154
+ } catch(e){
155
+ spinner.update('Could not access watertight-node-auto repository', 'fail');
156
+ } finally{
157
+ execSync('rm -rf ./.tmp/watertight-node-auto', {stdio: 'pipe'});
137
158
  }
138
159
  }
package/commands/setup.js CHANGED
@@ -8,14 +8,7 @@ module.exports = [
8
8
  yargs => {},
9
9
  argv => {
10
10
  if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
11
- _.up(
12
- () => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts),
13
- e => {
14
- if(e.status !== 130 && e.status !== 131 && e.status !== 1){
15
- console.log(e.message);
16
- }
17
- }
18
- );
11
+ _.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts));
19
12
  } else {
20
13
  execSync(`${_.docker} ${_.run}c "npm run setup"`, _.opts);
21
14
  }
package/commands/start.js CHANGED
@@ -15,14 +15,7 @@ module.exports = [
15
15
  _.ports.get();
16
16
 
17
17
  if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
18
- _.up(
19
- () => execSync(`${_.docker} ${_.exec} core bash -lc "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts),
20
- e => {
21
- if(e.status !== 130 && e.status !== 131 && e.status !== 1){
22
- console.log(e);
23
- }
24
- }
25
- );
18
+ _.up(() => execSync(`${_.docker} ${_.exec} core bash -lc "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts));
26
19
  } else {
27
20
  execSync(`${_.docker} ${_.run}c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
28
21
  }
@@ -129,6 +129,13 @@ RUN apt-get install -y dos2unix
129
129
 
130
130
  RUN apt-get install -y locales
131
131
 
132
+ # Install AWS Elastic Beanstalk cli
133
+ RUN apt-get install -y zlib1g-dev libssl-dev libncurses-dev libffi-dev libsqlite3-dev libreadline-dev libbz2-dev
134
+
135
+ RUN git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
136
+ RUN ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
137
+ RUN rm -rf ./aws-elastic-beanstalk-cli-setup
138
+
132
139
  RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
133
140
  locale-gen
134
141
 
@@ -198,6 +205,7 @@ export gal="31.170.122.20"\n\
198
205
  export grunt="grunt --gruntfile node_modules/@fishawack/core/Gruntfile.js"\n\
199
206
  export gruntOld="grunt --gruntfile node_modules/@fishawack/config-grunt/Gruntfile.js"\n\
200
207
  export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\[\033[31m\]\$(parse_git_branch)\[\033[00m\]\$ "\n\
208
+ export PATH="/root/.ebcli-virtual-env/executables:$PATH"\n\
201
209
  alias ls="ls -l -GFh"\n\
202
210
  # Load in enviroment variables if they exist in the root of the project\n\
203
211
  if [ -f ./env.sh ]; then . ./env.sh; fi\n\
@@ -12,6 +12,7 @@ services:
12
12
  - $HOME/.gitconfig:/root/.gitconfig
13
13
  - $HOME/targets:/root/targets
14
14
  - $HOME/.ssh:/root/.ssh
15
+ - $HOME/.aws:/root/.aws
15
16
  - node_modules:/app/node_modules
16
17
  ports:
17
18
  - ${PORT:-3000}:${PORT:-3000}
File without changes
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  mysql:
3
- image: mysql:8.0.12
3
+ image: mysql:8.0.23
4
4
  networks:
5
5
  - default
6
6
  environment:
package/globals.js CHANGED
@@ -100,15 +100,21 @@ module.exports = {
100
100
  process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
101
101
  }
102
102
  } else {
103
- let env = execSync(`${docker} exec -T core env`, {encoding: 'utf8'});
104
- let ports = env.split('\n').reduce((obj, d) => { obj[d.split('=')[0]] = d.split('=')[1]; return obj; }, {});
103
+ try{
104
+ let env = execSync(`${docker} exec -T core env`, {encoding: 'utf8'});
105
+ let ports = env.split('\n').reduce((obj, d) => { obj[d.split('=')[0]] = d.split('=')[1]; return obj; }, {});
105
106
 
106
- process.env.PORT = ports.PORT;
107
- process.env.PORT_OPT = ports.PORT_OPT;
108
-
109
- if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
110
- process.env.PORT_WEB = ports.PORT_WEB;
111
- process.env.PORT_DB = ports.PORT_DB;
107
+ process.env.PORT = ports.PORT;
108
+ process.env.PORT_OPT = ports.PORT_OPT;
109
+
110
+ if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
111
+ process.env.PORT_WEB = ports.PORT_WEB;
112
+ process.env.PORT_DB = ports.PORT_DB;
113
+ }
114
+ } catch(e){
115
+ console.log(e.message);
116
+
117
+ process.exit(1);
112
118
  }
113
119
  }
114
120
  },
@@ -127,7 +133,7 @@ module.exports = {
127
133
  try{
128
134
  cb();
129
135
  } catch(e){
130
- if(err) err(e);
136
+ throw(e);
131
137
  } finally{
132
138
  if(!running) execSync(`lab-env down`, opts);
133
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "1.11.0",
3
+ "version": "1.14.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {
@@ -24,6 +24,7 @@
24
24
  "axios": "0.21.1",
25
25
  "chalk": "4.1.0",
26
26
  "get-port": "5.1.1",
27
+ "glob": "7.1.7",
27
28
  "inquirer": "8.1.2",
28
29
  "ora": "5.4.1",
29
30
  "semver": "7.3.4",