@fishawack/lab-env 5.7.0-beta.1 → 5.7.0-beta.10
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 +117 -0
- package/_Test/boilerplate-adonis.js +1 -1
- package/_Test/boilerplate-craftcms.js +1 -1
- package/_Test/boilerplate-drupal.js +1 -1
- package/_Test/boilerplate-laravel.js +1 -1
- package/_Test/boilerplate-python.js +1 -1
- package/_Test/boilerplate-wordpress.js +1 -1
- package/_Test/boilerplate.js +1 -1
- package/_Test/provision.js +4 -9
- package/_Test/prune.js +8 -5
- package/bitbucket-pipelines.yml +2 -2
- package/cli.js +1 -0
- package/commands/create/cmds/dekey.js +13 -9
- package/commands/create/cmds/deprovision.js +36 -0
- package/commands/create/cmds/diagnose.js +10 -0
- package/commands/create/cmds/key.js +74 -41
- package/commands/create/cmds/provision.js +573 -69
- package/commands/create/cmds/rekey.js +283 -0
- package/commands/create/cmds/sync-secrets.js +2 -1
- package/commands/create/libs/output-credentials.js +59 -0
- package/commands/create/libs/parallel-runner.js +296 -0
- package/commands/create/libs/resolve-operator.js +59 -0
- package/commands/create/libs/utilities.js +75 -8
- package/commands/create/libs/vars.js +124 -143
- package/commands/create/services/aws/acm.js +61 -0
- package/commands/create/services/aws/cloudfront.js +51 -45
- package/commands/create/services/aws/ec2.js +675 -48
- package/commands/create/services/aws/elasticache.js +159 -0
- package/commands/create/services/aws/elasticbeanstalk.js +155 -57
- package/commands/create/services/aws/iam.js +420 -86
- package/commands/create/services/aws/index.js +1401 -260
- package/commands/create/services/aws/opensearch.js +155 -0
- package/commands/create/services/aws/rds.js +57 -31
- package/commands/create/services/aws/s3.js +52 -31
- package/commands/create/services/aws/secretsmanager.js +21 -12
- package/commands/create/services/aws/ses.js +203 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/cron.config +45 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/queue-worker.config +29 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/software.config +12 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/setvars.config +2 -16
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/restart_queue.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/rewrite-flush.sh +1 -1
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/prebuild/setvars.sh +19 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/postdeploy/restart_queue.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/prebuild/setvars.sh +19 -0
- package/commands/scan.js +1 -1
- package/core/1/CHANGELOG.md +41 -0
- package/core/1/Dockerfile +3 -3
- package/core/1/bitbucket-pipelines.yml +5 -5
- package/core/1/package.json +1 -1
- package/globals.js +4 -0
- package/package.json +7 -2
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
const {
|
|
2
|
+
ElastiCacheClient,
|
|
3
|
+
CreateCacheSubnetGroupCommand,
|
|
4
|
+
CreateReplicationGroupCommand,
|
|
5
|
+
DeleteReplicationGroupCommand,
|
|
6
|
+
DescribeCacheSubnetGroupsCommand,
|
|
7
|
+
DescribeReplicationGroupsCommand,
|
|
8
|
+
} = require("@aws-sdk/client-elasticache");
|
|
9
|
+
const { Spinner, poll } = require("../../libs/utilities");
|
|
10
|
+
const { awsClientConfig } = require("../../libs/vars");
|
|
11
|
+
|
|
12
|
+
const getClient = () => new ElastiCacheClient(awsClientConfig);
|
|
13
|
+
|
|
14
|
+
module.exports.ensureCacheSubnetGroup = async (privateSubnetIds) => {
|
|
15
|
+
const name = "fw-auto-private-cache-subnet-group";
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
await getClient().send(
|
|
19
|
+
new DescribeCacheSubnetGroupsCommand({
|
|
20
|
+
CacheSubnetGroupName: name,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return name;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (e.name !== "CacheSubnetGroupNotFoundFault") {
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
await Spinner.prototype.simple(
|
|
32
|
+
`Creating cache subnet group ${name}`,
|
|
33
|
+
() => {
|
|
34
|
+
return getClient().send(
|
|
35
|
+
new CreateCacheSubnetGroupCommand({
|
|
36
|
+
CacheSubnetGroupName: name,
|
|
37
|
+
CacheSubnetGroupDescription:
|
|
38
|
+
"Private subnets for lab-env ElastiCache clusters",
|
|
39
|
+
SubnetIds: privateSubnetIds,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return name;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports.createCacheCluster = async (
|
|
49
|
+
name,
|
|
50
|
+
securityGroupId,
|
|
51
|
+
subnetGroupName,
|
|
52
|
+
authToken,
|
|
53
|
+
tags = [],
|
|
54
|
+
) => {
|
|
55
|
+
const res = await Spinner.prototype.simple(
|
|
56
|
+
`Creating ElastiCache cluster ${name}`,
|
|
57
|
+
() => {
|
|
58
|
+
return getClient().send(
|
|
59
|
+
new CreateReplicationGroupCommand({
|
|
60
|
+
ReplicationGroupId: name,
|
|
61
|
+
ReplicationGroupDescription: `lab-env Valkey cluster for ${name}`,
|
|
62
|
+
Engine: "valkey",
|
|
63
|
+
EngineVersion: "8.0",
|
|
64
|
+
CacheNodeType: "cache.t3.small",
|
|
65
|
+
NumCacheClusters: 1,
|
|
66
|
+
Port: 6380,
|
|
67
|
+
TransitEncryptionEnabled: true,
|
|
68
|
+
AuthToken: authToken,
|
|
69
|
+
CacheSubnetGroupName: subnetGroupName,
|
|
70
|
+
SecurityGroupIds: [securityGroupId],
|
|
71
|
+
Tags: [
|
|
72
|
+
{ Key: "client", Value: process.env.AWS_PROFILE },
|
|
73
|
+
].concat(tags),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return res;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
module.exports.waitForCacheCluster = async (name) => {
|
|
83
|
+
const res = await Spinner.prototype.simple(
|
|
84
|
+
`Waiting for ElastiCache cluster to become available`,
|
|
85
|
+
(spinner) => {
|
|
86
|
+
return poll(
|
|
87
|
+
async () => {
|
|
88
|
+
const { ReplicationGroups } = await getClient().send(
|
|
89
|
+
new DescribeReplicationGroupsCommand({
|
|
90
|
+
ReplicationGroupId: name,
|
|
91
|
+
}),
|
|
92
|
+
);
|
|
93
|
+
return ReplicationGroups[0];
|
|
94
|
+
},
|
|
95
|
+
(group) => group.Status !== "available",
|
|
96
|
+
undefined,
|
|
97
|
+
spinner,
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
return res;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports.describeCacheCluster = async (name) => {
|
|
106
|
+
const res = await Spinner.prototype.simple(
|
|
107
|
+
`Describing ElastiCache cluster ${name}`,
|
|
108
|
+
() => {
|
|
109
|
+
return getClient().send(
|
|
110
|
+
new DescribeReplicationGroupsCommand({
|
|
111
|
+
ReplicationGroupId: name,
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
return res.ReplicationGroups[0];
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
module.exports.deleteCacheCluster = async (name) => {
|
|
121
|
+
await Spinner.prototype.simple(
|
|
122
|
+
`Deleting ElastiCache cluster ${name}`,
|
|
123
|
+
() => {
|
|
124
|
+
return getClient().send(
|
|
125
|
+
new DeleteReplicationGroupCommand({
|
|
126
|
+
ReplicationGroupId: name,
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
module.exports.waitForCacheDeletion = async (name) => {
|
|
134
|
+
await Spinner.prototype.simple(
|
|
135
|
+
`Waiting for ElastiCache cluster to be deleted`,
|
|
136
|
+
(spinner) => {
|
|
137
|
+
return poll(
|
|
138
|
+
async () => {
|
|
139
|
+
try {
|
|
140
|
+
const { ReplicationGroups } = await getClient().send(
|
|
141
|
+
new DescribeReplicationGroupsCommand({
|
|
142
|
+
ReplicationGroupId: name,
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
return ReplicationGroups[0];
|
|
146
|
+
} catch (e) {
|
|
147
|
+
if (e.name === "ReplicationGroupNotFoundFault") {
|
|
148
|
+
return { deleted: true };
|
|
149
|
+
}
|
|
150
|
+
throw e;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
(group) => !group.deleted,
|
|
154
|
+
undefined,
|
|
155
|
+
spinner,
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
);
|
|
159
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const fs = require("fs-extra");
|
|
2
|
+
const crypto = require("crypto");
|
|
2
3
|
const glob = require("glob");
|
|
4
|
+
const inquirer = require("inquirer");
|
|
3
5
|
const {
|
|
4
6
|
ElasticBeanstalkClient,
|
|
5
7
|
CreateApplicationCommand,
|
|
@@ -14,18 +16,26 @@ const {
|
|
|
14
16
|
UpdateEnvironmentCommand,
|
|
15
17
|
CreateApplicationVersionCommand,
|
|
16
18
|
ListAvailableSolutionStacksCommand,
|
|
19
|
+
ListTagsForResourceCommand,
|
|
20
|
+
RestartAppServerCommand,
|
|
17
21
|
} = require("@aws-sdk/client-elastic-beanstalk");
|
|
18
22
|
const { Spinner, poll } = require("../../libs/utilities");
|
|
19
|
-
const { eb } = require("../../libs/vars");
|
|
23
|
+
const { eb, secretGroups, awsClientConfig } = require("../../libs/vars");
|
|
24
|
+
const { template } = require("lodash");
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
const client = new ElasticBeanstalkClient({});
|
|
26
|
+
const getClient = () => new ElasticBeanstalkClient(awsClientConfig);
|
|
23
27
|
|
|
28
|
+
module.exports.createElasticBeanstalkApplication = async (name, tags = []) => {
|
|
24
29
|
let res = await Spinner.prototype.simple(
|
|
25
30
|
`Creating elasticbeanstalk application ${name}`,
|
|
26
31
|
() => {
|
|
27
|
-
return
|
|
28
|
-
new CreateApplicationCommand({
|
|
32
|
+
return getClient().send(
|
|
33
|
+
new CreateApplicationCommand({
|
|
34
|
+
ApplicationName: name,
|
|
35
|
+
Tags: [
|
|
36
|
+
{ Key: "client", Value: process.env.AWS_PROFILE },
|
|
37
|
+
].concat(tags),
|
|
38
|
+
}),
|
|
29
39
|
);
|
|
30
40
|
},
|
|
31
41
|
);
|
|
@@ -34,15 +44,36 @@ module.exports.createElasticBeanstalkApplication = async (name) => {
|
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
module.exports.describeEnvironment = async (name) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return client.send(
|
|
47
|
+
return getClient().send(
|
|
40
48
|
new DescribeEnvironmentsCommand({
|
|
41
49
|
EnvironmentNames: [name],
|
|
42
50
|
}),
|
|
43
51
|
);
|
|
44
52
|
};
|
|
45
53
|
|
|
54
|
+
module.exports.listEnvironments = async (applicationName) => {
|
|
55
|
+
const res = await Spinner.prototype.simple(
|
|
56
|
+
`Retrieving environments for ${applicationName}`,
|
|
57
|
+
() => {
|
|
58
|
+
return getClient().send(
|
|
59
|
+
new DescribeEnvironmentsCommand({
|
|
60
|
+
ApplicationName: applicationName,
|
|
61
|
+
IncludeDeleted: false,
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (res.Environments || []).filter((e) => e.Status !== "Terminated");
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
module.exports.getEnvironmentTags = async (environmentArn) => {
|
|
71
|
+
const res = await getClient().send(
|
|
72
|
+
new ListTagsForResourceCommand({ ResourceArn: environmentArn }),
|
|
73
|
+
);
|
|
74
|
+
return res.ResourceTags || [];
|
|
75
|
+
};
|
|
76
|
+
|
|
46
77
|
module.exports.createElasticBeanstalkEnvironment = async (
|
|
47
78
|
name,
|
|
48
79
|
{ language },
|
|
@@ -50,13 +81,12 @@ module.exports.createElasticBeanstalkEnvironment = async (
|
|
|
50
81
|
OptionSettings,
|
|
51
82
|
CNAMEPrefix,
|
|
52
83
|
tags = [],
|
|
84
|
+
versionLabel,
|
|
53
85
|
) => {
|
|
54
|
-
const client = new ElasticBeanstalkClient({});
|
|
55
|
-
|
|
56
86
|
const solutions = await Spinner.prototype.simple(
|
|
57
87
|
`Retrieving available solution stacks`,
|
|
58
88
|
() => {
|
|
59
|
-
return
|
|
89
|
+
return getClient().send(new ListAvailableSolutionStacksCommand());
|
|
60
90
|
},
|
|
61
91
|
);
|
|
62
92
|
|
|
@@ -74,21 +104,23 @@ module.exports.createElasticBeanstalkEnvironment = async (
|
|
|
74
104
|
d.includes(stackName),
|
|
75
105
|
)[0];
|
|
76
106
|
|
|
107
|
+
const createParams = {
|
|
108
|
+
ApplicationName,
|
|
109
|
+
EnvironmentName: name,
|
|
110
|
+
SolutionStackName,
|
|
111
|
+
OptionSettings,
|
|
112
|
+
CNAMEPrefix,
|
|
113
|
+
Tags: [{ Key: "client", Value: process.env.AWS_PROFILE }].concat(tags),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (versionLabel) {
|
|
117
|
+
createParams.VersionLabel = versionLabel;
|
|
118
|
+
}
|
|
119
|
+
|
|
77
120
|
await Spinner.prototype.simple(
|
|
78
121
|
`Creating elasticbeanstalk environment ${name}`,
|
|
79
122
|
() => {
|
|
80
|
-
return
|
|
81
|
-
new CreateEnvironmentCommand({
|
|
82
|
-
ApplicationName,
|
|
83
|
-
EnvironmentName: name,
|
|
84
|
-
SolutionStackName,
|
|
85
|
-
OptionSettings,
|
|
86
|
-
CNAMEPrefix,
|
|
87
|
-
Tags: [
|
|
88
|
-
{ Key: "client", Value: process.env.AWS_PROFILE },
|
|
89
|
-
].concat(tags),
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
123
|
+
return getClient().send(new CreateEnvironmentCommand(createParams));
|
|
92
124
|
},
|
|
93
125
|
);
|
|
94
126
|
|
|
@@ -111,12 +143,10 @@ module.exports.waitForElasticBeanstalkEnvironment = async (
|
|
|
111
143
|
waitFor = "Ready",
|
|
112
144
|
failIf,
|
|
113
145
|
) => {
|
|
114
|
-
const client = new ElasticBeanstalkClient({});
|
|
115
|
-
|
|
116
146
|
const res = await poll(
|
|
117
147
|
async () =>
|
|
118
148
|
(
|
|
119
|
-
await
|
|
149
|
+
await getClient().send(
|
|
120
150
|
new DescribeEnvironmentsCommand({
|
|
121
151
|
EnvironmentNames: [name],
|
|
122
152
|
}),
|
|
@@ -130,12 +160,10 @@ module.exports.waitForElasticBeanstalkEnvironment = async (
|
|
|
130
160
|
};
|
|
131
161
|
|
|
132
162
|
module.exports.removeElasticBeanstalkApplication = async (name) => {
|
|
133
|
-
const client = new ElasticBeanstalkClient({});
|
|
134
|
-
|
|
135
163
|
await Spinner.prototype.simple(
|
|
136
164
|
`Removing elasticbeanstalk application ${name}`,
|
|
137
165
|
() => {
|
|
138
|
-
return
|
|
166
|
+
return getClient().send(
|
|
139
167
|
new DeleteApplicationCommand({ ApplicationName: name }),
|
|
140
168
|
);
|
|
141
169
|
},
|
|
@@ -143,12 +171,10 @@ module.exports.removeElasticBeanstalkApplication = async (name) => {
|
|
|
143
171
|
};
|
|
144
172
|
|
|
145
173
|
module.exports.removeElasticBeanstalkEnvironment = async (name) => {
|
|
146
|
-
const client = new ElasticBeanstalkClient({});
|
|
147
|
-
|
|
148
174
|
await Spinner.prototype.simple(
|
|
149
175
|
`Removing elasticbeanstalk environment ${name}`,
|
|
150
176
|
() => {
|
|
151
|
-
return
|
|
177
|
+
return getClient().send(
|
|
152
178
|
new TerminateEnvironmentCommand({ EnvironmentName: name }),
|
|
153
179
|
);
|
|
154
180
|
},
|
|
@@ -160,30 +186,99 @@ module.exports.removeElasticBeanstalkEnvironment = async (name) => {
|
|
|
160
186
|
return module.exports.waitForElasticBeanstalkEnvironment(
|
|
161
187
|
name,
|
|
162
188
|
"Terminated",
|
|
189
|
+
"Ready",
|
|
163
190
|
);
|
|
164
191
|
},
|
|
165
192
|
);
|
|
166
193
|
};
|
|
167
194
|
|
|
168
|
-
module.exports.copyElasticBeanstalkConfigs = async (configurations) => {
|
|
195
|
+
module.exports.copyElasticBeanstalkConfigs = async (configurations, branch) => {
|
|
169
196
|
const templates = `${__dirname}/../../templates/elasticbeanstalk`;
|
|
197
|
+
const templateData = {
|
|
198
|
+
...process.env,
|
|
199
|
+
SECRET_GROUPS: secretGroups.join(" "),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const checksumPath = `_IaC/${branch}/.lab-env-checksums.json`;
|
|
203
|
+
const checksums = fs.existsSync(checksumPath)
|
|
204
|
+
? JSON.parse(fs.readFileSync(checksumPath, "utf8"))
|
|
205
|
+
: {};
|
|
206
|
+
|
|
207
|
+
for (const globbed of configurations) {
|
|
208
|
+
const files = glob.sync(globbed, { cwd: `${templates}` });
|
|
209
|
+
|
|
210
|
+
for (const config of files) {
|
|
211
|
+
const content = fs.readFileSync(`${templates}/${config}`, "utf8");
|
|
212
|
+
const output = content.includes("<%=")
|
|
213
|
+
? template(content, { interpolate: /<%=([\s\S]+?)%>/g })(
|
|
214
|
+
templateData,
|
|
215
|
+
)
|
|
216
|
+
: content;
|
|
217
|
+
|
|
218
|
+
const dest = `_IaC/${branch}/${config}`;
|
|
219
|
+
const newHash = crypto
|
|
220
|
+
.createHash("md5")
|
|
221
|
+
.update(output)
|
|
222
|
+
.digest("hex");
|
|
223
|
+
|
|
224
|
+
if (fs.existsSync(dest)) {
|
|
225
|
+
const existing = fs.readFileSync(dest, "utf8");
|
|
226
|
+
|
|
227
|
+
if (existing === output) {
|
|
228
|
+
checksums[config] = newHash;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const existingHash = crypto
|
|
233
|
+
.createHash("md5")
|
|
234
|
+
.update(existing)
|
|
235
|
+
.digest("hex");
|
|
236
|
+
|
|
237
|
+
let shouldOverwrite;
|
|
238
|
+
|
|
239
|
+
if (checksums[config] && existingHash === checksums[config]) {
|
|
240
|
+
const { overwrite } = await inquirer.prompt([
|
|
241
|
+
{
|
|
242
|
+
type: "confirm",
|
|
243
|
+
name: "overwrite",
|
|
244
|
+
message: `${dest} has an updated template, overwrite?`,
|
|
245
|
+
default: true,
|
|
246
|
+
},
|
|
247
|
+
]);
|
|
248
|
+
shouldOverwrite = overwrite;
|
|
249
|
+
} else {
|
|
250
|
+
const { overwrite } = await inquirer.prompt([
|
|
251
|
+
{
|
|
252
|
+
type: "confirm",
|
|
253
|
+
name: "overwrite",
|
|
254
|
+
message: `${dest} has been modified, overwrite?`,
|
|
255
|
+
default: false,
|
|
256
|
+
},
|
|
257
|
+
]);
|
|
258
|
+
shouldOverwrite = overwrite;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (!shouldOverwrite) continue;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
fs.outputFileSync(dest, output);
|
|
265
|
+
checksums[config] = newHash;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
170
268
|
|
|
171
|
-
|
|
172
|
-
glob.sync(globbed, { cwd: `${templates}` }).forEach((config) =>
|
|
173
|
-
fs.copySync(`${templates}/${config}`, config),
|
|
174
|
-
);
|
|
175
|
-
});
|
|
269
|
+
fs.outputFileSync(checksumPath, JSON.stringify(checksums, null, 4) + "\n");
|
|
176
270
|
|
|
177
|
-
fs.outputFileSync(
|
|
271
|
+
fs.outputFileSync(
|
|
272
|
+
`_IaC/${branch}/.elasticbeanstalk/config.yml`,
|
|
273
|
+
eb.config(),
|
|
274
|
+
);
|
|
178
275
|
};
|
|
179
276
|
|
|
180
277
|
module.exports.listApplications = async () => {
|
|
181
|
-
const client = new ElasticBeanstalkClient({});
|
|
182
|
-
|
|
183
278
|
const res = await Spinner.prototype.simple(
|
|
184
279
|
`Retrieving elasticbeanstalk applications`,
|
|
185
280
|
() => {
|
|
186
|
-
return
|
|
281
|
+
return getClient().send(new DescribeApplicationsCommand({}));
|
|
187
282
|
},
|
|
188
283
|
);
|
|
189
284
|
|
|
@@ -191,13 +286,11 @@ module.exports.listApplications = async () => {
|
|
|
191
286
|
};
|
|
192
287
|
|
|
193
288
|
module.exports.listApplicationVersions = async (applicationName) => {
|
|
194
|
-
const client = new ElasticBeanstalkClient({});
|
|
195
|
-
|
|
196
289
|
let versions = [];
|
|
197
290
|
let nextToken;
|
|
198
291
|
|
|
199
292
|
do {
|
|
200
|
-
const res = await
|
|
293
|
+
const res = await getClient().send(
|
|
201
294
|
new DescribeApplicationVersionsCommand({
|
|
202
295
|
ApplicationName: applicationName,
|
|
203
296
|
...(nextToken ? { NextToken: nextToken } : {}),
|
|
@@ -215,9 +308,7 @@ module.exports.createApplicationVersion = async (
|
|
|
215
308
|
applicationName,
|
|
216
309
|
versionLabel,
|
|
217
310
|
) => {
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
const res = await client.send(
|
|
311
|
+
const res = await getClient().send(
|
|
221
312
|
new CreateApplicationVersionCommand({
|
|
222
313
|
ApplicationName: applicationName,
|
|
223
314
|
VersionLabel: versionLabel,
|
|
@@ -232,9 +323,7 @@ module.exports.deleteApplicationVersion = async (
|
|
|
232
323
|
applicationName,
|
|
233
324
|
versionLabel,
|
|
234
325
|
) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
await client.send(
|
|
326
|
+
await getClient().send(
|
|
238
327
|
new DeleteApplicationVersionCommand({
|
|
239
328
|
ApplicationName: applicationName,
|
|
240
329
|
VersionLabel: versionLabel,
|
|
@@ -247,12 +336,10 @@ module.exports.describeConfigurationSettings = async (
|
|
|
247
336
|
applicationName,
|
|
248
337
|
environmentName,
|
|
249
338
|
) => {
|
|
250
|
-
const client = new ElasticBeanstalkClient({});
|
|
251
|
-
|
|
252
339
|
const res = await Spinner.prototype.simple(
|
|
253
340
|
`Retrieving configuration for ${environmentName}`,
|
|
254
341
|
() => {
|
|
255
|
-
return
|
|
342
|
+
return getClient().send(
|
|
256
343
|
new DescribeConfigurationSettingsCommand({
|
|
257
344
|
ApplicationName: applicationName,
|
|
258
345
|
EnvironmentName: environmentName,
|
|
@@ -269,12 +356,10 @@ module.exports.updateEnvironmentSettings = async (
|
|
|
269
356
|
optionSettings = [],
|
|
270
357
|
optionsToRemove = [],
|
|
271
358
|
) => {
|
|
272
|
-
const client = new ElasticBeanstalkClient({});
|
|
273
|
-
|
|
274
359
|
await Spinner.prototype.simple(
|
|
275
360
|
`Updating environment ${environmentName}`,
|
|
276
361
|
() => {
|
|
277
|
-
return
|
|
362
|
+
return getClient().send(
|
|
278
363
|
new UpdateEnvironmentCommand({
|
|
279
364
|
EnvironmentName: environmentName,
|
|
280
365
|
OptionSettings: optionSettings,
|
|
@@ -284,3 +369,16 @@ module.exports.updateEnvironmentSettings = async (
|
|
|
284
369
|
},
|
|
285
370
|
);
|
|
286
371
|
};
|
|
372
|
+
|
|
373
|
+
module.exports.restartAppServer = async (environmentName) => {
|
|
374
|
+
await Spinner.prototype.simple(
|
|
375
|
+
`Restarting app server for ${environmentName}`,
|
|
376
|
+
() => {
|
|
377
|
+
return getClient().send(
|
|
378
|
+
new RestartAppServerCommand({
|
|
379
|
+
EnvironmentName: environmentName,
|
|
380
|
+
}),
|
|
381
|
+
);
|
|
382
|
+
},
|
|
383
|
+
);
|
|
384
|
+
};
|