@fishawack/lab-env 4.9.0 → 4.11.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 +28 -0
- package/_Test/_fixtures/core@0/_Build/config/level-0.json +4 -0
- package/_Test/_fixtures/core@0/package.json +7 -0
- package/_Test/_fixtures/core@1/_Build/config/level-0.json +4 -0
- package/_Test/_fixtures/core@1/package.json +7 -0
- package/_Test/bash.js +74 -0
- package/_Test/check.js +29 -7
- package/cli.js +5 -1
- package/commands/check.js +1 -1
- package/commands/clean.js +1 -1
- package/commands/connect.js +14 -1
- package/commands/content.js +1 -1
- package/commands/create/libs/vars.js +11 -0
- package/commands/create/services/egnyte.js +13 -3
- package/commands/create/services/guide.js +15 -7
- package/commands/create/services/test.js +10 -2
- package/commands/deploy.js +1 -1
- package/commands/docker/build.js +1 -1
- package/commands/docker/mocha.js +1 -1
- package/commands/docker/volumes.js +1 -29
- package/commands/execute.js +9 -7
- package/commands/install.js +1 -1
- package/commands/npm.js +1 -1
- package/commands/nuke.js +1 -1
- package/commands/production.js +1 -1
- package/commands/regenerate.js +1 -1
- package/commands/reinstall.js +1 -1
- package/commands/run.js +5 -2
- package/commands/setup.js +1 -1
- package/commands/start.js +12 -2
- package/commands/test.js +9 -1
- package/commands/uninstall.js +1 -1
- package/commands/watch.js +1 -1
- package/core/{CHANGELOG.md → 0/CHANGELOG.md} +3 -0
- package/core/{0.2.0 → 0}/Dockerfile +1 -1
- package/core/0/docker-compose-dev.yml +5 -0
- package/core/{docker-compose.yml → 0/docker-compose.yml} +1 -1
- package/core/0/package.json +11 -0
- package/core/1/CHANGELOG.md +23 -0
- package/core/1/Dockerfile +101 -0
- package/core/1/docker-compose-dev.yml +6 -0
- package/core/1/docker-compose.yml +27 -0
- package/core/1/entrypoint.sh +21 -0
- package/core/1/package.json +11 -0
- package/globals.js +68 -20
- package/package.json +2 -2
- package/_Test/_fixtures/.gitkeep +0 -0
- package/core/docker-compose-dev.yml +0 -5
- package/core/package.json +0 -11
- /package/core/{0.2.0 → 0}/entrypoint.sh +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 4.11.0 (2023-02-24)
|
|
4
|
+
* [Feature] target now specified in core@1 so it defaults to alpine when building
|
|
5
|
+
* [Change] don't pass -l flag to core@1 connect
|
|
6
|
+
* [Change] dont pass -l login flag to core@1 commands so root $PATH isnt reset
|
|
7
|
+
* [Bug] set CI flag during tests to avoid non tty prompt
|
|
8
|
+
* [Bug] check for core in dependencies too
|
|
9
|
+
* [Bug] allow certain commands to pass through mismatch core
|
|
10
|
+
* [Bug] use full expaned $grunt alias so it isn't needed inside the image as ENV variable
|
|
11
|
+
* [Bug] only set user on connect during exec calls and not run calls
|
|
12
|
+
* [Bug] set -u node on core@1 exec commands
|
|
13
|
+
* [Bug] dont set -l flag on start and test core exec command unless on core@0
|
|
14
|
+
* [Bug] use $DIRNAME on dev build contexts as codebases that use core as partial context for compose file have PWD elsewhere
|
|
15
|
+
* [Bug] commands that automatically prefixed xvfb-run now only do in on core@0
|
|
16
|
+
* [Bug] xvfb-run automated prefix is now only applied to core@0 commands
|
|
17
|
+
|
|
18
|
+
### 4.10.0 (2023-02-21)
|
|
19
|
+
* [Feature] Created core@1 image for @fishawack/core projects >= 8
|
|
20
|
+
* [Feature] New env variables for changing lab-env behaviour, FW_DEV, FW_NEXT, FW_FULL, FW_ROOT
|
|
21
|
+
* [Feature] lab-env now has a latest known version of the core that if a project exceeds will cause an error
|
|
22
|
+
* [Feature] New diagnose prompt for egnyte credentials in new location
|
|
23
|
+
* [Change] Nuke no longer internally calls volumes command but pulls them from globals as an export
|
|
24
|
+
* [Change] --display flag only available on core@0
|
|
25
|
+
* [Change] Bumped core `0.2.0` to `0.2.1`
|
|
26
|
+
* [Change] Core images now lock version into image with environment variables
|
|
27
|
+
* [Change] Bumped diagnose version
|
|
28
|
+
* [Change] Build commands now use --ssh flag to mount live agent
|
|
29
|
+
* [Bug] Put fix in core@0 for sed issue on new Virtio file mounting mode that was modifying package.json file permissions or creating a temp file
|
|
30
|
+
|
|
3
31
|
### 4.9.0 (2023-01-26)
|
|
4
32
|
* [Feature] Added newly setup AWS accounts to the client prompts on `fw provision`
|
|
5
33
|
|
package/_Test/bash.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const expect = require('chai').expect;
|
|
4
|
+
const execSync = require('child_process').execSync;
|
|
5
|
+
|
|
6
|
+
describe('bash', () => {
|
|
7
|
+
describe('core@0', () => {
|
|
8
|
+
const repo = `core@0`;
|
|
9
|
+
const cwd = {cwd: `_Test/_fixtures/${repo}`};
|
|
10
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: cwd.cwd};
|
|
11
|
+
|
|
12
|
+
describe('run', () => {
|
|
13
|
+
it(`Should show correct user when executing commands`, () => {
|
|
14
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('root');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
18
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain('ebcli-virtual-env');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('exec', () => {
|
|
23
|
+
before(() => {
|
|
24
|
+
execSync('node ../../../cli.js up -d', opts);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it(`Should show correct user when executing commands`, () => {
|
|
28
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('root');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
32
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain('ebcli-virtual-env');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
after(() => {
|
|
36
|
+
execSync('node ../../../cli.js down', opts);
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('core@1', () => {
|
|
42
|
+
const repo = `core@1`;
|
|
43
|
+
const cwd = {cwd: `_Test/_fixtures/${repo}`};
|
|
44
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: cwd.cwd};
|
|
45
|
+
|
|
46
|
+
describe('run', () => {
|
|
47
|
+
it(`Should show correct user when executing commands`, () => {
|
|
48
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('node');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
52
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain(':/dart-sass/');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('exec', () => {
|
|
57
|
+
before(() => {
|
|
58
|
+
execSync('node ../../../cli.js up -d', opts);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it(`Should show correct user when executing commands`, () => {
|
|
62
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('node');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
66
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain(':/dart-sass/');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
after(() => {
|
|
70
|
+
execSync('node ../../../cli.js down', opts);
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
package/_Test/check.js
CHANGED
|
@@ -7,22 +7,44 @@ const expect = require('chai').expect;
|
|
|
7
7
|
const execSync = require('child_process').execSync;
|
|
8
8
|
|
|
9
9
|
describe('check', () => {
|
|
10
|
+
let output;
|
|
11
|
+
|
|
10
12
|
before(function(){
|
|
11
|
-
execSync(`mkdir _Test/_fixtures/${repo} && cd _Test/_fixtures/${repo} && npm init -y`, {encoding: 'utf8', stdio: 'inherit'});
|
|
13
|
+
execSync(`mkdir _Test/_fixtures/${repo} && cd _Test/_fixtures/${repo} && npm init -y &>/dev/null && git init &>/dev/null`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
|
+
|
|
15
|
+
execSync('node ../../../cli.js install lodash@4.17.15 query-string@7.1.1 --force && git add . && git commit -m "feat: initial commit"', opts);
|
|
12
16
|
|
|
13
|
-
execSync('node ../../../cli.js
|
|
17
|
+
output = execSync('node ../../../cli.js check --force', {cwd: `_Test/_fixtures/${repo}`}).toString();
|
|
14
18
|
});
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
describe('are-you-es5', () => {
|
|
21
|
+
it(`Should flag non es5 dependencies`, () => {
|
|
22
|
+
expect(output).to.contain('Npm-ES5 incompatibilities detected');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it(`Should flag query-string as non es5 dependency`, () => {
|
|
26
|
+
expect(output).to.contain('query-string');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it(`Should not flag lodash as es5 dependency`, () => {
|
|
30
|
+
expect(output).to.not.contain('lodash');
|
|
31
|
+
});
|
|
18
32
|
});
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
describe('check-dependencies', () => {
|
|
35
|
+
it(`Should flag no missing dependencies`, () => {
|
|
36
|
+
expect(output).to.contain('Npm deps OK');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it(`Should flag missing dependencies`, () => {
|
|
40
|
+
execSync('node ../../../cli.js nuke --force', opts);
|
|
41
|
+
|
|
42
|
+
expect(execSync('node ../../../cli.js check --force', {cwd: `_Test/_fixtures/${repo}`}).toString()).to.contain('Npm deps missing or outdated');
|
|
43
|
+
});
|
|
22
44
|
});
|
|
23
45
|
|
|
24
46
|
after(() => {
|
|
25
|
-
execSync('node ../../../cli.js nuke', opts)
|
|
47
|
+
execSync('node ../../../cli.js nuke --force', opts);
|
|
26
48
|
|
|
27
49
|
execSync(`rm -rf _Test/_fixtures/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
28
50
|
});
|
package/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ const args = hideBin(process.argv);
|
|
|
14
14
|
(async () => {
|
|
15
15
|
const updateNotifier = (await import('update-notifier')).default;
|
|
16
16
|
const pkg = require('./package.json');
|
|
17
|
-
updateNotifier({pkg, updateCheckInterval: 0}).notify();
|
|
17
|
+
updateNotifier({pkg, updateCheckInterval: 0}).notify({isGlobal: true});
|
|
18
18
|
|
|
19
19
|
process.env.REPO = _.repo;
|
|
20
20
|
|
|
@@ -29,6 +29,10 @@ const args = hideBin(process.argv);
|
|
|
29
29
|
.option('debug', {
|
|
30
30
|
global: true,
|
|
31
31
|
description: `Show extra information to help debug issues`
|
|
32
|
+
})
|
|
33
|
+
.option('force', {
|
|
34
|
+
global: true,
|
|
35
|
+
description: `Continue past standard failure points (use at your own risk)`
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
// Repo commands
|
package/commands/check.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = [
|
|
|
13
13
|
});
|
|
14
14
|
},
|
|
15
15
|
argv => {
|
|
16
|
-
execSync(`${_.docker} ${_.run}c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; } && are-you-es5 check . && echo -e '\\033[0;32mNpm-ES5 compatibility OK\\033[0m' || { echo -e '\\033[0;31mNpm-ES5 incompatibilities detected\\033[0m'; }"`, _.opts);
|
|
16
|
+
execSync(`${_.docker} ${_.run} -c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; } && are-you-es5 check . && echo -e '\\033[0;32mNpm-ES5 compatibility OK\\033[0m' || { echo -e '\\033[0;31mNpm-ES5 incompatibilities detected\\033[0m'; }"`, _.opts);
|
|
17
17
|
|
|
18
18
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
19
19
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install --dry-run ${argv.v ? '' : '2>&1'} | grep -q 'Nothing to install, update or remove' && echo -e '\\033[0;32mComposer deps OK\\033[0m' || echo -e '\\033[0;31mComposer deps missing or outdated\\033[0m'"`, _.opts);
|
package/commands/clean.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'cleans out dependencies',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "git clean -xfd vendor/ 2>/dev/null || true"`, _.opts);
|
package/commands/connect.js
CHANGED
|
@@ -11,5 +11,18 @@ module.exports = [
|
|
|
11
11
|
default: 'core'
|
|
12
12
|
});
|
|
13
13
|
},
|
|
14
|
-
argv =>
|
|
14
|
+
argv => {
|
|
15
|
+
let run = ' -l';
|
|
16
|
+
let user = '';
|
|
17
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
18
|
+
if(argv.container === "core" && process.env.VERSION === "1"){
|
|
19
|
+
run = '';
|
|
20
|
+
|
|
21
|
+
if(_.running){
|
|
22
|
+
user = ' -u node';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
execSync(`${_.docker} ${_.method}${user} ${argv.container} bash${run}`, _.opts);
|
|
27
|
+
}
|
|
15
28
|
];
|
package/commands/content.js
CHANGED
|
@@ -28,6 +28,17 @@ try{
|
|
|
28
28
|
// ftppass
|
|
29
29
|
module.exports.ftppass = ftppassFile;
|
|
30
30
|
|
|
31
|
+
var creds = {};
|
|
32
|
+
|
|
33
|
+
try{
|
|
34
|
+
creds.egnyte = JSON.parse(fs.readFileSync(path.join(os.homedir(), 'targets', 'ftp-fishawack.egnyte.com.json'), { encoding: 'utf8' }));
|
|
35
|
+
} catch(e){
|
|
36
|
+
creds.egnyte = {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Credentials
|
|
40
|
+
module.exports.creds = creds;
|
|
41
|
+
|
|
31
42
|
// APIs
|
|
32
43
|
const bitbucketApi = module.exports.bitbucketApi = 'https://api.bitbucket.org/2.0/repositories';
|
|
33
44
|
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
const api = require('./api');
|
|
2
1
|
const { Spinner } = require('../libs/utilities');
|
|
3
|
-
const { ftppass } = require('../libs/vars');
|
|
2
|
+
const { ftppass, creds } = require('../libs/vars');
|
|
4
3
|
const { exec } = require("child_process");
|
|
5
4
|
|
|
6
5
|
module.exports.check = async () => {
|
|
6
|
+
try {
|
|
7
|
+
await module.exports.request(creds.egnyte.username, creds.egnyte.password, creds.egnyte.host);
|
|
8
|
+
await module.exports.request(ftppass['ftp-fishawack.egnyte.com'].username, ftppass['ftp-fishawack.egnyte.com'].password, 'ftp-fishawack.egnyte.com');
|
|
9
|
+
|
|
10
|
+
return true;
|
|
11
|
+
} catch(error) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports.request = async (username, password, host) => {
|
|
7
17
|
let spinner = new Spinner(`Communicating with Egnyte`);
|
|
8
18
|
|
|
9
19
|
try {
|
|
10
20
|
if (!await new Promise((resolve, reject) => {
|
|
11
|
-
exec(`curl -I -k --ftp-ssl --ftp-pasv -u "${
|
|
21
|
+
exec(`curl -I -k --ftp-ssl --ftp-pasv -u "${username.replace('$', '\\$')}:${password}" ftp://${host}`, (error, stdout, stderr) => {
|
|
12
22
|
if(error){
|
|
13
23
|
reject(error);
|
|
14
24
|
return;
|
|
@@ -2,7 +2,7 @@ const inquirer = require('inquirer');
|
|
|
2
2
|
const { homedir } = require('os');
|
|
3
3
|
const { mkdirSync, writeFileSync, readFileSync } = require("fs");
|
|
4
4
|
const { encode } = require('../libs/utilities');
|
|
5
|
-
const { urls, apis, misc:
|
|
5
|
+
const { urls, apis, misc: creds_misc, bitbucketApi, headers, ftppass: creds_ftppass, creds } = require('../libs/vars');
|
|
6
6
|
const { execSync } = require('child_process');
|
|
7
7
|
|
|
8
8
|
module.exports.targets = async () => {
|
|
@@ -55,13 +55,13 @@ module.exports.bitbucket = async () => {
|
|
|
55
55
|
type: 'input',
|
|
56
56
|
name: 'username',
|
|
57
57
|
message: 'What is your bitbucket username? (e.g. mmellor)',
|
|
58
|
-
default:
|
|
58
|
+
default: creds_misc.bitbucket && creds_misc.bitbucket.username,
|
|
59
59
|
validate: input => input.trim().length > 0 || 'Username cannot be an empty string'
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
type: 'password',
|
|
63
63
|
name: 'password',
|
|
64
|
-
default:
|
|
64
|
+
default: creds_misc.bitbucket && creds_misc.bitbucket.password,
|
|
65
65
|
message: 'What is your bitbucket password? (e.g. password1234)',
|
|
66
66
|
validate: input => input.trim().length > 0 || 'Password cannot be an empty string'
|
|
67
67
|
},
|
|
@@ -75,7 +75,7 @@ module.exports.bitbucket = async () => {
|
|
|
75
75
|
|
|
76
76
|
let file = JSON.parse(readFileSync(`${homedir()}/targets/misc.json`, { encoding: 'utf8' }));
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
creds_misc.bitbucket = file.bitbucket = {...inputs};
|
|
79
79
|
apis.bbWorkspaceAPI = `${bitbucketApi}/${inputs.workspace}`;
|
|
80
80
|
headers.bbHeaders = encode(inputs.username, inputs.password);
|
|
81
81
|
urls.bitbucketSSH = `git@bitbucket.org:${inputs.workspace}`;
|
|
@@ -102,7 +102,7 @@ module.exports.gitlab = async () => {
|
|
|
102
102
|
type: 'password',
|
|
103
103
|
name: 'token',
|
|
104
104
|
message: 'What is your gitlab token? (e.g. puhQmpZGooQyLCa5LhTg)',
|
|
105
|
-
default:
|
|
105
|
+
default: creds_misc.gitlab && creds_misc.gitlab.token || null,
|
|
106
106
|
validate: input => input.trim().length > 0 || 'Password cannot be an empty string'
|
|
107
107
|
},
|
|
108
108
|
{
|
|
@@ -115,7 +115,7 @@ module.exports.gitlab = async () => {
|
|
|
115
115
|
|
|
116
116
|
let file = JSON.parse(readFileSync(`${homedir()}/targets/misc.json`, { encoding: 'utf8' }));
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
creds_misc.gitlab = file.gitlab = {...inputs};
|
|
119
119
|
|
|
120
120
|
writeFileSync(`${homedir()}/targets/misc.json`, JSON.stringify(file, null, 4));
|
|
121
121
|
} else {
|
|
@@ -165,14 +165,22 @@ module.exports.egnyte = async () => {
|
|
|
165
165
|
message: 'What is your egnyte password? (e.g. password1234)',
|
|
166
166
|
default: creds_ftppass['ftp-fishawack.egnyte.com'] && creds_ftppass['ftp-fishawack.egnyte.com'].password || null,
|
|
167
167
|
validate: input => input.trim().length > 0 || 'Password cannot be an empty string'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'host',
|
|
171
|
+
name: 'host',
|
|
172
|
+
message: 'What is your egnyte host? (e.g. ftp-fishawack.egnyte.com)',
|
|
173
|
+
default: creds.egnyte && creds.egnyte.host || "ftp-fishawack.egnyte.com",
|
|
174
|
+
validate: input => input.trim().length > 0 || 'Host cannot be an empty string'
|
|
168
175
|
}
|
|
169
176
|
]);
|
|
170
177
|
|
|
171
178
|
let file = JSON.parse(readFileSync(`${homedir()}/targets/.ftppass`, { encoding: 'utf8' }));
|
|
172
179
|
|
|
173
|
-
creds_ftppass['ftp-fishawack.egnyte.com'] = file['ftp-fishawack.egnyte.com'] = {...inputs};
|
|
180
|
+
creds.egnyte = creds_ftppass['ftp-fishawack.egnyte.com'] = file['ftp-fishawack.egnyte.com'] = {...inputs};
|
|
174
181
|
|
|
175
182
|
writeFileSync(`${homedir()}/targets/.ftppass`, JSON.stringify(file, null, 4));
|
|
183
|
+
writeFileSync(`${homedir()}/targets/${creds.egnyte.host}.json`, JSON.stringify({...creds.egnyte, passphrase: ''}, null, 4));
|
|
176
184
|
} else {
|
|
177
185
|
throw('');
|
|
178
186
|
}
|
|
@@ -70,11 +70,19 @@ module.exports.egnyte = async () => {
|
|
|
70
70
|
// Check .ftppass has Egnyte credentials
|
|
71
71
|
let spinner = new utils.Spinner('Looking for Egnyte credentials');
|
|
72
72
|
|
|
73
|
-
if (
|
|
73
|
+
if (
|
|
74
|
+
vars.ftppass['ftp-fishawack.egnyte.com'] &&
|
|
75
|
+
vars.ftppass['ftp-fishawack.egnyte.com'].username &&
|
|
76
|
+
vars.ftppass['ftp-fishawack.egnyte.com'].password &&
|
|
77
|
+
vars.creds.egnyte &&
|
|
78
|
+
vars.creds.egnyte.username &&
|
|
79
|
+
vars.creds.egnyte.password &&
|
|
80
|
+
vars.creds.egnyte.host
|
|
81
|
+
) {
|
|
74
82
|
spinner.update('Found Egnyte credentials in \'.ftppass\'');
|
|
75
83
|
return true;
|
|
76
84
|
} else {
|
|
77
|
-
spinner.update('Couldn\'t find Egnyte credentials in \'.ftppass\'', 'fail');
|
|
85
|
+
spinner.update('Couldn\'t find Egnyte credentials either in \'ftp-fishawack.egnyte.com.json\' or \'.ftppass\' (legacy location)', 'fail');
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
|
package/commands/deploy.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = [
|
|
|
10
10
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/deploy.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
|
-
execSync(`${_.docker} ${_.run}c "xvfb-run npm run deploy"`, _.opts);
|
|
13
|
+
execSync(`${_.docker} ${_.run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run deploy"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
];
|
package/commands/docker/build.js
CHANGED
package/commands/docker/mocha.js
CHANGED
|
@@ -5,34 +5,6 @@ module.exports = [
|
|
|
5
5
|
false,
|
|
6
6
|
yargs => {},
|
|
7
7
|
argv => {
|
|
8
|
-
|
|
9
|
-
'node_modules'
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
|
-
volumes.push(
|
|
14
|
-
'mysql'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if(_.platform === "drupal"){
|
|
19
|
-
volumes.push(
|
|
20
|
-
'drupal'
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if(_.platform === "laravel"){
|
|
25
|
-
volumes.push(
|
|
26
|
-
'redis'
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
31
|
-
volumes.push(
|
|
32
|
-
'vendor'
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log(`${volumes.map(d => `${_.repo_safe}_${d}`).join('\n')}`);
|
|
8
|
+
console.log(`${_.volumes.join('\n')}`);
|
|
37
9
|
}
|
|
38
10
|
];
|
package/commands/execute.js
CHANGED
|
@@ -11,11 +11,13 @@ module.exports = [
|
|
|
11
11
|
default: 'ls'
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if(process.env.VERSION === "0"){
|
|
15
|
+
yargs.option('display', {
|
|
16
|
+
alias: 'd',
|
|
17
|
+
describe: 'Run with a virtual display',
|
|
18
|
+
type: 'boolean'
|
|
19
|
+
});
|
|
20
|
+
}
|
|
19
21
|
|
|
20
22
|
yargs.option('grunt', {
|
|
21
23
|
alias: 'g',
|
|
@@ -24,7 +26,7 @@ module.exports = [
|
|
|
24
26
|
});
|
|
25
27
|
},
|
|
26
28
|
argv => {
|
|
27
|
-
const prep = argv.g ? '
|
|
28
|
-
execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}${prep}${argv.command.join(prep)}"`, _.opts)
|
|
29
|
+
const prep = argv.g ? 'npx grunt --gruntfile node_modules/@fishawack/core/Gruntfile.js ' : ' ';
|
|
30
|
+
execSync(`${_.docker} ${_.run} -c "${argv.d ? 'xvfb-run ' : ''}${prep}${argv.command.join(prep)}"`, _.opts)
|
|
29
31
|
}
|
|
30
32
|
];
|
package/commands/install.js
CHANGED
package/commands/npm.js
CHANGED
package/commands/nuke.js
CHANGED
package/commands/production.js
CHANGED
|
@@ -6,5 +6,5 @@ module.exports = [
|
|
|
6
6
|
['production', 'prod'],
|
|
7
7
|
'builds for production',
|
|
8
8
|
yargs => {},
|
|
9
|
-
argv => execSync(`${_.docker} ${_.run}c "xvfb-run npm run production"`, _.opts)
|
|
9
|
+
argv => execSync(`${_.docker} ${_.run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run production"`, _.opts)
|
|
10
10
|
];
|
package/commands/regenerate.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'regenerates dependency lock files',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "rm composer.lock; git clean -xfd vendor/ 2>/dev/null || true; composer install"`, _.opts)
|
package/commands/reinstall.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'installs fresh dependencies',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "npm ci || npm i"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "npm ci || npm i"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install"`, _.opts);
|
package/commands/run.js
CHANGED
|
@@ -15,11 +15,14 @@ module.exports = [
|
|
|
15
15
|
describe: 'flags to pass',
|
|
16
16
|
default: ''
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
if(process.env.VERSION === "0"){
|
|
20
|
+
yargs.option('display', {
|
|
19
21
|
alias: 'd',
|
|
20
22
|
describe: 'Run with a virtual display',
|
|
21
23
|
type: 'boolean'
|
|
22
24
|
});
|
|
25
|
+
}
|
|
23
26
|
},
|
|
24
|
-
argv => execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}npm run ${argv.command} -- -- ${argv.flags.join(' ')}"`, _.opts)
|
|
27
|
+
argv => execSync(`${_.docker} ${_.run} -c "${argv.d ? 'xvfb-run ' : ''}npm run ${argv.command} -- -- ${argv.flags.join(' ')}"`, _.opts)
|
|
25
28
|
];
|
package/commands/setup.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = [
|
|
|
10
10
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
|
-
execSync(`${_.docker} ${_.run}c "npm run setup"`, _.opts);
|
|
13
|
+
execSync(`${_.docker} ${_.run} -c "npm run setup"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
];
|
package/commands/start.js
CHANGED
|
@@ -15,9 +15,19 @@ module.exports = [
|
|
|
15
15
|
_.ports.get();
|
|
16
16
|
|
|
17
17
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
18
|
-
_.up(() =>
|
|
18
|
+
_.up(() => {
|
|
19
|
+
let run = ' -l';
|
|
20
|
+
let user = '';
|
|
21
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
22
|
+
if(process.env.VERSION === "1"){
|
|
23
|
+
run = '';
|
|
24
|
+
user = ' -u node';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
execSync(`${_.docker} ${_.exec}${user} core bash${run} -c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
28
|
+
});
|
|
19
29
|
} else {
|
|
20
|
-
execSync(`${_.docker} ${_.run}c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
30
|
+
execSync(`${_.docker} ${_.run} -c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
21
31
|
}
|
|
22
32
|
}
|
|
23
33
|
];
|
package/commands/test.js
CHANGED
|
@@ -8,7 +8,15 @@ module.exports = [
|
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
10
|
_.up(() => {
|
|
11
|
-
|
|
11
|
+
let run = ' -l';
|
|
12
|
+
let user = '';
|
|
13
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
14
|
+
if(process.env.VERSION === "1"){
|
|
15
|
+
run = '';
|
|
16
|
+
user = ' -u node';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
execSync(`${_.docker} ${_.exec}${user} core bash${run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run test"`, _.opts);
|
|
12
20
|
|
|
13
21
|
if(_.platform === "laravel"){
|
|
14
22
|
execSync(`${_.docker} ${_.exec} php bash -lc "php artisan test"`, _.opts);
|
package/commands/uninstall.js
CHANGED
package/commands/watch.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = [
|
|
|
14
14
|
){
|
|
15
15
|
console.log("Watch command not supported in this project");
|
|
16
16
|
} else {
|
|
17
|
-
execSync(`${_.docker} ${_.run}c "$grunt browserSync watch" 2>/dev/null`, _.opts)
|
|
17
|
+
execSync(`${_.docker} ${_.run} -c "$grunt browserSync watch" 2>/dev/null`, _.opts)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 0.2.1 (2023-02-21)
|
|
4
|
+
* [Fix] Fixed bug in sed command on new Virtio file mounting system that caused modification of package.json file permissions or created a temporary file
|
|
5
|
+
|
|
3
6
|
### 0.2.0 (2022-09-08)
|
|
4
7
|
* [Feature] are-you-es5 dependency now globally installed with npm
|
|
5
8
|
* [Fix] core now points to google-chrome 105 now that 87 is no longer available to download through the image
|
|
@@ -181,7 +181,7 @@ npm(){(\n\
|
|
|
181
181
|
sed -i \'s/--parallel=10/--parallel=1/g\' $PWD/node_modules/@fishawack/config-grunt/_Tasks/options/shell.js 2>/dev/null || true\n\
|
|
182
182
|
sed -i \'s/--parallel=10/--parallel=1/g\' $PWD/node_modules/@fishawack/core/_Tasks/options/shell.js 2>/dev/null || true\n\
|
|
183
183
|
echo "Replacing any npm variables with the full values"\n\
|
|
184
|
-
|
|
184
|
+
perl -pi -e \'s/\$npm_package_vars_config/--prefix node_modules\/\@fishawack\/config-grunt\//g\' package.json 2>/dev/null || true\n\
|
|
185
185
|
echo "Replace line in ftpscript that toggles passive which these days toggles it to off mode which breaks the docker setup"\n\
|
|
186
186
|
sed -i "s/cmds.push \'passive\' if opts.passive/\#remove passive line/g" $PWD/node_modules/grunt-ftpscript/tasks/ftpscript.coffee 2>/dev/null || true\n\
|
|
187
187
|
echo "Add line to browser-sync to enable polling as file events not fired on windows docker projects"\n\
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "lab-env docker config for the @fishawack/core npm module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"preversion": "docker login",
|
|
7
|
+
"postversion": "docker build --platform linux/amd64 -t fishawack/core:$npm_package_version -t fishawack/core:latest . && docker push fishawack/core:$npm_package_version && docker push fishawack/core:latest && git add . && git commit -m \"build: Bumped core to $npm_package_version\""
|
|
8
|
+
},
|
|
9
|
+
"author": "Mike Mellor",
|
|
10
|
+
"license": "ISC"
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## Changelog
|
|
2
|
+
|
|
3
|
+
### 1.1.4 (2023-02-23)
|
|
4
|
+
* [Fix] Installed missing are-you-es5 global npm module
|
|
5
|
+
* [Fix] Installed missing check-dependencies global npm module
|
|
6
|
+
|
|
7
|
+
### 1.1.3 (2023-02-23)
|
|
8
|
+
* [Fix] Switch to ENV for $PATH updates to avoid shell profile loading issues
|
|
9
|
+
* [Fix] Moved chromium to alpine image as its needed for svg tasks and testing
|
|
10
|
+
|
|
11
|
+
### 1.1.2 (2023-02-22)
|
|
12
|
+
* [Fix] cd into $PWD after su command or we'll start in users home directory
|
|
13
|
+
|
|
14
|
+
### 1.1.1 (2023-02-22)
|
|
15
|
+
* [Fix] Use -l login flag for su command for both non interactive and interactive shells
|
|
16
|
+
* [Fix] Switch $PATH writes to .profile so they are executed on non interactive shells
|
|
17
|
+
|
|
18
|
+
### 1.1.0 (2023-02-22)
|
|
19
|
+
* [Feature] Watertight now baked into image so not needed in package.json of projects
|
|
20
|
+
* [Fix] lftp installed in alpine image as it's needed for content tasks
|
|
21
|
+
|
|
22
|
+
### 1.0.0 (2023-02-21)
|
|
23
|
+
* [Misc] initial commit
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#####
|
|
2
|
+
# Alpine image
|
|
3
|
+
#####
|
|
4
|
+
|
|
5
|
+
FROM node:18 AS alpine
|
|
6
|
+
|
|
7
|
+
MAINTAINER Mike Mellor
|
|
8
|
+
|
|
9
|
+
ARG TARGETARCH
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
|
|
13
|
+
EXPOSE 3000
|
|
14
|
+
EXPOSE 3001
|
|
15
|
+
|
|
16
|
+
# Get latest apt-get
|
|
17
|
+
RUN apt-get update
|
|
18
|
+
|
|
19
|
+
# Update npm to latest
|
|
20
|
+
RUN npm install -g npm@latest
|
|
21
|
+
|
|
22
|
+
# Install dart sass vm (arch switch)
|
|
23
|
+
RUN curl -L -o /sass.tar.gz https://github.com/sass/dart-sass/releases/download/1.57.1/dart-sass-1.57.1-linux-$(if [ "$TARGETARCH" = "arm64" ]; then echo 'arm64'; else echo 'x64'; fi).tar.gz
|
|
24
|
+
RUN tar -xf /sass.tar.gz -C /
|
|
25
|
+
ENV PATH="${PATH}:/dart-sass/"
|
|
26
|
+
RUN rm -rf /sass.tar.gz
|
|
27
|
+
|
|
28
|
+
# Set safe directory to remove intel errors when running git rev-parse
|
|
29
|
+
USER node
|
|
30
|
+
RUN git config --global --add safe.directory /app
|
|
31
|
+
USER root
|
|
32
|
+
|
|
33
|
+
# Install lftp
|
|
34
|
+
RUN apt-get install -y lftp
|
|
35
|
+
|
|
36
|
+
# Install chromium
|
|
37
|
+
RUN apt-get install -y chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends
|
|
38
|
+
# Stop Puppeteer downloading browsers during npm install
|
|
39
|
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
|
40
|
+
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium
|
|
41
|
+
|
|
42
|
+
# Install package.json checker
|
|
43
|
+
RUN npm install check-dependencies -g
|
|
44
|
+
|
|
45
|
+
# Install node_modules checker
|
|
46
|
+
RUN npm install are-you-es5 -g
|
|
47
|
+
|
|
48
|
+
# Cleanup apt-get install folders
|
|
49
|
+
RUN apt-get clean && \
|
|
50
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
51
|
+
|
|
52
|
+
COPY entrypoint.sh /bin/entrypoint.sh
|
|
53
|
+
RUN chmod +x /bin/entrypoint.sh
|
|
54
|
+
ENTRYPOINT ["/bin/entrypoint.sh"]
|
|
55
|
+
|
|
56
|
+
#####
|
|
57
|
+
# Full image
|
|
58
|
+
#####
|
|
59
|
+
|
|
60
|
+
FROM alpine AS full
|
|
61
|
+
|
|
62
|
+
# Get latest apt-get
|
|
63
|
+
RUN apt-get update
|
|
64
|
+
|
|
65
|
+
# Install ghostscript
|
|
66
|
+
RUN apt-get install -y ghostscript
|
|
67
|
+
|
|
68
|
+
# Install zip
|
|
69
|
+
RUN apt-get install zip
|
|
70
|
+
|
|
71
|
+
# Install AWS Elastic Beanstalk cli
|
|
72
|
+
RUN apt-get install -y zlib1g-dev libssl-dev libncurses-dev libffi-dev libsqlite3-dev libreadline-dev libbz2-dev
|
|
73
|
+
USER node
|
|
74
|
+
RUN git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git ~/aws-eb --depth 1 --branch v0.1.2
|
|
75
|
+
RUN ~/aws-eb/scripts/bundled_installer
|
|
76
|
+
RUN rm -rf ~/aws-eb
|
|
77
|
+
ENV PATH="${PATH}:/home/node/.ebcli-virtual-env/executables"
|
|
78
|
+
ENV PATH="${PATH}:/home/node/.pyenv/versions/3.7.2/bin"
|
|
79
|
+
USER root
|
|
80
|
+
|
|
81
|
+
# Install AWS-CLI@2 (arch switch)
|
|
82
|
+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(if [ "$TARGETARCH" = "arm64" ]; then echo 'aarch64'; else echo 'x86_64'; fi).zip" -o "awscliv2.zip"
|
|
83
|
+
RUN unzip awscliv2.zip
|
|
84
|
+
RUN ./aws/install
|
|
85
|
+
RUN rm -rf ./aws && rm -rf awscliv2.zip
|
|
86
|
+
|
|
87
|
+
# Update electron globally
|
|
88
|
+
RUN npm install -g electron-packager@latest
|
|
89
|
+
|
|
90
|
+
# Install wine64
|
|
91
|
+
RUN apt-get install -y wine64
|
|
92
|
+
|
|
93
|
+
# Install watertight
|
|
94
|
+
RUN --mount=type=ssh npm install -g git+ssh://git@bitbucket.org/fishawackdigital/watertight-node-auto.git#v6.0.0
|
|
95
|
+
|
|
96
|
+
# Link root global node_modules to ~/.node_modules
|
|
97
|
+
RUN ln -s /usr/local/lib/node_modules/ /home/node/.node_modules
|
|
98
|
+
|
|
99
|
+
# Cleanup apt-get install folders
|
|
100
|
+
RUN apt-get clean && \
|
|
101
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
version: "3.8"
|
|
2
|
+
services:
|
|
3
|
+
core:
|
|
4
|
+
image: ${FW_CORE_1_IMAGE:-fishawack/lab-env-core-1-alpine}:${FW_CORE_1_VERSION:-latest}
|
|
5
|
+
init: true
|
|
6
|
+
tty: true
|
|
7
|
+
volumes:
|
|
8
|
+
- $CWD/:/app
|
|
9
|
+
- $HOME/targets:/home/node/targets
|
|
10
|
+
- $HOME/.ssh:/home/node/.ssh
|
|
11
|
+
- $HOME/.aws:/home/node/.aws
|
|
12
|
+
- node_modules:/app/node_modules
|
|
13
|
+
ports:
|
|
14
|
+
- ${PORT:-3000}:${PORT:-3000}
|
|
15
|
+
- ${PORT_OPT:-3001}:${PORT_OPT:-3001}
|
|
16
|
+
environment:
|
|
17
|
+
- REPO=${REPO:-}
|
|
18
|
+
- PORT=${PORT:-3000}
|
|
19
|
+
- PORT_OPT=${PORT_OPT:-3001}
|
|
20
|
+
- PORT_WEB=${PORT_WEB:-8000}
|
|
21
|
+
- PORT_DB=${PORT_DB:-3306}
|
|
22
|
+
- USER_UID=${USER_UID:-0}
|
|
23
|
+
- USER_GID=${USER_GID:-0}
|
|
24
|
+
- FW_ROOT=${FW_ROOT:-}
|
|
25
|
+
volumes:
|
|
26
|
+
node_modules:
|
|
27
|
+
driver: "local"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Setting $FW_ROOT will bypass the user switch to node
|
|
4
|
+
if [ -z "$FW_ROOT" ]; then
|
|
5
|
+
# Set node user id to match host users id so no permission issues outside of docker
|
|
6
|
+
usermod -u $USER_UID node &>/dev/null
|
|
7
|
+
|
|
8
|
+
# Own the node_modules folder otherwise it'll be owned by root/previous node id which will prevent writing
|
|
9
|
+
chown -R node:node /app/node_modules
|
|
10
|
+
|
|
11
|
+
# Default arguments will always be bash -l, if nothing follows this just start an non login interactive shell
|
|
12
|
+
if [ -z "${@:3}" ]; then
|
|
13
|
+
exec su node
|
|
14
|
+
# Otherwise pipe the command after the bash -lc into the non login non interactive shell as a command to exec
|
|
15
|
+
else
|
|
16
|
+
exec su node -c "${@:3}"
|
|
17
|
+
fi
|
|
18
|
+
else
|
|
19
|
+
echo "Accessing as root"
|
|
20
|
+
exec "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "lab-env docker config for the @fishawack/core/1 npm module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"preversion": "docker login",
|
|
7
|
+
"postversion": "docker buildx build --ssh default --platform linux/amd64,linux/arm64 -t fishawack/lab-env-core-1:$npm_package_version -t fishawack/lab-env-core-1:latest --push . && docker buildx build --ssh default --target alpine --platform linux/amd64,linux/arm64 -t fishawack/lab-env-core-1-alpine:$npm_package_version -t fishawack/lab-env-core-1-alpine:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-core-1 to $npm_package_version\""
|
|
8
|
+
},
|
|
9
|
+
"author": "Mike Mellor",
|
|
10
|
+
"license": "ISC"
|
|
11
|
+
}
|
package/globals.js
CHANGED
|
@@ -9,6 +9,8 @@ const { hideBin } = require('yargs/helpers');
|
|
|
9
9
|
const args = hideBin(process.argv);
|
|
10
10
|
|
|
11
11
|
process.env.DIRNAME = __dirname;
|
|
12
|
+
process.env.USER_UID=execSync("id -u", {encoding: 'utf8', stdio: 'pipe'}).trim();
|
|
13
|
+
process.env.USER_GID=execSync("id -g", {encoding: 'utf8', stdio: 'pipe'}).trim();
|
|
12
14
|
|
|
13
15
|
const isDirectory = source => lstatSync(source).isDirectory();
|
|
14
16
|
const getDirectories = source => readdirSync(source).map(name => path.join(source, name)).filter(isDirectory);
|
|
@@ -25,7 +27,7 @@ var exec;
|
|
|
25
27
|
var running;
|
|
26
28
|
var services;
|
|
27
29
|
var branch;
|
|
28
|
-
var diagnosis = '
|
|
30
|
+
var diagnosis = '3.0.0';
|
|
29
31
|
var opts = {encoding: 'utf8', stdio: 'inherit', shell: '/bin/bash'};
|
|
30
32
|
|
|
31
33
|
try{
|
|
@@ -74,24 +76,41 @@ if(composer && composer.require && composer.require['laravel/framework']){
|
|
|
74
76
|
platform = 'core';
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
const versions = getDirectories(path.resolve(__dirname, './core')).map(d => path.basename(d)).sort((a, b) =>
|
|
78
|
-
const version = pkg && pkg.devDependencies && (pkg.devDependencies['@fishawack/core'] || pkg.devDependencies['@fishawack/config-grunt']);
|
|
79
|
+
const versions = getDirectories(path.resolve(__dirname, './core')).map(d => path.basename(d)).sort((a, b) => +a - +b);
|
|
80
|
+
const version = pkg && ((pkg.devDependencies && (pkg.devDependencies['@fishawack/core'] || pkg.devDependencies['@fishawack/config-grunt'])) || (pkg.dependencies && (pkg.dependencies['@fishawack/core'] || pkg.dependencies['@fishawack/config-grunt'])) || pkg.name === '@fishawack/core' && pkg.version);
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
process.env.VERSION =
|
|
84
|
-
|
|
82
|
+
if(process.env.FW_NEXT){
|
|
83
|
+
process.env.VERSION = versions[versions.length - 1];
|
|
84
|
+
} else if(semver.satisfies(version, '<=7.24.0')){
|
|
85
|
+
process.env.VERSION = '0';
|
|
86
|
+
} else if(semver.satisfies(version, '<=8')) {
|
|
87
|
+
process.env.VERSION = '1';
|
|
88
|
+
} else {
|
|
89
|
+
if(args[0] !== 'diag' && args[0] !== 'diagnose' && args[0] !== 'origin' && args[0] !== '--version' && args[0] !== '--help' && args[0] !== 'new' && args[0] !== 'key' && args[0] !== 'dekey'){
|
|
90
|
+
if(!args.find(d => d === '--force')){
|
|
91
|
+
console.log(`${utilities.colorize(`@fishawack/core`, 'title')} and ${utilities.colorize(`@fishawack/lab-env`, 'title')} have mismatching versions.\n\nRun ${utilities.colorize(`npm i -g @fishawack/lab-env@latest`, 'success')} or pass ${utilities.colorize(`--force`, 'warning')} to continue.`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Default to latest image when outside of known core versions
|
|
97
|
+
process.env.VERSION = versions[versions.length - 1];
|
|
98
|
+
}
|
|
85
99
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
// Map full image or alpine
|
|
101
|
+
if(process.env.FW_FULL){
|
|
102
|
+
process.env.FW_CORE_1_IMAGE = "fishawack/lab-env-core-1";
|
|
103
|
+
process.env.FW_CORE_1_TARGET = "full";
|
|
104
|
+
}
|
|
89
105
|
|
|
90
|
-
var core = `-f ${__dirname}/core/docker-compose.yml`;
|
|
106
|
+
var core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml`;
|
|
91
107
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
if(process.env.FW_DEV){
|
|
109
|
+
core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose-dev.yml ${core}`;
|
|
110
|
+
} else {
|
|
111
|
+
// Map versions of images (dont set on FW_DEV as we want to default to latest)
|
|
112
|
+
process.env.FW_CORE_0_VERSION = process.env.FW_CORE_0_VERSION || require('./core/0/package.json').version;
|
|
113
|
+
process.env.FW_CORE_1_VERSION = process.env.FW_CORE_1_VERSION || require('./core/1/package.json').version;
|
|
95
114
|
}
|
|
96
115
|
|
|
97
116
|
if(platform === 'laravel'){
|
|
@@ -101,8 +120,7 @@ if(platform === 'laravel'){
|
|
|
101
120
|
|
|
102
121
|
let container = `-f ${__dirname}/laravel/8/docker-compose.yml`;
|
|
103
122
|
|
|
104
|
-
|
|
105
|
-
if(linked){
|
|
123
|
+
if(process.env.FW_DEV){
|
|
106
124
|
container = `-f ${__dirname}/laravel/8/docker-compose-dev.yml ${container}`;
|
|
107
125
|
}
|
|
108
126
|
|
|
@@ -120,8 +138,7 @@ if(platform === 'laravel'){
|
|
|
120
138
|
|
|
121
139
|
let container = `-f ${__dirname}/drupal/9/docker-compose.yml`;
|
|
122
140
|
|
|
123
|
-
|
|
124
|
-
if(linked){
|
|
141
|
+
if(process.env.FW_DEV){
|
|
125
142
|
container = `-f ${__dirname}/drupal/9/docker-compose-dev.yml ${container}`;
|
|
126
143
|
}
|
|
127
144
|
|
|
@@ -141,7 +158,9 @@ try{
|
|
|
141
158
|
running = services.trim().length;
|
|
142
159
|
exec = `exec ${process.env.CI_BUILD_ID ? '-T' : ''}`;
|
|
143
160
|
method = running ? exec : 'run --rm --service-ports';
|
|
144
|
-
|
|
161
|
+
// Set user on exec command using core@1
|
|
162
|
+
// Login on core@0 so .bash_profile is loaded
|
|
163
|
+
run = `${method} ${(running && process.env.VERSION === "1") ? '-u node ' : ''}core bash${(process.env.VERSION === "0") ? ' -l' : ''}`;
|
|
145
164
|
} catch(e){
|
|
146
165
|
if(args.find(d => d === '--debug')){
|
|
147
166
|
console.log(utilities.colorize(e.stderr, 'error'));
|
|
@@ -164,11 +183,40 @@ if(args[0] !== 'diag' && args[0] !== 'diagnose' && args[0] !== 'origin' && args[
|
|
|
164
183
|
}
|
|
165
184
|
}
|
|
166
185
|
|
|
186
|
+
let volumes = [
|
|
187
|
+
'node_modules'
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
191
|
+
volumes.push(
|
|
192
|
+
'mysql'
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if(platform === "drupal"){
|
|
197
|
+
volumes.push(
|
|
198
|
+
'drupal'
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if(platform === "laravel"){
|
|
203
|
+
volumes.push(
|
|
204
|
+
'redis'
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if(platform === "laravel" || platform === "drupal" || platform === "craftcms"){
|
|
209
|
+
volumes.push(
|
|
210
|
+
'vendor'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
167
214
|
module.exports = {
|
|
168
215
|
config,
|
|
169
216
|
diagnosis,
|
|
170
217
|
services,
|
|
171
218
|
platform,
|
|
219
|
+
volumes: volumes.map(d => `${repo_safe}_${d}`),
|
|
172
220
|
repo,
|
|
173
221
|
branch,
|
|
174
222
|
repo_safe,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures/boilerplate*; mocha _Test/*.js --timeout 1200s --bail",
|
|
7
|
+
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true mocha _Test/*.js --timeout 1200s --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"
|
package/_Test/_fixtures/.gitkeep
DELETED
|
File without changes
|
package/core/package.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "core",
|
|
3
|
-
"version": "0.2.0",
|
|
4
|
-
"description": "lab-env docker config for the @fishawack/core npm module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"preversion": "docker login",
|
|
7
|
-
"postversion": "mv ./*/ ./$npm_package_version && docker build ./*/ -t fishawack/core:$npm_package_version --platform linux/amd64 -t fishawack/core:latest && docker push fishawack/core:$npm_package_version && docker push fishawack/core:latest && git add . && git commit -m \"build: Bumped core to $npm_package_version\""
|
|
8
|
-
},
|
|
9
|
-
"author": "Mike Mellor",
|
|
10
|
-
"license": "ISC"
|
|
11
|
-
}
|
|
File without changes
|