@fishawack/lab-env 1.12.0 → 1.15.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,22 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.15.0 (2022-01-17)
4
+ * [Feature] Docker images are now pulled from docker hub if lab-env not running with devDependencies installed
5
+ * [Feature] Added a package.json to the core package in lab-env for more streamlined docker hub publishes
6
+ * [Change] Core image path now defined by new $DIRNAME variable
7
+ * [Change] Ignore fixtures in tests folder as they're cloned repos
8
+
9
+ ### 1.14.0 (2021-12-03)
10
+ * [Change] Bumped core `0.0.19` to `0.0.20`
11
+
12
+ ### 1.13.0 (2021-12-03)
13
+ * [Feature] Installed elastic beanstalk cli into the core image
14
+ * [Feature] Core image now mounts the .aws folder
15
+ * [Change] Switched mysql to 8.0.23 for Drupal builds
16
+
17
+ ### 1.12.1 (2021-11-26)
18
+ * [Bug] Pass along errors thrown in new _.up function so commands correctly come to a stop when errors are thrown
19
+
3
20
  ### 1.12.0 (2021-11-17)
4
21
  * [Feature] Test for watertight-node-auto access
5
22
  * [Feature] Test for multiple ssh keys
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\
File without changes
@@ -0,0 +1,5 @@
1
+ version: "3.8"
2
+ services:
3
+ core:
4
+ build:
5
+ context: $DIRNAME/core/${VERSION:-1.0.0}/
@@ -1,10 +1,7 @@
1
1
  version: "3.8"
2
2
  services:
3
3
  core:
4
- build:
5
- context: ../../core/${VERSION:-1.0.0}/
6
- dockerfile: Dockerfile
7
- image: core:${VERSION:-1.0.0}
4
+ image: fishawack/core:${VERSION:-1.0.0}
8
5
  init: true
9
6
  tty: true
10
7
  volumes:
@@ -12,6 +9,7 @@ services:
12
9
  - $HOME/.gitconfig:/root/.gitconfig
13
10
  - $HOME/targets:/root/targets
14
11
  - $HOME/.ssh:/root/.ssh
12
+ - $HOME/.aws:/root/.aws
15
13
  - node_modules:/app/node_modules
16
14
  ports:
17
15
  - ${PORT:-3000}:${PORT:-3000}
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "core",
3
+ "version": "0.0.20",
4
+ "description": "lab-env docker config for the @fishawack/core npm module",
5
+ "scripts": {
6
+ "postversion": "docker tag fishawack/core:$npm_package_version fishawack/core:latest && docker push fishawack/core:$npm_package_version fishawack/core:latest"
7
+ },
8
+ "author": "Mike Mellor",
9
+ "license": "ISC"
10
+ }
@@ -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
@@ -4,6 +4,8 @@ const { lstatSync, readdirSync, copyFileSync, existsSync } = require('fs');
4
4
  const semver = require('semver');
5
5
  const getPort = require('get-port');
6
6
 
7
+ process.env.DIRNAME = __dirname;
8
+
7
9
  const isDirectory = source => lstatSync(source).isDirectory();
8
10
  const getDirectories = source => readdirSync(source).map(name => path.join(source, name)).filter(isDirectory);
9
11
 
@@ -50,26 +52,34 @@ const version = pkg && pkg.devDependencies && (pkg.devDependencies['@fishawack/c
50
52
  process.env.VERSION = versions[0];
51
53
  // }
52
54
 
55
+ var core = `-f ${__dirname}/core/docker-compose.yml`;
56
+
57
+ // If dev dep installed, then assume running from npm linked local dev version of lab-env and point to build context rather than docker hub
58
+ try {
59
+ require('mocha');
60
+ core = `-f ${__dirname}/core/docker-compose-dev.yml ${core}`;
61
+ } catch(e) {}
62
+
53
63
  if(platform === 'laravel'){
54
64
  if(!existsSync(path.join(process.cwd(), '.env'))){
55
65
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
56
66
  }
57
67
 
58
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/laravel/8/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
68
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/laravel/8/docker-compose.yml ${core} -p ${repo}`;
59
69
  } else if(platform === 'wordpress'){
60
70
  if(!existsSync(path.join(process.cwd(), '.env'))){
61
71
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
62
72
  }
63
73
 
64
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/5.7.2/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
74
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/5.7.2/docker-compose.yml ${core} -p ${repo}`;
65
75
  } else if(platform === "drupal"){
66
76
  if(!existsSync(path.join(process.cwd(), '.env'))){
67
77
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
68
78
  }
69
79
 
70
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
80
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml ${core} -p ${repo}`;
71
81
  } else {
72
- docker = `docker-compose -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
82
+ docker = `docker-compose ${core} -p ${repo}`;
73
83
  }
74
84
 
75
85
  services = execSync(`${docker} ps --services --filter "status=running"`, {encoding: 'utf8'});
@@ -100,15 +110,21 @@ module.exports = {
100
110
  process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
101
111
  }
102
112
  } 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; }, {});
113
+ try{
114
+ let env = execSync(`${docker} exec -T core env`, {encoding: 'utf8'});
115
+ let ports = env.split('\n').reduce((obj, d) => { obj[d.split('=')[0]] = d.split('=')[1]; return obj; }, {});
105
116
 
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;
117
+ process.env.PORT = ports.PORT;
118
+ process.env.PORT_OPT = ports.PORT_OPT;
119
+
120
+ if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
121
+ process.env.PORT_WEB = ports.PORT_WEB;
122
+ process.env.PORT_DB = ports.PORT_DB;
123
+ }
124
+ } catch(e){
125
+ console.log(e.message);
126
+
127
+ process.exit(1);
112
128
  }
113
129
  }
114
130
  },
@@ -127,7 +143,7 @@ module.exports = {
127
143
  try{
128
144
  cb();
129
145
  } catch(e){
130
- if(err) err(e);
146
+ throw(e);
131
147
  } finally{
132
148
  if(!running) execSync(`lab-env down`, opts);
133
149
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "1.12.0",
3
+ "version": "1.15.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {
7
- "test": "mocha _Test/*.js --timeout 120s --bail",
7
+ "test": "rm -rf _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
8
8
  "preversion": "npm test",
9
9
  "postversion": "git push && git push --tags && npm publish",
10
10
  "postpublish": "git checkout development && git merge master && git push"