@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
package/dist/index.cjs
CHANGED
|
@@ -350,6 +350,7 @@ function promptConfirm(message, defaultValue = false, options) {
|
|
|
350
350
|
resolve3(false);
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
+
;
|
|
353
354
|
(options?.output ?? process.stdout).write(" Please answer with y or n\n");
|
|
354
355
|
ask();
|
|
355
356
|
});
|
|
@@ -542,7 +543,15 @@ function createLogger(options) {
|
|
|
542
543
|
}
|
|
543
544
|
|
|
544
545
|
// src/commands/deploy/adapters/adapter.ts
|
|
545
|
-
var DEPLOY_PLATFORMS = [
|
|
546
|
+
var DEPLOY_PLATFORMS = [
|
|
547
|
+
"fly",
|
|
548
|
+
"railway",
|
|
549
|
+
"aws-ecs",
|
|
550
|
+
"aws-lightsail",
|
|
551
|
+
"render",
|
|
552
|
+
"docker",
|
|
553
|
+
"kora-cloud"
|
|
554
|
+
];
|
|
546
555
|
function isDeployPlatform(value) {
|
|
547
556
|
return DEPLOY_PLATFORMS.includes(value);
|
|
548
557
|
}
|
|
@@ -553,8 +562,8 @@ var import_node_path4 = require("path");
|
|
|
553
562
|
|
|
554
563
|
// src/commands/deploy/builder/client-builder.ts
|
|
555
564
|
var import_node_child_process = require("child_process");
|
|
556
|
-
var import_promises2 = require("fs/promises");
|
|
557
565
|
var import_node_fs = require("fs");
|
|
566
|
+
var import_promises2 = require("fs/promises");
|
|
558
567
|
var import_node_path2 = require("path");
|
|
559
568
|
async function buildClient(options) {
|
|
560
569
|
const viteEntryPoint = await resolveProjectBinaryEntryPoint(options.projectRoot, "vite", "vite");
|
|
@@ -712,37 +721,46 @@ var AwsEcsAdapter = class {
|
|
|
712
721
|
};
|
|
713
722
|
const region = config.region ?? "us-east-1";
|
|
714
723
|
const repoName = `kora/${config.appName}`;
|
|
715
|
-
const createRepo = await this.runner.run(
|
|
716
|
-
"
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
724
|
+
const createRepo = await this.runner.run(
|
|
725
|
+
"aws",
|
|
726
|
+
[
|
|
727
|
+
"ecr",
|
|
728
|
+
"create-repository",
|
|
729
|
+
"--repository-name",
|
|
730
|
+
repoName,
|
|
731
|
+
"--region",
|
|
732
|
+
region,
|
|
733
|
+
"--image-scanning-configuration",
|
|
734
|
+
"scanOnPush=true"
|
|
735
|
+
],
|
|
736
|
+
config.projectRoot
|
|
737
|
+
);
|
|
725
738
|
if (createRepo.exitCode !== 0 && !createRepo.stderr.includes("RepositoryAlreadyExistsException")) {
|
|
726
739
|
throw new Error(`Failed to create ECR repository: ${createRepo.stderr}`);
|
|
727
740
|
}
|
|
728
|
-
const identity = await this.runner.run(
|
|
741
|
+
const identity = await this.runner.run(
|
|
742
|
+
"aws",
|
|
743
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
744
|
+
config.projectRoot
|
|
745
|
+
);
|
|
729
746
|
const accountId = identity.stdout.trim();
|
|
730
|
-
await this.runner.run(
|
|
731
|
-
"
|
|
732
|
-
"create-cluster",
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
747
|
+
await this.runner.run(
|
|
748
|
+
"aws",
|
|
749
|
+
["ecs", "create-cluster", "--cluster-name", config.appName, "--region", region],
|
|
750
|
+
config.projectRoot
|
|
751
|
+
);
|
|
752
|
+
await this.runner.run(
|
|
753
|
+
"aws",
|
|
754
|
+
[
|
|
755
|
+
"logs",
|
|
756
|
+
"create-log-group",
|
|
757
|
+
"--log-group-name",
|
|
758
|
+
`/ecs/${config.appName}`,
|
|
759
|
+
"--region",
|
|
760
|
+
region
|
|
761
|
+
],
|
|
762
|
+
config.projectRoot
|
|
763
|
+
);
|
|
746
764
|
return {
|
|
747
765
|
applicationId: `${accountId}.dkr.ecr.${region}.amazonaws.com/${repoName}`,
|
|
748
766
|
databaseId: null,
|
|
@@ -775,50 +793,42 @@ var AwsEcsAdapter = class {
|
|
|
775
793
|
const context = this.requireContext();
|
|
776
794
|
const region = context.region ?? "us-east-1";
|
|
777
795
|
const repoName = `kora/${context.appName}`;
|
|
778
|
-
const loginPassword = await this.runner.run(
|
|
779
|
-
"
|
|
780
|
-
"get-login-password",
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
], context.projectRoot);
|
|
796
|
+
const loginPassword = await this.runner.run(
|
|
797
|
+
"aws",
|
|
798
|
+
["ecr", "get-login-password", "--region", region],
|
|
799
|
+
context.projectRoot
|
|
800
|
+
);
|
|
784
801
|
if (loginPassword.exitCode !== 0) {
|
|
785
802
|
throw new Error(`ECR login failed: ${loginPassword.stderr}`);
|
|
786
803
|
}
|
|
787
|
-
const identity = await this.runner.run(
|
|
788
|
-
"
|
|
789
|
-
"get-caller-identity",
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
"--output",
|
|
793
|
-
"text"
|
|
794
|
-
], context.projectRoot);
|
|
804
|
+
const identity = await this.runner.run(
|
|
805
|
+
"aws",
|
|
806
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
807
|
+
context.projectRoot
|
|
808
|
+
);
|
|
795
809
|
const accountId = identity.stdout.trim();
|
|
796
810
|
const ecrUri = `${accountId}.dkr.ecr.${region}.amazonaws.com`;
|
|
797
811
|
const imageUri = `${ecrUri}/${repoName}:latest`;
|
|
798
|
-
const dockerLogin = await this.runner.run(
|
|
799
|
-
"
|
|
800
|
-
"--username",
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
ecrUri
|
|
804
|
-
], artifacts.deployDirectory);
|
|
812
|
+
const dockerLogin = await this.runner.run(
|
|
813
|
+
"docker",
|
|
814
|
+
["login", "--username", "AWS", "--password-stdin", ecrUri],
|
|
815
|
+
artifacts.deployDirectory
|
|
816
|
+
);
|
|
805
817
|
this.logger.step("Building Docker image...");
|
|
806
|
-
const dockerBuild = await this.runner.run(
|
|
807
|
-
"
|
|
808
|
-
"--platform",
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
imageUri,
|
|
812
|
-
"."
|
|
813
|
-
], artifacts.deployDirectory);
|
|
818
|
+
const dockerBuild = await this.runner.run(
|
|
819
|
+
"docker",
|
|
820
|
+
["build", "--platform", "linux/amd64", "-t", imageUri, "."],
|
|
821
|
+
artifacts.deployDirectory
|
|
822
|
+
);
|
|
814
823
|
if (dockerBuild.exitCode !== 0) {
|
|
815
824
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
816
825
|
}
|
|
817
826
|
this.logger.step("Pushing image to ECR...");
|
|
818
|
-
const dockerPush = await this.runner.run(
|
|
819
|
-
"
|
|
820
|
-
imageUri
|
|
821
|
-
|
|
827
|
+
const dockerPush = await this.runner.run(
|
|
828
|
+
"docker",
|
|
829
|
+
["push", imageUri],
|
|
830
|
+
artifacts.deployDirectory
|
|
831
|
+
);
|
|
822
832
|
if (dockerPush.exitCode !== 0) {
|
|
823
833
|
throw new Error(`Docker push failed: ${dockerPush.stderr}`);
|
|
824
834
|
}
|
|
@@ -829,52 +839,55 @@ var AwsEcsAdapter = class {
|
|
|
829
839
|
cpu: "256",
|
|
830
840
|
memory: "512",
|
|
831
841
|
executionRoleArn: `arn:aws:iam::${accountId}:role/ecsTaskExecutionRole`,
|
|
832
|
-
containerDefinitions: [
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
842
|
+
containerDefinitions: [
|
|
843
|
+
{
|
|
844
|
+
name: context.appName,
|
|
845
|
+
image: imageUri,
|
|
846
|
+
essential: true,
|
|
847
|
+
portMappings: [{ containerPort: 3001, protocol: "tcp" }],
|
|
848
|
+
logConfiguration: {
|
|
849
|
+
logDriver: "awslogs",
|
|
850
|
+
options: {
|
|
851
|
+
"awslogs-group": `/ecs/${context.appName}`,
|
|
852
|
+
"awslogs-region": region,
|
|
853
|
+
"awslogs-stream-prefix": "ecs"
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
healthCheck: {
|
|
857
|
+
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
858
|
+
interval: 30,
|
|
859
|
+
timeout: 5,
|
|
860
|
+
retries: 3,
|
|
861
|
+
startPeriod: 60
|
|
843
862
|
}
|
|
844
|
-
},
|
|
845
|
-
healthCheck: {
|
|
846
|
-
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
847
|
-
interval: 30,
|
|
848
|
-
timeout: 5,
|
|
849
|
-
retries: 3,
|
|
850
|
-
startPeriod: 60
|
|
851
863
|
}
|
|
852
|
-
|
|
864
|
+
]
|
|
853
865
|
});
|
|
854
|
-
const registerTask = await this.runner.run(
|
|
855
|
-
"
|
|
856
|
-
"register-task-definition",
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
"--region",
|
|
860
|
-
region
|
|
861
|
-
], context.projectRoot);
|
|
866
|
+
const registerTask = await this.runner.run(
|
|
867
|
+
"aws",
|
|
868
|
+
["ecs", "register-task-definition", "--cli-input-json", taskDef, "--region", region],
|
|
869
|
+
context.projectRoot
|
|
870
|
+
);
|
|
862
871
|
if (registerTask.exitCode !== 0) {
|
|
863
872
|
throw new Error(`Task definition registration failed: ${registerTask.stderr}`);
|
|
864
873
|
}
|
|
865
|
-
const updateService = await this.runner.run(
|
|
866
|
-
"
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
874
|
+
const updateService = await this.runner.run(
|
|
875
|
+
"aws",
|
|
876
|
+
[
|
|
877
|
+
"ecs",
|
|
878
|
+
"update-service",
|
|
879
|
+
"--cluster",
|
|
880
|
+
context.appName,
|
|
881
|
+
"--service",
|
|
882
|
+
context.appName,
|
|
883
|
+
"--task-definition",
|
|
884
|
+
context.appName,
|
|
885
|
+
"--force-new-deployment",
|
|
886
|
+
"--region",
|
|
887
|
+
region
|
|
888
|
+
],
|
|
889
|
+
context.projectRoot
|
|
890
|
+
);
|
|
878
891
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
879
892
|
if (updateService.exitCode !== 0) {
|
|
880
893
|
this.logger.step("Service not found, creating new service...");
|
|
@@ -899,19 +912,23 @@ var AwsEcsAdapter = class {
|
|
|
899
912
|
async rollback(deploymentId) {
|
|
900
913
|
const context = this.requireContext();
|
|
901
914
|
const region = context.region ?? "us-east-1";
|
|
902
|
-
const result = await this.runner.run(
|
|
903
|
-
"
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
+
const result = await this.runner.run(
|
|
916
|
+
"aws",
|
|
917
|
+
[
|
|
918
|
+
"ecs",
|
|
919
|
+
"update-service",
|
|
920
|
+
"--cluster",
|
|
921
|
+
context.appName,
|
|
922
|
+
"--service",
|
|
923
|
+
context.appName,
|
|
924
|
+
"--task-definition",
|
|
925
|
+
`${context.appName}:${deploymentId}`,
|
|
926
|
+
"--force-new-deployment",
|
|
927
|
+
"--region",
|
|
928
|
+
region
|
|
929
|
+
],
|
|
930
|
+
context.projectRoot
|
|
931
|
+
);
|
|
915
932
|
if (result.exitCode !== 0) {
|
|
916
933
|
throw new Error(`ECS rollback failed: ${result.stderr}`);
|
|
917
934
|
}
|
|
@@ -954,16 +971,20 @@ var AwsEcsAdapter = class {
|
|
|
954
971
|
async status() {
|
|
955
972
|
const context = this.requireContext();
|
|
956
973
|
const region = context.region ?? "us-east-1";
|
|
957
|
-
const result = await this.runner.run(
|
|
958
|
-
"
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
974
|
+
const result = await this.runner.run(
|
|
975
|
+
"aws",
|
|
976
|
+
[
|
|
977
|
+
"ecs",
|
|
978
|
+
"describe-services",
|
|
979
|
+
"--cluster",
|
|
980
|
+
context.appName,
|
|
981
|
+
"--services",
|
|
982
|
+
context.appName,
|
|
983
|
+
"--region",
|
|
984
|
+
region
|
|
985
|
+
],
|
|
986
|
+
context.projectRoot
|
|
987
|
+
);
|
|
967
988
|
if (result.exitCode !== 0) {
|
|
968
989
|
return { state: "failed", message: result.stderr };
|
|
969
990
|
}
|
|
@@ -1072,18 +1093,22 @@ var AwsLightsailAdapter = class {
|
|
|
1072
1093
|
};
|
|
1073
1094
|
const region = config.region ?? "us-east-1";
|
|
1074
1095
|
const serviceName = sanitizeLightsailName(config.appName);
|
|
1075
|
-
const createService = await this.runner.run(
|
|
1076
|
-
"
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1096
|
+
const createService = await this.runner.run(
|
|
1097
|
+
"aws",
|
|
1098
|
+
[
|
|
1099
|
+
"lightsail",
|
|
1100
|
+
"create-container-service",
|
|
1101
|
+
"--service-name",
|
|
1102
|
+
serviceName,
|
|
1103
|
+
"--power",
|
|
1104
|
+
"nano",
|
|
1105
|
+
"--scale",
|
|
1106
|
+
"1",
|
|
1107
|
+
"--region",
|
|
1108
|
+
region
|
|
1109
|
+
],
|
|
1110
|
+
config.projectRoot
|
|
1111
|
+
);
|
|
1087
1112
|
if (createService.exitCode !== 0 && !createService.stderr.includes("already exists")) {
|
|
1088
1113
|
throw new Error(`Failed to create Lightsail container service: ${createService.stderr}`);
|
|
1089
1114
|
}
|
|
@@ -1121,30 +1146,31 @@ var AwsLightsailAdapter = class {
|
|
|
1121
1146
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1122
1147
|
const imageTag = `${serviceName}:latest`;
|
|
1123
1148
|
this.logger.step("Building Docker image...");
|
|
1124
|
-
const dockerBuild = await this.runner.run(
|
|
1125
|
-
"
|
|
1126
|
-
"--platform",
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
imageTag,
|
|
1130
|
-
"."
|
|
1131
|
-
], artifacts.deployDirectory);
|
|
1149
|
+
const dockerBuild = await this.runner.run(
|
|
1150
|
+
"docker",
|
|
1151
|
+
["build", "--platform", "linux/amd64", "-t", imageTag, "."],
|
|
1152
|
+
artifacts.deployDirectory
|
|
1153
|
+
);
|
|
1132
1154
|
if (dockerBuild.exitCode !== 0) {
|
|
1133
1155
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
1134
1156
|
}
|
|
1135
1157
|
this.logger.step("Pushing image to Lightsail...");
|
|
1136
|
-
const pushImage = await this.runner.run(
|
|
1137
|
-
"
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1158
|
+
const pushImage = await this.runner.run(
|
|
1159
|
+
"aws",
|
|
1160
|
+
[
|
|
1161
|
+
"lightsail",
|
|
1162
|
+
"push-container-image",
|
|
1163
|
+
"--service-name",
|
|
1164
|
+
serviceName,
|
|
1165
|
+
"--label",
|
|
1166
|
+
"latest",
|
|
1167
|
+
"--image",
|
|
1168
|
+
imageTag,
|
|
1169
|
+
"--region",
|
|
1170
|
+
region
|
|
1171
|
+
],
|
|
1172
|
+
artifacts.deployDirectory
|
|
1173
|
+
);
|
|
1148
1174
|
if (pushImage.exitCode !== 0) {
|
|
1149
1175
|
throw new Error(`Lightsail image push failed: ${pushImage.stderr}`);
|
|
1150
1176
|
}
|
|
@@ -1175,29 +1201,30 @@ var AwsLightsailAdapter = class {
|
|
|
1175
1201
|
unhealthyThreshold: 3
|
|
1176
1202
|
}
|
|
1177
1203
|
});
|
|
1178
|
-
const createDeploy = await this.runner.run(
|
|
1179
|
-
"
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1204
|
+
const createDeploy = await this.runner.run(
|
|
1205
|
+
"aws",
|
|
1206
|
+
[
|
|
1207
|
+
"lightsail",
|
|
1208
|
+
"create-container-service-deployment",
|
|
1209
|
+
"--service-name",
|
|
1210
|
+
serviceName,
|
|
1211
|
+
"--containers",
|
|
1212
|
+
containers,
|
|
1213
|
+
"--public-endpoint",
|
|
1214
|
+
publicEndpoint,
|
|
1215
|
+
"--region",
|
|
1216
|
+
region
|
|
1217
|
+
],
|
|
1218
|
+
context.projectRoot
|
|
1219
|
+
);
|
|
1190
1220
|
if (createDeploy.exitCode !== 0) {
|
|
1191
1221
|
throw new Error(`Lightsail deployment failed: ${createDeploy.stderr}`);
|
|
1192
1222
|
}
|
|
1193
|
-
const serviceInfo = await this.runner.run(
|
|
1194
|
-
"
|
|
1195
|
-
"get-container-services",
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
"--region",
|
|
1199
|
-
region
|
|
1200
|
-
], context.projectRoot);
|
|
1223
|
+
const serviceInfo = await this.runner.run(
|
|
1224
|
+
"aws",
|
|
1225
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
1226
|
+
context.projectRoot
|
|
1227
|
+
);
|
|
1201
1228
|
const rawUrl = parseLightsailUrl(serviceInfo.stdout) ?? `https://${serviceName}.${region}.cs.amazonlightsail.com`;
|
|
1202
1229
|
const serviceUrl = rawUrl.replace(/\/+$/, "");
|
|
1203
1230
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -1211,14 +1238,18 @@ var AwsLightsailAdapter = class {
|
|
|
1211
1238
|
const context = this.requireContext();
|
|
1212
1239
|
const region = context.region ?? "us-east-1";
|
|
1213
1240
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1214
|
-
const deployments = await this.runner.run(
|
|
1215
|
-
"
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1241
|
+
const deployments = await this.runner.run(
|
|
1242
|
+
"aws",
|
|
1243
|
+
[
|
|
1244
|
+
"lightsail",
|
|
1245
|
+
"get-container-service-deployments",
|
|
1246
|
+
"--service-name",
|
|
1247
|
+
serviceName,
|
|
1248
|
+
"--region",
|
|
1249
|
+
region
|
|
1250
|
+
],
|
|
1251
|
+
context.projectRoot
|
|
1252
|
+
);
|
|
1222
1253
|
if (deployments.exitCode !== 0) {
|
|
1223
1254
|
throw new Error(`Lightsail rollback failed: ${deployments.stderr}`);
|
|
1224
1255
|
}
|
|
@@ -1226,18 +1257,22 @@ var AwsLightsailAdapter = class {
|
|
|
1226
1257
|
if (!previousDeployment) {
|
|
1227
1258
|
throw new Error("No previous deployment found to rollback to.");
|
|
1228
1259
|
}
|
|
1229
|
-
const redeploy = await this.runner.run(
|
|
1230
|
-
"
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1260
|
+
const redeploy = await this.runner.run(
|
|
1261
|
+
"aws",
|
|
1262
|
+
[
|
|
1263
|
+
"lightsail",
|
|
1264
|
+
"create-container-service-deployment",
|
|
1265
|
+
"--service-name",
|
|
1266
|
+
serviceName,
|
|
1267
|
+
"--containers",
|
|
1268
|
+
JSON.stringify(previousDeployment.containers),
|
|
1269
|
+
"--public-endpoint",
|
|
1270
|
+
JSON.stringify(previousDeployment.publicEndpoint),
|
|
1271
|
+
"--region",
|
|
1272
|
+
region
|
|
1273
|
+
],
|
|
1274
|
+
context.projectRoot
|
|
1275
|
+
);
|
|
1241
1276
|
if (redeploy.exitCode !== 0) {
|
|
1242
1277
|
throw new Error(`Lightsail rollback deployment failed: ${redeploy.stderr}`);
|
|
1243
1278
|
}
|
|
@@ -1284,14 +1319,11 @@ var AwsLightsailAdapter = class {
|
|
|
1284
1319
|
const context = this.requireContext();
|
|
1285
1320
|
const region = context.region ?? "us-east-1";
|
|
1286
1321
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1287
|
-
const result = await this.runner.run(
|
|
1288
|
-
"
|
|
1289
|
-
"get-container-services",
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
"--region",
|
|
1293
|
-
region
|
|
1294
|
-
], context.projectRoot);
|
|
1322
|
+
const result = await this.runner.run(
|
|
1323
|
+
"aws",
|
|
1324
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
1325
|
+
context.projectRoot
|
|
1326
|
+
);
|
|
1295
1327
|
if (result.exitCode !== 0) {
|
|
1296
1328
|
return { state: "failed", message: result.stderr };
|
|
1297
1329
|
}
|
|
@@ -1356,12 +1388,7 @@ ${error.message}` });
|
|
|
1356
1388
|
});
|
|
1357
1389
|
}
|
|
1358
1390
|
};
|
|
1359
|
-
var PASSTHROUGH_ENV_VARS = [
|
|
1360
|
-
"DATABASE_URL",
|
|
1361
|
-
"AUTH_SECRET",
|
|
1362
|
-
"PUBLIC_URL",
|
|
1363
|
-
"NODE_ENV"
|
|
1364
|
-
];
|
|
1391
|
+
var PASSTHROUGH_ENV_VARS = ["DATABASE_URL", "AUTH_SECRET", "PUBLIC_URL", "NODE_ENV"];
|
|
1365
1392
|
function sanitizeLightsailName(name) {
|
|
1366
1393
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "").slice(0, 255) || "kora-app";
|
|
1367
1394
|
}
|
|
@@ -2240,7 +2267,8 @@ function generateDeployPackageJson(nativeDependencies) {
|
|
|
2240
2267
|
type: "module",
|
|
2241
2268
|
dependencies: nativeDependencies
|
|
2242
2269
|
};
|
|
2243
|
-
return JSON.stringify(pkg, null, 2)
|
|
2270
|
+
return `${JSON.stringify(pkg, null, 2)}
|
|
2271
|
+
`;
|
|
2244
2272
|
}
|
|
2245
2273
|
function generateDockerIgnore() {
|
|
2246
2274
|
return [
|
|
@@ -2572,7 +2600,7 @@ var deployCommand = (0, import_citty.defineCommand)({
|
|
|
2572
2600
|
nativeDependencies: {
|
|
2573
2601
|
"better-sqlite3": "^11.0.0",
|
|
2574
2602
|
"drizzle-orm": "^0.45.2",
|
|
2575
|
-
|
|
2603
|
+
postgres: "^3.4.0"
|
|
2576
2604
|
}
|
|
2577
2605
|
});
|
|
2578
2606
|
await writeDockerIgnoreArtifact(deployDirectory);
|
|
@@ -2881,7 +2909,9 @@ async function resolveCreatePreferencesFlow(params) {
|
|
|
2881
2909
|
}
|
|
2882
2910
|
if (flags.db !== void 0) {
|
|
2883
2911
|
if (!isDatabaseValue(flags.db)) {
|
|
2884
|
-
throw new Error(
|
|
2912
|
+
throw new Error(
|
|
2913
|
+
`Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`
|
|
2914
|
+
);
|
|
2885
2915
|
}
|
|
2886
2916
|
effective.db = flags.db;
|
|
2887
2917
|
} else if (!effective.sync) {
|