-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
67 lines (53 loc) · 1.63 KB
/
Copy pathdeploy.js
File metadata and controls
67 lines (53 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var path = require('path');
var fs = require('fs-extra');
var sleepPromise = require('sleep-promise');
var CarolinaLib = require('./_carolina');
var config = require('./config');
async function deploy() {
var messages = [];
var Carolina = new CarolinaLib(config);
try {
// create DynamoDB tables
await Carolina.createTables();
// create IAM role and add admin policy
await Carolina.createMasterRole();
await Carolina.addPolicyToMasterRole();
// create APIGateway API
await Carolina.createMasterAPI();
// allow some things to populate before proceding
await sleepPromise(5000);
// create public bucket if it does not exist
if (!Carolina.state.publicBucketExists) {
await Carolina.createPublicBucket();
var res = await Carolina.configurePublicBucket();
console.log(res);
}
if (!Carolina.state.privateBucketExists) {
await Carolina.createPrivateBucket();
}
// fill S3 buckets
await Carolina.fillPublicBucket();
await Carolina.fillPrivateBucket();
await sleepPromise(5000);
// create/update Lambda functions
await Carolina.putHttpPackages();
await Carolina.putSvcPackages();
// create/update APIGateway Endpoints
await Carolina.createEndpoints();
// deploy api
await Carolina.deployAPI();
// write frontend config file with API url
await Carolina.writeFrontEndConfigFile();
console.log(Carolina.state);
await Carolina.putState();
}
catch(err) {
console.log(err);
}
finally {
await Carolina.saveState();
}
console.log(`Your site is running at:`);
console.log(Carolina.publicUrl);
}
deploy();