@fishawack/lab-env 4.8.0 → 4.10.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 +16 -0
- package/_Test/check.js +29 -7
- package/cli.js +5 -1
- package/commands/create/libs/vars.js +11 -0
- package/commands/create/services/aws/index.js +1 -1
- 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/docker/build.js +1 -1
- package/commands/docker/volumes.js +1 -29
- package/commands/execute.js +7 -5
- package/commands/nuke.js +1 -1
- package/commands/run.js +4 -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 +5 -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 +62 -19
- package/package.json +1 -1
- 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,21 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 4.10.0 (2023-02-21)
|
|
4
|
+
* [Feature] Created core@1 image for @fishawack/core projects >= 8
|
|
5
|
+
* [Feature] New env variables for changing lab-env behaviour, FW_DEV, FW_NEXT, FW_FULL, FW_ROOT
|
|
6
|
+
* [Feature] lab-env now has a latest known version of the core that if a project exceeds will cause an error
|
|
7
|
+
* [Feature] New diagnose prompt for egnyte credentials in new location
|
|
8
|
+
* [Change] Nuke no longer internally calls volumes command but pulls them from globals as an export
|
|
9
|
+
* [Change] --display flag only available on core@0
|
|
10
|
+
* [Change] Bumped core `0.2.0` to `0.2.1`
|
|
11
|
+
* [Change] Core images now lock version into image with environment variables
|
|
12
|
+
* [Change] Bumped diagnose version
|
|
13
|
+
* [Change] Build commands now use --ssh flag to mount live agent
|
|
14
|
+
* [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
|
|
15
|
+
|
|
16
|
+
### 4.9.0 (2023-01-26)
|
|
17
|
+
* [Feature] Added newly setup AWS accounts to the client prompts on `fw provision`
|
|
18
|
+
|
|
3
19
|
### 4.8.0 (2023-01-20)
|
|
4
20
|
* [Feature] Added newly setup AWS accounts to the client prompts on `fw provision`
|
|
5
21
|
|
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
|
|
@@ -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
|
|
|
@@ -6,7 +6,7 @@ module.exports.iam = require("./iam.js");
|
|
|
6
6
|
|
|
7
7
|
module.exports.slug = (repo, client, branch) => s3Safe(`${branch}-${repo}-${client}`);
|
|
8
8
|
|
|
9
|
-
module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin'];
|
|
9
|
+
module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin', 'optum', 'rally'];
|
|
10
10
|
|
|
11
11
|
module.exports.static = async (name, account, tags = [], credentials = []) => {
|
|
12
12
|
let s3 = await module.exports.s3.createS3Bucket(name, account, tags);
|
|
@@ -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/docker/build.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',
|
package/commands/nuke.js
CHANGED
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
27
|
argv => execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}npm run ${argv.command} -- -- ${argv.flags.join(' ')}"`, _.opts)
|
|
25
28
|
];
|
|
@@ -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,38 @@ 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.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.find(d => d === '--force')){
|
|
90
|
+
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.`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Default to latest image when outside of known core versions
|
|
95
|
+
process.env.VERSION = versions[versions.length - 1];
|
|
96
|
+
}
|
|
85
97
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
// Map full image or alpine
|
|
99
|
+
if(process.env.FW_FULL){
|
|
100
|
+
process.env.FW_CORE_1_IMAGE = "fishawack/lab-env-core-1";
|
|
101
|
+
}
|
|
89
102
|
|
|
90
|
-
var core = `-f ${__dirname}/core/docker-compose.yml`;
|
|
103
|
+
var core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml`;
|
|
91
104
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
if(process.env.FW_DEV){
|
|
106
|
+
core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose-dev.yml ${core}`;
|
|
107
|
+
} else {
|
|
108
|
+
// Map versions of images (dont set on FW_DEV as we want to default to latest)
|
|
109
|
+
process.env.FW_CORE_0_VERSION = process.env.FW_CORE_0_VERSION || require('./core/0/package.json').version;
|
|
110
|
+
process.env.FW_CORE_1_VERSION = process.env.FW_CORE_1_VERSION || require('./core/1/package.json').version;
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
if(platform === 'laravel'){
|
|
@@ -101,8 +117,7 @@ if(platform === 'laravel'){
|
|
|
101
117
|
|
|
102
118
|
let container = `-f ${__dirname}/laravel/8/docker-compose.yml`;
|
|
103
119
|
|
|
104
|
-
|
|
105
|
-
if(linked){
|
|
120
|
+
if(process.env.FW_DEV){
|
|
106
121
|
container = `-f ${__dirname}/laravel/8/docker-compose-dev.yml ${container}`;
|
|
107
122
|
}
|
|
108
123
|
|
|
@@ -120,8 +135,7 @@ if(platform === 'laravel'){
|
|
|
120
135
|
|
|
121
136
|
let container = `-f ${__dirname}/drupal/9/docker-compose.yml`;
|
|
122
137
|
|
|
123
|
-
|
|
124
|
-
if(linked){
|
|
138
|
+
if(process.env.FW_DEV){
|
|
125
139
|
container = `-f ${__dirname}/drupal/9/docker-compose-dev.yml ${container}`;
|
|
126
140
|
}
|
|
127
141
|
|
|
@@ -164,11 +178,40 @@ if(args[0] !== 'diag' && args[0] !== 'diagnose' && args[0] !== 'origin' && args[
|
|
|
164
178
|
}
|
|
165
179
|
}
|
|
166
180
|
|
|
181
|
+
let volumes = [
|
|
182
|
+
'node_modules'
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
186
|
+
volumes.push(
|
|
187
|
+
'mysql'
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if(platform === "drupal"){
|
|
192
|
+
volumes.push(
|
|
193
|
+
'drupal'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if(platform === "laravel"){
|
|
198
|
+
volumes.push(
|
|
199
|
+
'redis'
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if(platform === "laravel" || platform === "drupal" || platform === "craftcms"){
|
|
204
|
+
volumes.push(
|
|
205
|
+
'vendor'
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
167
209
|
module.exports = {
|
|
168
210
|
config,
|
|
169
211
|
diagnosis,
|
|
170
212
|
services,
|
|
171
213
|
platform,
|
|
214
|
+
volumes: volumes.map(d => `${repo_safe}_${d}`),
|
|
172
215
|
repo,
|
|
173
216
|
branch,
|
|
174
217
|
repo_safe,
|
package/package.json
CHANGED
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
|