Merge pull request #1880 from waku-org/fix/remove-rpc

fix: remove rpc settings when starting nwaku image
This commit is contained in:
Arseniy Klempner 2024-03-04 10:08:05 -08:00 committed by GitHub
commit 5e1bce494f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 28 deletions

View File

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

View File

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

View File

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

View File

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