From 4b5c74e8d6dc92adae60281864c995da831f9fdb Mon Sep 17 00:00:00 2001 From: Owen Schwartz Date: Wed, 15 Jan 2025 21:37:10 -0500 Subject: [PATCH] Import start port at startup for now for exit node --- install/main.go | 4 ++-- server/routers/gerbil/getConfig.ts | 4 +++- server/setup/copyInConfig.ts | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/install/main.go b/install/main.go index ae598033..3267c398 100644 --- a/install/main.go +++ b/install/main.go @@ -18,8 +18,8 @@ import ( ) func loadVersions(config *Config) { - config.PangolinVersion = "1.0.0-beta.5" - config.GerbilVersion = "1.0.0-beta.1" + config.PangolinVersion = "1.0.0-beta.6" + config.GerbilVersion = "1.0.0-beta.2" } //go:embed fs/* diff --git a/server/routers/gerbil/getConfig.ts b/server/routers/gerbil/getConfig.ts index 27fb05d0..314e715a 100644 --- a/server/routers/gerbil/getConfig.ts +++ b/server/routers/gerbil/getConfig.ts @@ -50,7 +50,9 @@ export async function getConfig(req: Request, res: Response, next: NextFunction) let exitNode; if (exitNodeQuery.length === 0) { const address = await getNextAvailableSubnet(); - const listenPort = await getNextAvailablePort(); + // TODO: eventually we will want to get the next available port so that we can multiple exit nodes + // const listenPort = await getNextAvailablePort(); + const listenPort = config.getRawConfig().gerbil.start_port; let subEndpoint = ""; if (config.getRawConfig().gerbil.use_subdomain) { subEndpoint = await getUniqueExitNodeEndpointName(); diff --git a/server/setup/copyInConfig.ts b/server/setup/copyInConfig.ts index 0ff3ba7f..5a5e6711 100644 --- a/server/setup/copyInConfig.ts +++ b/server/setup/copyInConfig.ts @@ -7,6 +7,7 @@ import logger from "@server/logger"; export async function copyInConfig() { const domain = config.getBaseDomain(); const endpoint = config.getRawConfig().gerbil.base_endpoint; + const listenPort = config.getRawConfig().gerbil.start_port; // update the domain on all of the orgs where the domain is not equal to the new domain // TODO: eventually each org could have a unique domain that we do not want to overwrite, so this will be unnecessary @@ -14,6 +15,8 @@ export async function copyInConfig() { // TODO: eventually each exit node could have a different endpoint await db.update(exitNodes).set({ endpoint }).where(ne(exitNodes.endpoint, endpoint)); + // TODO: eventually each exit node could have a different port + await db.update(exitNodes).set({ listenPort }).where(ne(exitNodes.listenPort, listenPort)); // update all resources fullDomain to use the new domain await db.transaction(async (trx) => {