@highstate/timeweb 0.8.0 → 0.9.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.
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"sourceHashes": {
|
3
|
-
"./dist/connection/index.js": "
|
4
|
-
"./dist/virtual-machine/index.js": "
|
3
|
+
"./dist/connection/index.js": "a5b714174ca3fd4785fb47b7769d2b3a715d5088f7ff74fc5e3b0a2401c720aa",
|
4
|
+
"./dist/virtual-machine/index.js": "7a9cd83c5635ff8b4f0ae2493482f6a23dc56d05b4c256ed71a9694bc79dc38a"
|
5
5
|
}
|
6
6
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
// src/virtual-machine/index.ts
|
2
|
-
import { Provider, SshKey, FloatingIp, Server } from "@highstate/timeweb-sdk";
|
2
|
+
import { Provider, SshKey, FloatingIp, Server as TimewebServer } from "@highstate/timeweb-sdk";
|
3
3
|
import { timeweb } from "@highstate/library";
|
4
|
-
import { forUnit, getResourceComment, output } from "@highstate/pulumi";
|
4
|
+
import { forUnit, getResourceComment, interpolate, output } from "@highstate/pulumi";
|
5
5
|
import { createSshTerminal, getOrCreateSshKeyPair } from "@highstate/common";
|
6
|
+
import { local } from "@pulumi/command";
|
6
7
|
var { name, args, inputs, secrets, outputs } = forUnit(timeweb.virtualMachine);
|
7
8
|
var provider = new Provider(name, { token: inputs.connection.apiToken });
|
8
9
|
var keyPair = getOrCreateSshKeyPair(inputs, secrets);
|
@@ -23,7 +24,7 @@ var floatingIp = new FloatingIp(
|
|
23
24
|
},
|
24
25
|
{ provider }
|
25
26
|
);
|
26
|
-
var
|
27
|
+
var timewebServer = new TimewebServer(
|
27
28
|
name,
|
28
29
|
{
|
29
30
|
name,
|
@@ -39,11 +40,14 @@ var server = new Server(
|
|
39
40
|
);
|
40
41
|
var serverEntity = output({
|
41
42
|
endpoint: floatingIp.ip,
|
42
|
-
hostname:
|
43
|
+
hostname: timewebServer.name,
|
43
44
|
sshCredentials: {
|
44
45
|
privateKey: keyPair.privateKey
|
45
46
|
}
|
46
47
|
});
|
48
|
+
new local.Command("check-availability", {
|
49
|
+
create: interpolate`while ! ping -c 1 ${floatingIp.ip}; do echo "Waiting for server to be available..."; sleep 5; done`
|
50
|
+
});
|
47
51
|
var virtual_machine_default = outputs({
|
48
52
|
server: serverEntity,
|
49
53
|
$terminals: [serverEntity.apply(createSshTerminal)],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/virtual-machine/index.ts"],"sourcesContent":["import { Provider, SshKey, FloatingIp, Server } from \"@highstate/timeweb-sdk\"\nimport { common, timeweb } from \"@highstate/library\"\nimport { forUnit, getResourceComment, Output, output } from \"@highstate/pulumi\"\nimport { createSshTerminal, getOrCreateSshKeyPair } from \"@highstate/common\"\n\nconst { name, args, inputs, secrets, outputs } = forUnit(timeweb.virtualMachine)\n\nconst provider = new Provider(name, { token: inputs.connection.apiToken })\n\nconst keyPair = getOrCreateSshKeyPair(inputs, secrets)\n\nconst sshKey = new SshKey(\n name,\n {\n name,\n body: keyPair.publicKey,\n },\n { provider },\n)\n\nconst floatingIp = new FloatingIp(\n name,\n {\n comment: getResourceComment(),\n availabilityZone: args.availabilityZone,\n ddosGuard: false,\n },\n { provider },\n)\n\nconst
|
1
|
+
{"version":3,"sources":["../../src/virtual-machine/index.ts"],"sourcesContent":["import { Provider, SshKey, FloatingIp, Server as TimewebServer } from \"@highstate/timeweb-sdk\"\nimport { common, timeweb } from \"@highstate/library\"\nimport { forUnit, getResourceComment, interpolate, Output, output } from \"@highstate/pulumi\"\nimport { createSshTerminal, getOrCreateSshKeyPair } from \"@highstate/common\"\nimport { local } from \"@pulumi/command\"\n\nconst { name, args, inputs, secrets, outputs } = forUnit(timeweb.virtualMachine)\n\nconst provider = new Provider(name, { token: inputs.connection.apiToken })\n\nconst keyPair = getOrCreateSshKeyPair(inputs, secrets)\n\nconst sshKey = new SshKey(\n name,\n {\n name,\n body: keyPair.publicKey,\n },\n { provider },\n)\n\nconst floatingIp = new FloatingIp(\n name,\n {\n comment: getResourceComment(),\n availabilityZone: args.availabilityZone,\n ddosGuard: false,\n },\n { provider },\n)\n\nconst timewebServer = new TimewebServer(\n name,\n {\n name,\n comment: getResourceComment(),\n availabilityZone: args.availabilityZone,\n floatingIpId: floatingIp.id,\n presetId: args.presetId,\n osId: args.osId,\n isRootPasswordRequired: false,\n sshKeysIds: [sshKey.sshKeyId.apply(Number)],\n },\n { provider },\n)\n\nconst serverEntity: Output<common.Server> = output({\n endpoint: floatingIp.ip,\n hostname: timewebServer.name,\n sshCredentials: {\n privateKey: keyPair.privateKey,\n },\n})\n\nnew local.Command(\"check-availability\", {\n create: interpolate`while ! ping -c 1 ${floatingIp.ip}; do echo \"Waiting for server to be available...\"; sleep 5; done`,\n})\n\nexport default outputs({\n server: serverEntity,\n $terminals: [serverEntity.apply(createSshTerminal)],\n $status: {\n ip: floatingIp.ip,\n },\n})\n"],"mappings":";AAAA,SAAS,UAAU,QAAQ,YAAY,UAAU,qBAAqB;AACtE,SAAiB,eAAe;AAChC,SAAS,SAAS,oBAAoB,aAAqB,cAAc;AACzE,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,aAAa;AAEtB,IAAM,EAAE,MAAM,MAAM,QAAQ,SAAS,QAAQ,IAAI,QAAQ,QAAQ,cAAc;AAE/E,IAAM,WAAW,IAAI,SAAS,MAAM,EAAE,OAAO,OAAO,WAAW,SAAS,CAAC;AAEzE,IAAM,UAAU,sBAAsB,QAAQ,OAAO;AAErD,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,EACA;AAAA,IACE;AAAA,IACA,MAAM,QAAQ;AAAA,EAChB;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,aAAa,IAAI;AAAA,EACrB;AAAA,EACA;AAAA,IACE,SAAS,mBAAmB;AAAA,IAC5B,kBAAkB,KAAK;AAAA,IACvB,WAAW;AAAA,EACb;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,gBAAgB,IAAI;AAAA,EACxB;AAAA,EACA;AAAA,IACE;AAAA,IACA,SAAS,mBAAmB;AAAA,IAC5B,kBAAkB,KAAK;AAAA,IACvB,cAAc,WAAW;AAAA,IACzB,UAAU,KAAK;AAAA,IACf,MAAM,KAAK;AAAA,IACX,wBAAwB;AAAA,IACxB,YAAY,CAAC,OAAO,SAAS,MAAM,MAAM,CAAC;AAAA,EAC5C;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,eAAsC,OAAO;AAAA,EACjD,UAAU,WAAW;AAAA,EACrB,UAAU,cAAc;AAAA,EACxB,gBAAgB;AAAA,IACd,YAAY,QAAQ;AAAA,EACtB;AACF,CAAC;AAED,IAAI,MAAM,QAAQ,sBAAsB;AAAA,EACtC,QAAQ,gCAAgC,WAAW,EAAE;AACvD,CAAC;AAED,IAAO,0BAAQ,QAAQ;AAAA,EACrB,QAAQ;AAAA,EACR,YAAY,CAAC,aAAa,MAAM,iBAAiB,CAAC;AAAA,EAClD,SAAS;AAAA,IACP,IAAI,WAAW;AAAA,EACjB;AACF,CAAC;","names":[]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/timeweb",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.0",
|
4
4
|
"type": "module",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -16,17 +16,18 @@
|
|
16
16
|
"build": "highstate build"
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
|
-
"@highstate/common": "^0.
|
20
|
-
"@highstate/k8s": "^0.
|
21
|
-
"@highstate/pulumi": "^0.
|
19
|
+
"@highstate/common": "^0.9.0",
|
20
|
+
"@highstate/k8s": "^0.9.0",
|
21
|
+
"@highstate/pulumi": "^0.9.0",
|
22
22
|
"@highstate/timeweb-sdk": "workspace:^0.7.8",
|
23
|
+
"@pulumi/command": "^1.0.2",
|
23
24
|
"@pulumi/pulumi": "^3.163.0"
|
24
25
|
},
|
25
26
|
"peerDependencies": {
|
26
27
|
"@highstate/library": "workspace:^0.4.4"
|
27
28
|
},
|
28
29
|
"devDependencies": {
|
29
|
-
"@highstate/cli": "^0.
|
30
|
+
"@highstate/cli": "^0.9.0"
|
30
31
|
},
|
31
|
-
"gitHead": "
|
32
|
+
"gitHead": "b64df0df33afcadf019936eaa2a2ca7ffc82940b"
|
32
33
|
}
|