@korajs/cli 0.3.4 → 0.4.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/dist/bin.cjs +266 -222
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +25 -11
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-HNVCNPER.js → chunk-CMSX76KM.js} +5 -2
- package/dist/chunk-CMSX76KM.js.map +1 -0
- package/dist/{chunk-ULTO5NFA.js → chunk-MVP5PDT4.js} +2 -2
- package/dist/chunk-MVP5PDT4.js.map +1 -0
- package/dist/{chunk-MIMLCXSX.js → chunk-YGVO4POI.js} +242 -215
- package/dist/chunk-YGVO4POI.js.map +1 -0
- package/dist/create.cjs +4 -1
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +244 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/templates/tauri-react/src-tauri/tauri.conf.json +1 -1
- package/dist/chunk-HNVCNPER.js.map +0 -1
- package/dist/chunk-MIMLCXSX.js.map +0 -1
- package/dist/chunk-ULTO5NFA.js.map +0 -1
|
@@ -5,18 +5,26 @@ import {
|
|
|
5
5
|
createPromptClient,
|
|
6
6
|
findProjectRoot,
|
|
7
7
|
resolveProjectBinaryEntryPoint
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CMSX76KM.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/deploy/adapters/adapter.ts
|
|
11
|
-
var DEPLOY_PLATFORMS = [
|
|
11
|
+
var DEPLOY_PLATFORMS = [
|
|
12
|
+
"fly",
|
|
13
|
+
"railway",
|
|
14
|
+
"aws-ecs",
|
|
15
|
+
"aws-lightsail",
|
|
16
|
+
"render",
|
|
17
|
+
"docker",
|
|
18
|
+
"kora-cloud"
|
|
19
|
+
];
|
|
12
20
|
function isDeployPlatform(value) {
|
|
13
21
|
return DEPLOY_PLATFORMS.includes(value);
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
// src/commands/deploy/builder/client-builder.ts
|
|
17
25
|
import { spawn } from "child_process";
|
|
18
|
-
import { copyFile, readdir } from "fs/promises";
|
|
19
26
|
import { existsSync } from "fs";
|
|
27
|
+
import { copyFile, readdir } from "fs/promises";
|
|
20
28
|
import { join, resolve } from "path";
|
|
21
29
|
async function buildClient(options) {
|
|
22
30
|
const viteEntryPoint = await resolveProjectBinaryEntryPoint(options.projectRoot, "vite", "vite");
|
|
@@ -940,37 +948,46 @@ var AwsEcsAdapter = class {
|
|
|
940
948
|
};
|
|
941
949
|
const region = config.region ?? "us-east-1";
|
|
942
950
|
const repoName = `kora/${config.appName}`;
|
|
943
|
-
const createRepo = await this.runner.run(
|
|
944
|
-
"
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
951
|
+
const createRepo = await this.runner.run(
|
|
952
|
+
"aws",
|
|
953
|
+
[
|
|
954
|
+
"ecr",
|
|
955
|
+
"create-repository",
|
|
956
|
+
"--repository-name",
|
|
957
|
+
repoName,
|
|
958
|
+
"--region",
|
|
959
|
+
region,
|
|
960
|
+
"--image-scanning-configuration",
|
|
961
|
+
"scanOnPush=true"
|
|
962
|
+
],
|
|
963
|
+
config.projectRoot
|
|
964
|
+
);
|
|
953
965
|
if (createRepo.exitCode !== 0 && !createRepo.stderr.includes("RepositoryAlreadyExistsException")) {
|
|
954
966
|
throw new Error(`Failed to create ECR repository: ${createRepo.stderr}`);
|
|
955
967
|
}
|
|
956
|
-
const identity = await this.runner.run(
|
|
968
|
+
const identity = await this.runner.run(
|
|
969
|
+
"aws",
|
|
970
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
971
|
+
config.projectRoot
|
|
972
|
+
);
|
|
957
973
|
const accountId = identity.stdout.trim();
|
|
958
|
-
await this.runner.run(
|
|
959
|
-
"
|
|
960
|
-
"create-cluster",
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
+
await this.runner.run(
|
|
975
|
+
"aws",
|
|
976
|
+
["ecs", "create-cluster", "--cluster-name", config.appName, "--region", region],
|
|
977
|
+
config.projectRoot
|
|
978
|
+
);
|
|
979
|
+
await this.runner.run(
|
|
980
|
+
"aws",
|
|
981
|
+
[
|
|
982
|
+
"logs",
|
|
983
|
+
"create-log-group",
|
|
984
|
+
"--log-group-name",
|
|
985
|
+
`/ecs/${config.appName}`,
|
|
986
|
+
"--region",
|
|
987
|
+
region
|
|
988
|
+
],
|
|
989
|
+
config.projectRoot
|
|
990
|
+
);
|
|
974
991
|
return {
|
|
975
992
|
applicationId: `${accountId}.dkr.ecr.${region}.amazonaws.com/${repoName}`,
|
|
976
993
|
databaseId: null,
|
|
@@ -1003,50 +1020,42 @@ var AwsEcsAdapter = class {
|
|
|
1003
1020
|
const context = this.requireContext();
|
|
1004
1021
|
const region = context.region ?? "us-east-1";
|
|
1005
1022
|
const repoName = `kora/${context.appName}`;
|
|
1006
|
-
const loginPassword = await this.runner.run(
|
|
1007
|
-
"
|
|
1008
|
-
"get-login-password",
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
], context.projectRoot);
|
|
1023
|
+
const loginPassword = await this.runner.run(
|
|
1024
|
+
"aws",
|
|
1025
|
+
["ecr", "get-login-password", "--region", region],
|
|
1026
|
+
context.projectRoot
|
|
1027
|
+
);
|
|
1012
1028
|
if (loginPassword.exitCode !== 0) {
|
|
1013
1029
|
throw new Error(`ECR login failed: ${loginPassword.stderr}`);
|
|
1014
1030
|
}
|
|
1015
|
-
const identity = await this.runner.run(
|
|
1016
|
-
"
|
|
1017
|
-
"get-caller-identity",
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
"--output",
|
|
1021
|
-
"text"
|
|
1022
|
-
], context.projectRoot);
|
|
1031
|
+
const identity = await this.runner.run(
|
|
1032
|
+
"aws",
|
|
1033
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
1034
|
+
context.projectRoot
|
|
1035
|
+
);
|
|
1023
1036
|
const accountId = identity.stdout.trim();
|
|
1024
1037
|
const ecrUri = `${accountId}.dkr.ecr.${region}.amazonaws.com`;
|
|
1025
1038
|
const imageUri = `${ecrUri}/${repoName}:latest`;
|
|
1026
|
-
const dockerLogin = await this.runner.run(
|
|
1027
|
-
"
|
|
1028
|
-
"--username",
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
ecrUri
|
|
1032
|
-
], artifacts.deployDirectory);
|
|
1039
|
+
const dockerLogin = await this.runner.run(
|
|
1040
|
+
"docker",
|
|
1041
|
+
["login", "--username", "AWS", "--password-stdin", ecrUri],
|
|
1042
|
+
artifacts.deployDirectory
|
|
1043
|
+
);
|
|
1033
1044
|
this.logger.step("Building Docker image...");
|
|
1034
|
-
const dockerBuild = await this.runner.run(
|
|
1035
|
-
"
|
|
1036
|
-
"--platform",
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
imageUri,
|
|
1040
|
-
"."
|
|
1041
|
-
], artifacts.deployDirectory);
|
|
1045
|
+
const dockerBuild = await this.runner.run(
|
|
1046
|
+
"docker",
|
|
1047
|
+
["build", "--platform", "linux/amd64", "-t", imageUri, "."],
|
|
1048
|
+
artifacts.deployDirectory
|
|
1049
|
+
);
|
|
1042
1050
|
if (dockerBuild.exitCode !== 0) {
|
|
1043
1051
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
1044
1052
|
}
|
|
1045
1053
|
this.logger.step("Pushing image to ECR...");
|
|
1046
|
-
const dockerPush = await this.runner.run(
|
|
1047
|
-
"
|
|
1048
|
-
imageUri
|
|
1049
|
-
|
|
1054
|
+
const dockerPush = await this.runner.run(
|
|
1055
|
+
"docker",
|
|
1056
|
+
["push", imageUri],
|
|
1057
|
+
artifacts.deployDirectory
|
|
1058
|
+
);
|
|
1050
1059
|
if (dockerPush.exitCode !== 0) {
|
|
1051
1060
|
throw new Error(`Docker push failed: ${dockerPush.stderr}`);
|
|
1052
1061
|
}
|
|
@@ -1057,52 +1066,55 @@ var AwsEcsAdapter = class {
|
|
|
1057
1066
|
cpu: "256",
|
|
1058
1067
|
memory: "512",
|
|
1059
1068
|
executionRoleArn: `arn:aws:iam::${accountId}:role/ecsTaskExecutionRole`,
|
|
1060
|
-
containerDefinitions: [
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1069
|
+
containerDefinitions: [
|
|
1070
|
+
{
|
|
1071
|
+
name: context.appName,
|
|
1072
|
+
image: imageUri,
|
|
1073
|
+
essential: true,
|
|
1074
|
+
portMappings: [{ containerPort: 3001, protocol: "tcp" }],
|
|
1075
|
+
logConfiguration: {
|
|
1076
|
+
logDriver: "awslogs",
|
|
1077
|
+
options: {
|
|
1078
|
+
"awslogs-group": `/ecs/${context.appName}`,
|
|
1079
|
+
"awslogs-region": region,
|
|
1080
|
+
"awslogs-stream-prefix": "ecs"
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
healthCheck: {
|
|
1084
|
+
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
1085
|
+
interval: 30,
|
|
1086
|
+
timeout: 5,
|
|
1087
|
+
retries: 3,
|
|
1088
|
+
startPeriod: 60
|
|
1071
1089
|
}
|
|
1072
|
-
},
|
|
1073
|
-
healthCheck: {
|
|
1074
|
-
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
1075
|
-
interval: 30,
|
|
1076
|
-
timeout: 5,
|
|
1077
|
-
retries: 3,
|
|
1078
|
-
startPeriod: 60
|
|
1079
1090
|
}
|
|
1080
|
-
|
|
1091
|
+
]
|
|
1081
1092
|
});
|
|
1082
|
-
const registerTask = await this.runner.run(
|
|
1083
|
-
"
|
|
1084
|
-
"register-task-definition",
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
"--region",
|
|
1088
|
-
region
|
|
1089
|
-
], context.projectRoot);
|
|
1093
|
+
const registerTask = await this.runner.run(
|
|
1094
|
+
"aws",
|
|
1095
|
+
["ecs", "register-task-definition", "--cli-input-json", taskDef, "--region", region],
|
|
1096
|
+
context.projectRoot
|
|
1097
|
+
);
|
|
1090
1098
|
if (registerTask.exitCode !== 0) {
|
|
1091
1099
|
throw new Error(`Task definition registration failed: ${registerTask.stderr}`);
|
|
1092
1100
|
}
|
|
1093
|
-
const updateService = await this.runner.run(
|
|
1094
|
-
"
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1101
|
+
const updateService = await this.runner.run(
|
|
1102
|
+
"aws",
|
|
1103
|
+
[
|
|
1104
|
+
"ecs",
|
|
1105
|
+
"update-service",
|
|
1106
|
+
"--cluster",
|
|
1107
|
+
context.appName,
|
|
1108
|
+
"--service",
|
|
1109
|
+
context.appName,
|
|
1110
|
+
"--task-definition",
|
|
1111
|
+
context.appName,
|
|
1112
|
+
"--force-new-deployment",
|
|
1113
|
+
"--region",
|
|
1114
|
+
region
|
|
1115
|
+
],
|
|
1116
|
+
context.projectRoot
|
|
1117
|
+
);
|
|
1106
1118
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
1107
1119
|
if (updateService.exitCode !== 0) {
|
|
1108
1120
|
this.logger.step("Service not found, creating new service...");
|
|
@@ -1127,19 +1139,23 @@ var AwsEcsAdapter = class {
|
|
|
1127
1139
|
async rollback(deploymentId) {
|
|
1128
1140
|
const context = this.requireContext();
|
|
1129
1141
|
const region = context.region ?? "us-east-1";
|
|
1130
|
-
const result = await this.runner.run(
|
|
1131
|
-
"
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1142
|
+
const result = await this.runner.run(
|
|
1143
|
+
"aws",
|
|
1144
|
+
[
|
|
1145
|
+
"ecs",
|
|
1146
|
+
"update-service",
|
|
1147
|
+
"--cluster",
|
|
1148
|
+
context.appName,
|
|
1149
|
+
"--service",
|
|
1150
|
+
context.appName,
|
|
1151
|
+
"--task-definition",
|
|
1152
|
+
`${context.appName}:${deploymentId}`,
|
|
1153
|
+
"--force-new-deployment",
|
|
1154
|
+
"--region",
|
|
1155
|
+
region
|
|
1156
|
+
],
|
|
1157
|
+
context.projectRoot
|
|
1158
|
+
);
|
|
1143
1159
|
if (result.exitCode !== 0) {
|
|
1144
1160
|
throw new Error(`ECS rollback failed: ${result.stderr}`);
|
|
1145
1161
|
}
|
|
@@ -1182,16 +1198,20 @@ var AwsEcsAdapter = class {
|
|
|
1182
1198
|
async status() {
|
|
1183
1199
|
const context = this.requireContext();
|
|
1184
1200
|
const region = context.region ?? "us-east-1";
|
|
1185
|
-
const result = await this.runner.run(
|
|
1186
|
-
"
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1201
|
+
const result = await this.runner.run(
|
|
1202
|
+
"aws",
|
|
1203
|
+
[
|
|
1204
|
+
"ecs",
|
|
1205
|
+
"describe-services",
|
|
1206
|
+
"--cluster",
|
|
1207
|
+
context.appName,
|
|
1208
|
+
"--services",
|
|
1209
|
+
context.appName,
|
|
1210
|
+
"--region",
|
|
1211
|
+
region
|
|
1212
|
+
],
|
|
1213
|
+
context.projectRoot
|
|
1214
|
+
);
|
|
1195
1215
|
if (result.exitCode !== 0) {
|
|
1196
1216
|
return { state: "failed", message: result.stderr };
|
|
1197
1217
|
}
|
|
@@ -1300,18 +1320,22 @@ var AwsLightsailAdapter = class {
|
|
|
1300
1320
|
};
|
|
1301
1321
|
const region = config.region ?? "us-east-1";
|
|
1302
1322
|
const serviceName = sanitizeLightsailName(config.appName);
|
|
1303
|
-
const createService = await this.runner.run(
|
|
1304
|
-
"
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1323
|
+
const createService = await this.runner.run(
|
|
1324
|
+
"aws",
|
|
1325
|
+
[
|
|
1326
|
+
"lightsail",
|
|
1327
|
+
"create-container-service",
|
|
1328
|
+
"--service-name",
|
|
1329
|
+
serviceName,
|
|
1330
|
+
"--power",
|
|
1331
|
+
"nano",
|
|
1332
|
+
"--scale",
|
|
1333
|
+
"1",
|
|
1334
|
+
"--region",
|
|
1335
|
+
region
|
|
1336
|
+
],
|
|
1337
|
+
config.projectRoot
|
|
1338
|
+
);
|
|
1315
1339
|
if (createService.exitCode !== 0 && !createService.stderr.includes("already exists")) {
|
|
1316
1340
|
throw new Error(`Failed to create Lightsail container service: ${createService.stderr}`);
|
|
1317
1341
|
}
|
|
@@ -1349,30 +1373,31 @@ var AwsLightsailAdapter = class {
|
|
|
1349
1373
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1350
1374
|
const imageTag = `${serviceName}:latest`;
|
|
1351
1375
|
this.logger.step("Building Docker image...");
|
|
1352
|
-
const dockerBuild = await this.runner.run(
|
|
1353
|
-
"
|
|
1354
|
-
"--platform",
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
imageTag,
|
|
1358
|
-
"."
|
|
1359
|
-
], artifacts.deployDirectory);
|
|
1376
|
+
const dockerBuild = await this.runner.run(
|
|
1377
|
+
"docker",
|
|
1378
|
+
["build", "--platform", "linux/amd64", "-t", imageTag, "."],
|
|
1379
|
+
artifacts.deployDirectory
|
|
1380
|
+
);
|
|
1360
1381
|
if (dockerBuild.exitCode !== 0) {
|
|
1361
1382
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
1362
1383
|
}
|
|
1363
1384
|
this.logger.step("Pushing image to Lightsail...");
|
|
1364
|
-
const pushImage = await this.runner.run(
|
|
1365
|
-
"
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1385
|
+
const pushImage = await this.runner.run(
|
|
1386
|
+
"aws",
|
|
1387
|
+
[
|
|
1388
|
+
"lightsail",
|
|
1389
|
+
"push-container-image",
|
|
1390
|
+
"--service-name",
|
|
1391
|
+
serviceName,
|
|
1392
|
+
"--label",
|
|
1393
|
+
"latest",
|
|
1394
|
+
"--image",
|
|
1395
|
+
imageTag,
|
|
1396
|
+
"--region",
|
|
1397
|
+
region
|
|
1398
|
+
],
|
|
1399
|
+
artifacts.deployDirectory
|
|
1400
|
+
);
|
|
1376
1401
|
if (pushImage.exitCode !== 0) {
|
|
1377
1402
|
throw new Error(`Lightsail image push failed: ${pushImage.stderr}`);
|
|
1378
1403
|
}
|
|
@@ -1403,29 +1428,30 @@ var AwsLightsailAdapter = class {
|
|
|
1403
1428
|
unhealthyThreshold: 3
|
|
1404
1429
|
}
|
|
1405
1430
|
});
|
|
1406
|
-
const createDeploy = await this.runner.run(
|
|
1407
|
-
"
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1431
|
+
const createDeploy = await this.runner.run(
|
|
1432
|
+
"aws",
|
|
1433
|
+
[
|
|
1434
|
+
"lightsail",
|
|
1435
|
+
"create-container-service-deployment",
|
|
1436
|
+
"--service-name",
|
|
1437
|
+
serviceName,
|
|
1438
|
+
"--containers",
|
|
1439
|
+
containers,
|
|
1440
|
+
"--public-endpoint",
|
|
1441
|
+
publicEndpoint,
|
|
1442
|
+
"--region",
|
|
1443
|
+
region
|
|
1444
|
+
],
|
|
1445
|
+
context.projectRoot
|
|
1446
|
+
);
|
|
1418
1447
|
if (createDeploy.exitCode !== 0) {
|
|
1419
1448
|
throw new Error(`Lightsail deployment failed: ${createDeploy.stderr}`);
|
|
1420
1449
|
}
|
|
1421
|
-
const serviceInfo = await this.runner.run(
|
|
1422
|
-
"
|
|
1423
|
-
"get-container-services",
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
"--region",
|
|
1427
|
-
region
|
|
1428
|
-
], context.projectRoot);
|
|
1450
|
+
const serviceInfo = await this.runner.run(
|
|
1451
|
+
"aws",
|
|
1452
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
1453
|
+
context.projectRoot
|
|
1454
|
+
);
|
|
1429
1455
|
const rawUrl = parseLightsailUrl(serviceInfo.stdout) ?? `https://${serviceName}.${region}.cs.amazonlightsail.com`;
|
|
1430
1456
|
const serviceUrl = rawUrl.replace(/\/+$/, "");
|
|
1431
1457
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -1439,14 +1465,18 @@ var AwsLightsailAdapter = class {
|
|
|
1439
1465
|
const context = this.requireContext();
|
|
1440
1466
|
const region = context.region ?? "us-east-1";
|
|
1441
1467
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1442
|
-
const deployments = await this.runner.run(
|
|
1443
|
-
"
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1468
|
+
const deployments = await this.runner.run(
|
|
1469
|
+
"aws",
|
|
1470
|
+
[
|
|
1471
|
+
"lightsail",
|
|
1472
|
+
"get-container-service-deployments",
|
|
1473
|
+
"--service-name",
|
|
1474
|
+
serviceName,
|
|
1475
|
+
"--region",
|
|
1476
|
+
region
|
|
1477
|
+
],
|
|
1478
|
+
context.projectRoot
|
|
1479
|
+
);
|
|
1450
1480
|
if (deployments.exitCode !== 0) {
|
|
1451
1481
|
throw new Error(`Lightsail rollback failed: ${deployments.stderr}`);
|
|
1452
1482
|
}
|
|
@@ -1454,18 +1484,22 @@ var AwsLightsailAdapter = class {
|
|
|
1454
1484
|
if (!previousDeployment) {
|
|
1455
1485
|
throw new Error("No previous deployment found to rollback to.");
|
|
1456
1486
|
}
|
|
1457
|
-
const redeploy = await this.runner.run(
|
|
1458
|
-
"
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1487
|
+
const redeploy = await this.runner.run(
|
|
1488
|
+
"aws",
|
|
1489
|
+
[
|
|
1490
|
+
"lightsail",
|
|
1491
|
+
"create-container-service-deployment",
|
|
1492
|
+
"--service-name",
|
|
1493
|
+
serviceName,
|
|
1494
|
+
"--containers",
|
|
1495
|
+
JSON.stringify(previousDeployment.containers),
|
|
1496
|
+
"--public-endpoint",
|
|
1497
|
+
JSON.stringify(previousDeployment.publicEndpoint),
|
|
1498
|
+
"--region",
|
|
1499
|
+
region
|
|
1500
|
+
],
|
|
1501
|
+
context.projectRoot
|
|
1502
|
+
);
|
|
1469
1503
|
if (redeploy.exitCode !== 0) {
|
|
1470
1504
|
throw new Error(`Lightsail rollback deployment failed: ${redeploy.stderr}`);
|
|
1471
1505
|
}
|
|
@@ -1512,14 +1546,11 @@ var AwsLightsailAdapter = class {
|
|
|
1512
1546
|
const context = this.requireContext();
|
|
1513
1547
|
const region = context.region ?? "us-east-1";
|
|
1514
1548
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1515
|
-
const result = await this.runner.run(
|
|
1516
|
-
"
|
|
1517
|
-
"get-container-services",
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
"--region",
|
|
1521
|
-
region
|
|
1522
|
-
], context.projectRoot);
|
|
1549
|
+
const result = await this.runner.run(
|
|
1550
|
+
"aws",
|
|
1551
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
1552
|
+
context.projectRoot
|
|
1553
|
+
);
|
|
1523
1554
|
if (result.exitCode !== 0) {
|
|
1524
1555
|
return { state: "failed", message: result.stderr };
|
|
1525
1556
|
}
|
|
@@ -1584,12 +1615,7 @@ ${error.message}` });
|
|
|
1584
1615
|
});
|
|
1585
1616
|
}
|
|
1586
1617
|
};
|
|
1587
|
-
var PASSTHROUGH_ENV_VARS = [
|
|
1588
|
-
"DATABASE_URL",
|
|
1589
|
-
"AUTH_SECRET",
|
|
1590
|
-
"PUBLIC_URL",
|
|
1591
|
-
"NODE_ENV"
|
|
1592
|
-
];
|
|
1618
|
+
var PASSTHROUGH_ENV_VARS = ["DATABASE_URL", "AUTH_SECRET", "PUBLIC_URL", "NODE_ENV"];
|
|
1593
1619
|
function sanitizeLightsailName(name) {
|
|
1594
1620
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "").slice(0, 255) || "kora-app";
|
|
1595
1621
|
}
|
|
@@ -1700,7 +1726,8 @@ function generateDeployPackageJson(nativeDependencies) {
|
|
|
1700
1726
|
type: "module",
|
|
1701
1727
|
dependencies: nativeDependencies
|
|
1702
1728
|
};
|
|
1703
|
-
return JSON.stringify(pkg, null, 2)
|
|
1729
|
+
return `${JSON.stringify(pkg, null, 2)}
|
|
1730
|
+
`;
|
|
1704
1731
|
}
|
|
1705
1732
|
function generateDockerIgnore() {
|
|
1706
1733
|
return [
|
|
@@ -2034,7 +2061,7 @@ var deployCommand = defineCommand({
|
|
|
2034
2061
|
nativeDependencies: {
|
|
2035
2062
|
"better-sqlite3": "^11.0.0",
|
|
2036
2063
|
"drizzle-orm": "^0.45.2",
|
|
2037
|
-
|
|
2064
|
+
postgres: "^3.4.0"
|
|
2038
2065
|
}
|
|
2039
2066
|
});
|
|
2040
2067
|
await writeDockerIgnoreArtifact(deployDirectory);
|
|
@@ -2299,4 +2326,4 @@ export {
|
|
|
2299
2326
|
deployCommand,
|
|
2300
2327
|
generateTypes
|
|
2301
2328
|
};
|
|
2302
|
-
//# sourceMappingURL=chunk-
|
|
2329
|
+
//# sourceMappingURL=chunk-YGVO4POI.js.map
|