@peerbit/server 5.8.2-c30b40f → 5.8.3-9b0640c
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 +1 -0
- 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 +10 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/aws.ts +12 -3
- package/src/cli.ts +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/server",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.3-9b0640c",
|
|
4
4
|
"author": "dao.xyz",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"lint": "aegir lint"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@peerbit/test-lib": "0.0.1-
|
|
70
|
-
"@peerbit/test-utils": "2.2.1-
|
|
69
|
+
"@peerbit/test-lib": "0.0.1-9b0640c",
|
|
70
|
+
"@peerbit/test-utils": "2.2.1-9b0640c",
|
|
71
71
|
"@types/yargs": "17.0.24",
|
|
72
72
|
"aws-sdk": "^2.1259.0",
|
|
73
73
|
"dotenv": "^16.1.4",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"axios": "^1.4.0",
|
|
80
80
|
"chalk": "^5.3.0",
|
|
81
|
-
"peerbit": "4.3.0-
|
|
81
|
+
"peerbit": "4.3.0-9b0640c",
|
|
82
82
|
"yargs": "^17.7.2",
|
|
83
83
|
"tar-stream": "^3.1.7",
|
|
84
84
|
"tmp": "^0.2.1",
|
package/src/aws.ts
CHANGED
|
@@ -52,7 +52,11 @@ export const createRecord = async (options: {
|
|
|
52
52
|
await client.send(cmd);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const setupUserData = (
|
|
55
|
+
const setupUserData = (
|
|
56
|
+
email: string,
|
|
57
|
+
grantAccess: PeerId[] = [],
|
|
58
|
+
serverVersion?: string,
|
|
59
|
+
) => {
|
|
56
60
|
const peerIdStrings = grantAccess.map((x) => x.toString());
|
|
57
61
|
|
|
58
62
|
// better-sqlite3 force use to install build-essentials for `make` command, TOOD dont bundle better-sqlite3 by default?
|
|
@@ -63,7 +67,7 @@ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - &&\
|
|
|
63
67
|
sudo apt-get install -y nodejs
|
|
64
68
|
sudo apt-get install -y build-essential
|
|
65
69
|
npm install -g @peerbit/server${versionSpec}
|
|
66
|
-
sudo peerbit domain test
|
|
70
|
+
sudo peerbit domain test --email ${email}
|
|
67
71
|
peerbit start ${peerIdStrings.map((key) => `--ga ${key}`)} > log.txt 2>&1 &
|
|
68
72
|
`;
|
|
69
73
|
};
|
|
@@ -106,6 +110,7 @@ export const AWS_LINUX_ARM_AMIs: Record<string, string> = {
|
|
|
106
110
|
};
|
|
107
111
|
export const launchNodes = async (properties: {
|
|
108
112
|
region?: string;
|
|
113
|
+
email: string;
|
|
109
114
|
count?: number;
|
|
110
115
|
size?: "micro" | "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
111
116
|
namePrefix?: string;
|
|
@@ -219,7 +224,11 @@ export const launchNodes = async (properties: {
|
|
|
219
224
|
SecurityGroupIds: [securityGroupOut.GroupId!],
|
|
220
225
|
InstanceType: ("t4g." + (properties.size || "micro")) as any, // TODO types
|
|
221
226
|
UserData: Buffer.from(
|
|
222
|
-
setupUserData(
|
|
227
|
+
setupUserData(
|
|
228
|
+
properties.email,
|
|
229
|
+
properties.grantAccess,
|
|
230
|
+
properties.serverVersion,
|
|
231
|
+
),
|
|
223
232
|
).toString("base64"),
|
|
224
233
|
MinCount: count,
|
|
225
234
|
MaxCount: count,
|
package/src/cli.ts
CHANGED
|
@@ -376,6 +376,12 @@ 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
|
+
});
|
|
379
385
|
awsArgs.option("server-version", {
|
|
380
386
|
describe:
|
|
381
387
|
"@peerbit/server version or tag to install on the instance (e.g. 5.7.0-58d3d09)",
|
|
@@ -385,17 +391,18 @@ export const cli = async (args?: string[]) => {
|
|
|
385
391
|
return awsArgs;
|
|
386
392
|
},
|
|
387
393
|
handler: async (args) => {
|
|
394
|
+
const self = (
|
|
395
|
+
await getKeypair(args.directory)
|
|
396
|
+
).publicKey.toPeerId();
|
|
388
397
|
const accessGrant: PeerId[] =
|
|
389
398
|
args["grant-access"]?.length > 0
|
|
390
399
|
? (args["grant-access"] as string[]).map((x) =>
|
|
391
400
|
peerIdFromString(x),
|
|
392
401
|
)
|
|
393
|
-
: [
|
|
394
|
-
|
|
395
|
-
await getKeypair(args.directory)
|
|
396
|
-
).publicKey.toPeerId(),
|
|
397
|
-
];
|
|
402
|
+
: [];
|
|
403
|
+
accessGrant.push(self);
|
|
398
404
|
const nodes = await launchNodes({
|
|
405
|
+
email: args.email as string,
|
|
399
406
|
count: args.count,
|
|
400
407
|
namePrefix: args.name,
|
|
401
408
|
region: args.region,
|