Skip to content

fix(docs): keep APP_PORT numeric in dynamic-config installer - #63

Merged
techwithanirudh merged 3 commits into
devfrom
claude/github-issue-62-n95ja0
Jul 31, 2026
Merged

fix(docs): keep APP_PORT numeric in dynamic-config installer#63
techwithanirudh merged 3 commits into
devfrom
claude/github-issue-62-n95ja0

Conversation

@techwithanirudh

@techwithanirudh techwithanirudh commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Fixes #62

Problem

The dynamic-config installer defaulted APP_PORT to 0.0.0.0:3000 and wrote that value straight into /data/coolify/source/.env. Coolify's compose uses APP_PORT in two places:

ports:
  - "${APP_PORT:-8000}:8080"
expose:
  - "${APP_PORT:-8000}"

expose: only accepts a bare port number, so the bind address made step 5 of the installer fail and left Coolify down:

strconv.ParseUint: parsing "0.0.0.0:3000": invalid syntax

Changes

apps/docs/public/scripts/install/dynamic-config.sh

  • APP_PORT_DEFAULT is now 3000 instead of 0.0.0.0:3000.
  • Added strip_bind_address() and is_valid_port() helpers.
  • The APP_PORT prompt now loops until it gets a usable value:
    • a host:port entry has the bind address stripped, with a warning
    • non-numeric or out-of-range values are rejected
    • 8000 is rejected because step 3 reserves it for the Traefik coolify_dashboard entrypoint
  • APP_PORT_DEFAULT supplied via env is sanitized and validated up front, so a bad override exits early rather than looping.
  • If .env already holds a broken APP_PORT (e.g. from a previous run of this installer), it is called out before being replaced — re-running the installer repairs an already-broken host.

apps/docs/content/docs/style/installation/dynamic-config.mdx

  • Manual instructions now say APP_PORT=3000, with a callout explaining why a bind address breaks the restart.
  • Rollback step references 8000 rather than 0.0.0.0:8000.

apps/docs/.cspell.json — added strconv (appears in the quoted error message).

apps/style/src/components/sidebar/_index.scss, _theme-switcher.scss — prettier formatting only, in a separate commit (see below).

About the second commit

The format job failed on the first push, on two @repo/style files this PR doesn't otherwise touch. They have been unformatted since the theme-selector work landed; the format job on dev never caught it because that run died earlier during setup, on a transient bun download 504. Fixed here with prettier --write so this PR can go green — whitespace only, no selectors or declarations changed. Happy to split it out if you'd rather it land separately.

Testing

  • bash -n on the script passes.
  • Extracted the new prompt block into a harness and exercised it: empty input, 0.0.0.0:4000, garbage input, 8000, EOF/non-interactive, missing APP_PORT line, invalid APP_PORT_DEFAULT, and APP_PORT_DEFAULT=127.0.0.1:3001. All produce a plain numeric port or exit with a clear message; no infinite loop under EOF.
  • pnpm format and pnpm check:spelling both pass on the full workspace.

Summary by CodeRabbit

  • Bug Fixes

    • Improved dynamic configuration to accept and store valid port numbers reliably.
    • Prevented invalid bind-address values and reserved port 8000 from disrupting application restarts.
    • Added validation for ports outside the valid 1–65535 range.
  • Documentation

    • Updated installation and rollback guidance with correct port formats and warnings.
  • Style

    • Reformatted sidebar styles without changing their appearance or behavior.

Coolify's compose uses APP_PORT in both `ports:` and `expose:`, and
`expose:` only accepts a bare port number. The installer defaulted
APP_PORT to `0.0.0.0:3000` and wrote it straight into `.env`, so the
restart in step 5 failed with:

    strconv.ParseUint: parsing "0.0.0.0:3000": invalid syntax

Default APP_PORT to `3000` and validate the prompt: strip a bind address
if one is entered, reject non-numeric or out-of-range values, and reject
8000 since it is reserved for the Traefik dashboard entrypoint. A broken
value already present in `.env` is now flagged and replaced.

Fixes #62

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013xR9ywD6vmwcbAce4VXfbz
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
coolify-tweaks-web Ready Ready Preview Jul 31, 2026 7:07am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
coolify-tweaks-api Ignored Ignored Preview Jul 31, 2026 7:07am

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@techwithanirudh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f0a397c4-40e9-4951-85f3-68b0a69d2944

📥 Commits

Reviewing files that changed from the base of the PR and between d01da94 and c1f9d04.

📒 Files selected for processing (1)
  • apps/docs/public/scripts/install/dynamic-config.sh

Walkthrough

The installer now writes validated plain port numbers to APP_PORT, defaults to 3000, and rejects reserved port 8000. Documentation and release metadata reflect this behavior. Sidebar SCSS formatting changes preserve existing styling.

Changes

APP_PORT validation

Layer / File(s) Summary
Installer port validation
apps/docs/public/scripts/install/dynamic-config.sh
The installer sanitizes bind-address input, validates ports from 1 through 65535, replaces invalid existing values, and rejects port 8000.
Port guidance and release metadata
apps/docs/content/docs/style/installation/dynamic-config.mdx, apps/docs/.cspell.json, .changeset/tidy-pugs-clap.md
The documentation and patch changeset describe plain port values. The cspell allowlist includes strconv.

Sidebar SCSS formatting

Layer / File(s) Summary
Sidebar selector and declaration formatting
apps/style/src/components/sidebar/_index.scss, apps/style/src/components/sidebar/_theme-switcher.scss
SCSS selectors and declarations use multiline formatting without behavior changes.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Installer
  participant EnvFile
  participant Coolify

  User->>Installer: Enter or accept APP_PORT
  Installer->>Installer: Strip bind address and validate port
  Installer->>EnvFile: Write plain APP_PORT
  Coolify->>EnvFile: Read APP_PORT
Loading

Poem

A rabbit checks the port with care,
Strips extra addresses from there.
Three thousand starts the tune,
Eight thousand leaves the room.
Clean styles hop through the lair.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The two sidebar SCSS changes are formatting-only and unrelated to the Coolify APP_PORT fix in issue [#62]. Remove the unrelated sidebar SCSS formatting changes or move them to a separate pull request.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: keeping APP_PORT numeric in the dynamic-config installer.
Linked Issues check ✅ Passed The installer strips bind addresses, validates ports, and prevents invalid APP_PORT values that cause the Coolify restart failure in issue [#62].
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/github-issue-62-n95ja0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

These two files have been unformatted since the theme selector work
landed. The `format` CI job on dev never caught it because that run
failed earlier, during setup, on a transient bun download 504.

Whitespace only - no CSS selectors or declarations changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013xR9ywD6vmwcbAce4VXfbz
@techwithanirudh
techwithanirudh marked this pull request as ready for review July 31, 2026 06:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/public/scripts/install/dynamic-config.sh`:
- Around line 199-235: Update the APP_PORT initialization around
CURRENT_APP_PORT and the prompt loop so a valid existing CURRENT_APP_PORT is
sanitized and assigned as the prompt default, while APP_PORT_DEFAULT remains the
fallback when no valid current value exists. Preserve the existing warning for
invalid CURRENT_APP_PORT values and ensure the prompt uses the resulting default
without overwriting a valid configured port on Enter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fb52f288-0091-49be-8a4e-2034e4facdc3

📥 Commits

Reviewing files that changed from the base of the PR and between fb6cc9b and d01da94.

📒 Files selected for processing (6)
  • .changeset/tidy-pugs-clap.md
  • apps/docs/.cspell.json
  • apps/docs/content/docs/style/installation/dynamic-config.mdx
  • apps/docs/public/scripts/install/dynamic-config.sh
  • apps/style/src/components/sidebar/_index.scss
  • apps/style/src/components/sidebar/_theme-switcher.scss

Comment thread apps/docs/public/scripts/install/dynamic-config.sh
Re-running the installer on a host with a working custom port (say 4000)
showed the prompt default as 3000, so pressing Enter silently moved the
dashboard. The current value was read but only ever used to warn.

It is now sanitized and reused as the default when usable, with one
carve-out: stock Coolify ships APP_PORT=8000, which is the port this
installer hands to Traefik. Offering it back would suggest a value the
validation loop always rejects, which re-prompts forever - and never
terminates at all on a non-interactive run. That case keeps the 3000
fallback and says why.

The warning for a value Coolify cannot start with still fires, and a
bind-address value like 0.0.0.0:4000 now both warns and recovers the
intended 4000 instead of falling back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013xR9ywD6vmwcbAce4VXfbz
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.

Autoinstall script breaks Coolify

2 participants