@peerbit/server 5.8.3-9b0640c → 5.8.3
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/src/aws.d.ts +0 -1
- package/dist/src/aws.d.ts.map +1 -1
- package/dist/src/aws.js +3 -3
- package/dist/src/aws.js.map +1 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -10
- package/dist/src/cli.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +89 -89
- package/src/aws.ts +3 -12
- package/src/cli.ts +5 -12
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
2
|
+
"name": "@peerbit/server",
|
|
3
|
+
"version": "5.8.3",
|
|
4
|
+
"author": "dao.xyz",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/dao-xyz/peerbit"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"bin": {
|
|
13
|
+
"peerbit": "./dist/src/bin.js"
|
|
14
|
+
},
|
|
15
|
+
"module": "dist/src/index.js",
|
|
16
|
+
"types": "dist/src/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"import": "./dist/src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"./dist/src/server.js": "./dist/src/server.browser.js",
|
|
22
|
+
"./server.js": "./dist/src/server.browser.js",
|
|
23
|
+
"./dist/src/config.js": "./dist/src/config.browser.js",
|
|
24
|
+
"./config.js": "./dist/src/config.browser.js",
|
|
25
|
+
"./dist/src/remotes.js": "./dist/src/remotes.browser.js",
|
|
26
|
+
"./remotes.js": "./dist/src/remotes.browser.js",
|
|
27
|
+
"./dist/src/docker.js": "./dist/src/docker.browser.js",
|
|
28
|
+
"./docker.js": "./dist/src/docker.browser.js",
|
|
29
|
+
"./dist/src/aws.js": "./dist/src/aws.browser.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"src/nginx-template.conf",
|
|
35
|
+
"!src/test",
|
|
36
|
+
"!src/**/__tests__",
|
|
37
|
+
"!lib/**/__tests__",
|
|
38
|
+
"patches",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18"
|
|
46
|
+
},
|
|
47
|
+
"eslintConfig": {
|
|
48
|
+
"extends": "peerbit",
|
|
49
|
+
"parserOptions": {
|
|
50
|
+
"project": true,
|
|
51
|
+
"sourceType": "module"
|
|
52
|
+
},
|
|
53
|
+
"ignorePatterns": [
|
|
54
|
+
"!.aegir.js",
|
|
55
|
+
"test/ts-use",
|
|
56
|
+
"*.d.ts"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"clean": "shx rm -rf lib/*",
|
|
61
|
+
"build": "yarn clean && yarn build-lib && yarn build-ui",
|
|
62
|
+
"build-lib": "tsc -p tsconfig.json",
|
|
63
|
+
"build-ui": "cd ../frontend && yarn build && cd ../node",
|
|
64
|
+
"postbuild": "cp src/nginx-template.conf dist/src/ && cp -r ../frontend/dist/. dist/ui",
|
|
65
|
+
"test": "aegir test --t node",
|
|
66
|
+
"lint": "aegir lint"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@peerbit/test-lib": "^0.0.1",
|
|
70
|
+
"@peerbit/test-utils": "2.2.0",
|
|
71
|
+
"@types/yargs": "17.0.24",
|
|
72
|
+
"aws-sdk": "^2.1259.0",
|
|
73
|
+
"dotenv": "^16.1.4",
|
|
74
|
+
"@types/tmp": "^0.2.3",
|
|
75
|
+
"@types/tar-stream": "^3.1.3",
|
|
76
|
+
"shx": "^0.3.4"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"axios": "^1.4.0",
|
|
80
|
+
"chalk": "^5.3.0",
|
|
81
|
+
"peerbit": "4.3.0",
|
|
82
|
+
"yargs": "^17.7.2",
|
|
83
|
+
"tar-stream": "^3.1.7",
|
|
84
|
+
"tmp": "^0.2.1",
|
|
85
|
+
"tty-table": "^4.2.1"
|
|
86
|
+
},
|
|
87
|
+
"optionalDependencies": {
|
|
88
|
+
"@aws-sdk/client-ec2": "^3.390.0",
|
|
89
|
+
"@aws-sdk/client-route-53": "^3.391.0"
|
|
90
|
+
}
|
|
91
91
|
}
|
package/src/aws.ts
CHANGED
|
@@ -52,11 +52,7 @@ export const createRecord = async (options: {
|
|
|
52
52
|
await client.send(cmd);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const setupUserData = (
|
|
56
|
-
email: string,
|
|
57
|
-
grantAccess: PeerId[] = [],
|
|
58
|
-
serverVersion?: string,
|
|
59
|
-
) => {
|
|
55
|
+
const setupUserData = (grantAccess: PeerId[] = [], serverVersion?: string) => {
|
|
60
56
|
const peerIdStrings = grantAccess.map((x) => x.toString());
|
|
61
57
|
|
|
62
58
|
// better-sqlite3 force use to install build-essentials for `make` command, TOOD dont bundle better-sqlite3 by default?
|
|
@@ -67,7 +63,7 @@ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - &&\
|
|
|
67
63
|
sudo apt-get install -y nodejs
|
|
68
64
|
sudo apt-get install -y build-essential
|
|
69
65
|
npm install -g @peerbit/server${versionSpec}
|
|
70
|
-
sudo peerbit domain test
|
|
66
|
+
sudo peerbit domain test
|
|
71
67
|
peerbit start ${peerIdStrings.map((key) => `--ga ${key}`)} > log.txt 2>&1 &
|
|
72
68
|
`;
|
|
73
69
|
};
|
|
@@ -110,7 +106,6 @@ export const AWS_LINUX_ARM_AMIs: Record<string, string> = {
|
|
|
110
106
|
};
|
|
111
107
|
export const launchNodes = async (properties: {
|
|
112
108
|
region?: string;
|
|
113
|
-
email: string;
|
|
114
109
|
count?: number;
|
|
115
110
|
size?: "micro" | "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
116
111
|
namePrefix?: string;
|
|
@@ -224,11 +219,7 @@ export const launchNodes = async (properties: {
|
|
|
224
219
|
SecurityGroupIds: [securityGroupOut.GroupId!],
|
|
225
220
|
InstanceType: ("t4g." + (properties.size || "micro")) as any, // TODO types
|
|
226
221
|
UserData: Buffer.from(
|
|
227
|
-
setupUserData(
|
|
228
|
-
properties.email,
|
|
229
|
-
properties.grantAccess,
|
|
230
|
-
properties.serverVersion,
|
|
231
|
-
),
|
|
222
|
+
setupUserData(properties.grantAccess, properties.serverVersion),
|
|
232
223
|
).toString("base64"),
|
|
233
224
|
MinCount: count,
|
|
234
225
|
MaxCount: count,
|
package/src/cli.ts
CHANGED
|
@@ -376,12 +376,6 @@ export const cli = async (args?: string[]) => {
|
|
|
376
376
|
alias: "d",
|
|
377
377
|
default: getHomeConfigDir(),
|
|
378
378
|
});
|
|
379
|
-
awsArgs.option("email", {
|
|
380
|
-
describe: "Email for Let's security messages",
|
|
381
|
-
type: "string",
|
|
382
|
-
alias: "e",
|
|
383
|
-
demandOption: true,
|
|
384
|
-
});
|
|
385
379
|
awsArgs.option("server-version", {
|
|
386
380
|
describe:
|
|
387
381
|
"@peerbit/server version or tag to install on the instance (e.g. 5.7.0-58d3d09)",
|
|
@@ -391,18 +385,17 @@ export const cli = async (args?: string[]) => {
|
|
|
391
385
|
return awsArgs;
|
|
392
386
|
},
|
|
393
387
|
handler: async (args) => {
|
|
394
|
-
const self = (
|
|
395
|
-
await getKeypair(args.directory)
|
|
396
|
-
).publicKey.toPeerId();
|
|
397
388
|
const accessGrant: PeerId[] =
|
|
398
389
|
args["grant-access"]?.length > 0
|
|
399
390
|
? (args["grant-access"] as string[]).map((x) =>
|
|
400
391
|
peerIdFromString(x),
|
|
401
392
|
)
|
|
402
|
-
: [
|
|
403
|
-
|
|
393
|
+
: [
|
|
394
|
+
await (
|
|
395
|
+
await getKeypair(args.directory)
|
|
396
|
+
).publicKey.toPeerId(),
|
|
397
|
+
];
|
|
404
398
|
const nodes = await launchNodes({
|
|
405
|
-
email: args.email as string,
|
|
406
399
|
count: args.count,
|
|
407
400
|
namePrefix: args.name,
|
|
408
401
|
region: args.region,
|