Skip to content

Feat/subdomain port binding - #12

Merged
GoluScriptMage merged 2 commits into
masterfrom
feat/subdomain-port-binding
Aug 2, 2026
Merged

Feat/subdomain port binding#12
GoluScriptMage merged 2 commits into
masterfrom
feat/subdomain-port-binding

Conversation

@GoluScriptMage

@GoluScriptMage GoluScriptMage commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Deployment port selection now checks ports already in use by active deployments.
  • Bug Fixes
    • Improved handling of port-scanning failures, missing tools, and invalid results.
    • Deployment processes now report clearer errors instead of terminating unexpectedly.
  • Refactor
    • Removed the legacy deployment CLI, static deployment page, and related configuration files.
    • Port scanning now runs asynchronously for improved deployment responsiveness.

Copilot AI review requested due to automatic review settings August 2, 2026 12:32
@GoluScriptMage
GoluScriptMage merged commit f1c303a into master Aug 2, 2026
2 of 3 checks passed
@GoluScriptMage
GoluScriptMage deleted the feat/subdomain-port-binding branch August 2, 2026 12:33
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d3ad282-338e-4afb-8be0-e835624bdfae

📥 Commits

Reviewing files that changed from the base of the PR and between b67cee8 and b6476d6.

⛔ Files ignored due to path filters (2)
  • server/aerocloud.db is excluded by !**/*.db
  • server/deployments/a2a1ac/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (14)
  • server/bin/goportscan
  • server/deployments/a2a1ac/.gitignore
  • server/deployments/a2a1ac/Dockerfile
  • server/deployments/a2a1ac/aerocloud.json
  • server/deployments/a2a1ac/index.html
  • server/deployments/a2a1ac/package.json
  • server/deployments/a2a1ac/src/index.ts
  • server/deployments/a2a1ac/src/utils/archieve.ts
  • server/deployments/a2a1ac/src/utils/configHelper.ts
  • server/deployments/a2a1ac/src/utils/logger.ts
  • server/deployments/a2a1ac/tsconfig.json
  • server/src/config/db.ts
  • server/src/routes/deploy.ts
  • server/src/utils/goPortFinder.ts
🔥 Files not summarized due to errors (1)
  • server/bin/goportscan: Server error: no LLM provider could handle the message

📝 Walkthrough

Walkthrough

The PR removes the a2a1ac deployment package and changes port allocation to use database port state with asynchronous goportscan execution and explicit error propagation. Deployment now logs the selected container port.

Changes

Deployment package removal

Layer / File(s) Summary
Remove deployment CLI and static deployment assets
server/deployments/a2a1ac/*
The Dockerfile, Aerocloud configuration, package metadata, TypeScript configuration, static page, CLI entrypoint, archive utility, configuration helper, logger, and related ignore rules are removed.

Port allocation flow

Layer / File(s) Summary
Query active deployment ports
server/src/config/db.ts, server/src/utils/goPortFinder.ts
getUsedPorts() returns ports for deployments with deployed or deploying status. findAvailablePort() serializes these ports for goportscan.
Use asynchronous scanning and error propagation
server/src/utils/goPortFinder.ts
findAvailablePort() uses asynchronous execFile, writes occupied ports to stdin, and throws errors for missing binaries, execution failures, stderr output, and invalid results.
Log the selected port
server/src/routes/deploy.ts
The deployment route logs the Docker container port after allocation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: copilot

Sequence Diagram(s)

sequenceDiagram
  participant deployRoute
  participant findAvailablePort
  participant database
  participant goportscan
  deployRoute->>findAvailablePort: Request available port
  findAvailablePort->>database: Query deployed and deploying ports
  database-->>findAvailablePort: Return occupied ports
  findAvailablePort->>goportscan: Write occupied ports to stdin
  goportscan-->>findAvailablePort: Return selected port
  findAvailablePort-->>deployRoute: Resolve selected port
  deployRoute->>deployRoute: Log selected container port
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/subdomain-port-binding

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the server’s port-allocation flow for Docker deployments by making goportscan execution asynchronous and (intended) aware of ports already tracked in the SQLite deployments table, and it removes a previously committed deployment/CLI sandbox under server/deployments/a2a1ac.

Changes:

  • Refactors findAvailablePort() to use execFile (async) and adds a DB-backed “used ports” query.
  • Adds an extra deploy-time log line after selecting the Docker host port.
  • Deletes the server/deployments/a2a1ac sandbox directory contents.

Reviewed changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/src/utils/goPortFinder.ts Switches to async execFile and attempts to stream used ports into goportscan.
server/src/routes/deploy.ts Adds logging for the selected Docker host port (minor formatting issue).
server/src/config/db.ts Introduces getUsedPorts() to query ports from deployments.
server/deployments/a2a1ac/tsconfig.json Removed sandbox TS config.
server/deployments/a2a1ac/src/utils/logger.ts Removed sandbox logger utility.
server/deployments/a2a1ac/src/utils/configHelper.ts Removed sandbox config helper.
server/deployments/a2a1ac/src/utils/archieve.ts Removed sandbox archive utility.
server/deployments/a2a1ac/src/index.ts Removed sandbox CLI entrypoint.
server/deployments/a2a1ac/package.json Removed sandbox package manifest.
server/deployments/a2a1ac/package-lock.json Removed sandbox lockfile.
server/deployments/a2a1ac/index.html Removed sandbox HTML page.
server/deployments/a2a1ac/Dockerfile Removed sandbox Dockerfile.
server/deployments/a2a1ac/aerocloud.json Removed sandbox example config.
server/deployments/a2a1ac/.gitignore Removed sandbox ignore file.
Files not reviewed (1)
  • server/deployments/a2a1ac/package-lock.json: Generated file
Suppressed comments (1)

server/src/utils/goPortFinder.ts:23

  • usedPortList is computed but never used, which adds dead code and makes it unclear which port list is intended to be sent to goportscan.
    // Query Database for the used ports
    const usedPorts = getUsedPorts();
    const usedPortList = usedPorts.map((row: any) => row.port).join(",");


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const binaryPath = path.join(process.cwd(), 'bin', 'goportscan');


// TODO: Fix the process.exit instead of exiitng throw an error
Comment thread server/src/config/db.ts
Comment on lines +48 to +51
export function getUsedPorts() {
const statement = db.prepare("SELECT port FROM deployments WHERE status IN ('deployed', 'deploying') ORDER BY port ASC");
return statement.all();
}
Comment on lines 114 to 118
// 3. Docker image built successfully, now find an available port and create a container
Logger.info(`Docker image built successfully: ${imageName}`);
const dockerPort = await findAvailablePort();
Logger.info(`Available port found for Docker container: ${dockerPort}`);

@coderabbitai coderabbitai Bot mentioned this pull request Aug 2, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants