@peerbit/server 5.8.3 → 5.8.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/server",
3
- "version": "5.8.3",
3
+ "version": "5.8.4",
4
4
  "author": "dao.xyz",
5
5
  "repository": {
6
6
  "type": "git",
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 = (grantAccess: PeerId[] = [], serverVersion?: string) => {
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(properties.grantAccess, properties.serverVersion),
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
- await (
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,