Skip to content

Commit

Permalink
Force internal port to 8080
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner committed Dec 9, 2024
1 parent 14e7319 commit a0f108b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions waspc/packages/deploy/src/providers/fly/setup/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async function setupServer(deploymentInfo: DeploymentInfo<SetupOptions>) {
await $`flyctl launch --no-deploy ${launchArgs}`;

const minMachinesOptionRegex = /min_machines_running = 0/g;
const internalPortOptionRegex = /internal_port = \d+/g;

if (!doesLocalTomlContainLine(minMachinesOptionRegex)) {
await question(`\n⚠️ There was a possible issue setting up your server app.
Expand All @@ -109,6 +110,24 @@ Press any key to continue or Ctrl+C to cancel.`);
replaceLineInLocalToml(minMachinesOptionRegex, 'min_machines_running = 1');
}

if (!doesLocalTomlContainLine(internalPortOptionRegex)) {
await question(`\n⚠️ There was an issue setting up your server app.
We tried modifying your server fly.toml to set ${boldText(
'internal_port = 8080',
)}, but couldn't find the option ${boldText(
'internal_port',
)} in the fly.toml.
This means your server app might not be accessible.
Contact the Wasp Team at our Discord server if you need help with this: https://discord.gg/rzdnErX
Press any key to continue or Ctrl+C to cancel.`);
} else {
// the default fly.toml assumes port 8080 (or 3000, depending on flyctl version).
replaceLineInLocalToml(internalPortOptionRegex, 'internal_port = 8080');
}

copyLocalServerTomlToProject(deploymentInfo.tomlFilePaths);

const randomString = crypto.randomBytes(32).toString('hex');
Expand Down

0 comments on commit a0f108b

Please sign in to comment.