@fishawack/lab-env 1.12.1 → 1.16.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 +17 -0
- package/cli.js +3 -0
- package/core/{0.0.19 → 0.0.20}/Dockerfile +8 -0
- package/core/{0.0.19 → 0.0.20}/entrypoint.sh +0 -0
- package/core/docker-compose-dev.yml +5 -0
- package/core/{0.0.19/docker-compose.yml → docker-compose.yml} +2 -4
- package/core/package.json +10 -0
- package/drupal/9/docker-compose.yml +1 -1
- package/globals.js +24 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.16.0 (2022-01-25)
|
|
4
|
+
* [Feature] lab-env now checks if docker process is running. Only `origin` and `--version` commands allowed if not
|
|
5
|
+
|
|
6
|
+
### 1.15.0 (2022-01-17)
|
|
7
|
+
* [Feature] Docker images are now pulled from docker hub if lab-env not running with devDependencies installed
|
|
8
|
+
* [Feature] Added a package.json to the core package in lab-env for more streamlined docker hub publishes
|
|
9
|
+
* [Change] Core image path now defined by new $DIRNAME variable
|
|
10
|
+
* [Change] Ignore fixtures in tests folder as they're cloned repos
|
|
11
|
+
|
|
12
|
+
### 1.14.0 (2021-12-03)
|
|
13
|
+
* [Change] Bumped core `0.0.19` to `0.0.20`
|
|
14
|
+
|
|
15
|
+
### 1.13.0 (2021-12-03)
|
|
16
|
+
* [Feature] Installed elastic beanstalk cli into the core image
|
|
17
|
+
* [Feature] Core image now mounts the .aws folder
|
|
18
|
+
* [Change] Switched mysql to 8.0.23 for Drupal builds
|
|
19
|
+
|
|
3
20
|
### 1.12.1 (2021-11-26)
|
|
4
21
|
* [Bug] Pass along errors thrown in new _.up function so commands correctly come to a stop when errors are thrown
|
|
5
22
|
|
package/cli.js
CHANGED
|
@@ -15,6 +15,9 @@ const { hideBin } = require('yargs/helpers');
|
|
|
15
15
|
|
|
16
16
|
const args = hideBin(process.argv);
|
|
17
17
|
|
|
18
|
+
// Stop here if docker process not running and command isn't version or origin which don't require docker
|
|
19
|
+
if(!_.services && !(args[0] === 'origin' || args[0] === '--version')) return;
|
|
20
|
+
|
|
18
21
|
(async () => {
|
|
19
22
|
process.env.REPO = _.repo;
|
|
20
23
|
|
|
@@ -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
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
version: "3.8"
|
|
2
2
|
services:
|
|
3
3
|
core:
|
|
4
|
-
|
|
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
|
+
}
|
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,35 +52,48 @@ 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
|
|
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
|
|
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
|
|
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
|
|
82
|
+
docker = `docker-compose ${core} -p ${repo}`;
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
try{
|
|
86
|
+
services = execSync(`${docker} ps --services --filter "status=running" 2>/dev/null`, {encoding: 'utf8'});
|
|
87
|
+
running = services.trim().length;
|
|
88
|
+
exec = `exec ${process.env.CI_BUILD_ID ? '-T' : ''}`;
|
|
89
|
+
method = running ? exec : 'run --rm --service-ports';
|
|
90
|
+
run = `${method} core bash -l`;
|
|
91
|
+
} catch(e){
|
|
92
|
+
console.log("Docker does not appear to be running...");
|
|
93
|
+
}
|
|
80
94
|
|
|
81
95
|
module.exports = {
|
|
96
|
+
services,
|
|
82
97
|
platform,
|
|
83
98
|
repo,
|
|
84
99
|
repo_safe: repo.replace(/\./g, ''),
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.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"
|