fix: remove rpc settings when starting nwaku image

This commit is contained in:
Arseniy Klempner 2024-03-01 13:58:19 -08:00
parent 9f198dd149
commit 37f24e9ea1
No known key found for this signature in database
GPG Key ID: 59967D458EFBF01B
4 changed files with 8 additions and 28 deletions

View File

@ -92,7 +92,7 @@ export default class Dockerode {
logPath: string, logPath: string,
wakuServiceNodeParams?: string wakuServiceNodeParams?: string
): Promise<Docker.Container> { ): Promise<Docker.Container> {
const { rpcPort, restPort, tcpPort, websocketPort, discv5UdpPort } = ports; const { restPort, tcpPort, websocketPort, discv5UdpPort } = ports;
await this.confirmImageExistsOrPull(); await this.confirmImageExistsOrPull();
@ -110,7 +110,6 @@ export default class Dockerode {
AutoRemove: true, AutoRemove: true,
PortBindings: { PortBindings: {
[`${restPort}/tcp`]: [{ HostPort: restPort.toString() }], [`${restPort}/tcp`]: [{ HostPort: restPort.toString() }],
[`${rpcPort}/tcp`]: [{ HostPort: rpcPort.toString() }],
[`${tcpPort}/tcp`]: [{ HostPort: tcpPort.toString() }], [`${tcpPort}/tcp`]: [{ HostPort: tcpPort.toString() }],
[`${websocketPort}/tcp`]: [{ HostPort: websocketPort.toString() }], [`${websocketPort}/tcp`]: [{ HostPort: websocketPort.toString() }],
...(args?.peerExchange && { ...(args?.peerExchange && {
@ -120,7 +119,6 @@ export default class Dockerode {
}, },
ExposedPorts: { ExposedPorts: {
[`${restPort}/tcp`]: {}, [`${restPort}/tcp`]: {},
[`${rpcPort}/tcp`]: {},
[`${tcpPort}/tcp`]: {}, [`${tcpPort}/tcp`]: {},
[`${websocketPort}/tcp`]: {}, [`${websocketPort}/tcp`]: {},
...(args?.peerExchange && { ...(args?.peerExchange && {

View File

@ -47,7 +47,6 @@ export class ServiceNode {
private multiaddrWithId?: Multiaddr; private multiaddrWithId?: Multiaddr;
private websocketPort?: number; private websocketPort?: number;
private readonly logPath: string; private readonly logPath: string;
private rpcPort?: number;
private restPort?: number; private restPort?: number;
/** /**
@ -117,14 +116,13 @@ export class ServiceNode {
const startPort = Math.floor(Math.random() * (65535 - 1025) + 1025); const startPort = Math.floor(Math.random() * (65535 - 1025) + 1025);
const ports: Ports = await new Promise((resolve, reject) => { const ports: Ports = await new Promise((resolve, reject) => {
portfinder.getPorts(5, { port: startPort }, (err, ports) => { portfinder.getPorts(4, { port: startPort }, (err, ports) => {
if (err) reject(err); if (err) reject(err);
resolve({ resolve({
rpcPort: ports[0], tcpPort: ports[0],
tcpPort: ports[1], websocketPort: ports[1],
websocketPort: ports[2], restPort: ports[2],
restPort: ports[3], discv5UdpPort: ports[3]
discv5UdpPort: ports[4]
}); });
}); });
}); });
@ -133,10 +131,8 @@ export class ServiceNode {
args.logLevel = LogLevel.Debug; args.logLevel = LogLevel.Debug;
} }
const { rpcPort, tcpPort, websocketPort, restPort, discv5UdpPort } = const { tcpPort, websocketPort, restPort, discv5UdpPort } = ports;
ports;
this.restPort = restPort; this.restPort = restPort;
this.rpcPort = rpcPort;
this.websocketPort = websocketPort; this.websocketPort = websocketPort;
// `legacyFilter` is required to enable filter v1 with go-waku // `legacyFilter` is required to enable filter v1 with go-waku
@ -148,13 +144,12 @@ export class ServiceNode {
{ {
rest: true, rest: true,
restPort, restPort,
rpcPort,
tcpPort, tcpPort,
websocketPort, websocketPort,
...(args?.peerExchange && { discv5UdpPort }), ...(args?.peerExchange && { discv5UdpPort }),
...(isGoWaku && { minRelayPeersToPublish: 0, legacyFilter }) ...(isGoWaku && { minRelayPeersToPublish: 0, legacyFilter })
}, },
{ rpcAddress: "0.0.0.0", restAddress: "0.0.0.0" }, { restAddress: "0.0.0.0" },
_args _args
); );
@ -350,10 +345,6 @@ export class ServiceNode {
return this.peerId; return this.peerId;
} }
get rpcUrl(): string {
return `http://127.0.0.1:${this.rpcPort}/`;
}
get httpUrl(): string { get httpUrl(): string {
return `http://127.0.0.1:${this.restPort}`; return `http://127.0.0.1:${this.restPort}`;
} }
@ -393,10 +384,8 @@ export class ServiceNode {
export function defaultArgs(): Args { export function defaultArgs(): Args {
return { return {
listenAddress: "0.0.0.0", listenAddress: "0.0.0.0",
rpc: true,
relay: false, relay: false,
rest: true, rest: true,
rpcAdmin: true,
restAdmin: true, restAdmin: true,
websocketSupport: true, websocketSupport: true,
logLevel: LogLevel.Trace logLevel: LogLevel.Trace

View File

@ -4,9 +4,7 @@ export interface Args {
listenAddress?: string; listenAddress?: string;
relay?: boolean; relay?: boolean;
rest?: boolean; rest?: boolean;
rpc?: boolean;
restAdmin?: boolean; restAdmin?: boolean;
rpcAdmin?: boolean;
nodekey?: string; nodekey?: string;
portsShift?: number; portsShift?: number;
logLevel?: LogLevel; logLevel?: LogLevel;
@ -17,11 +15,9 @@ export interface Args {
discv5Discovery?: boolean; discv5Discovery?: boolean;
storeMessageDbUrl?: string; storeMessageDbUrl?: string;
pubsubTopic?: Array<string>; pubsubTopic?: Array<string>;
rpcPrivate?: boolean;
websocketSupport?: boolean; websocketSupport?: boolean;
tcpPort?: number; tcpPort?: number;
restPort?: number; restPort?: number;
rpcPort?: number;
websocketPort?: number; websocketPort?: number;
discv5BootstrapNode?: string; discv5BootstrapNode?: string;
discv5UdpPort?: number; discv5UdpPort?: number;
@ -31,7 +27,6 @@ export interface Args {
} }
export interface Ports { export interface Ports {
rpcPort: number;
tcpPort: number; tcpPort: number;
websocketPort: number; websocketPort: number;
restPort: number; restPort: number;

View File

@ -12,10 +12,8 @@ describe("nwaku", () => {
const expected = [ const expected = [
"--listen-address=0.0.0.0", "--listen-address=0.0.0.0",
"--rpc=true",
"--relay=false", "--relay=false",
"--rest=true", "--rest=true",
"--rpc-admin=true",
"--rest-admin=true", "--rest-admin=true",
"--websocket-support=true", "--websocket-support=true",
"--log-level=TRACE", "--log-level=TRACE",