Skip to content

fix(installer): map host port 80 to frontend in local mode#41

Merged
sathyaprakash000 merged 1 commit into
mainfrom
fix/installer-host-port-80
May 26, 2026
Merged

fix(installer): map host port 80 to frontend in local mode#41
sathyaprakash000 merged 1 commit into
mainfrom
fix/installer-host-port-80

Conversation

@sathyaprakash000
Copy link
Copy Markdown
Contributor

@sathyaprakash000 sathyaprakash000 commented May 26, 2026

Why

Both install.sh (in local mode) and install.ps1 copy docker-compose.sample.yml and then start only forgecrm-backend + forgecrm-frontend — Caddy is intentionally unused locally. But the sample only maps host port 80 via the caddy service; forgecrm-frontend (nginx :80) has no ports mapping. So on a fresh install, http://localhost never resolves.

What changed

  • install.sh, local mode only — after copying the sample, idempotently inject ports: - "80:80" into the forgecrm-frontend block via awk.
  • install.ps1 — same line-by-line in PowerShell.
  • Server mode in install.sh untouched — Caddy still owns host port 80.

Idempotency

Scoped to forgecrm-frontend's own block — a naive file-wide grep for - "80:80" would false-positive on the caddy port mapping in the sample.

Verified

  • yaml.safe_load round-trip: forgecrm-frontend.ports == ['80:80'], caddy untouched.
  • Re-running the injector is a no-op.
  • bash -n install.sh clean.

51 insertions(+).

Both install.sh (local mode) and install.ps1 (always local) copy
docker-compose.sample.yml as the deployment compose file and then start
only forgecrm-backend + forgecrm-frontend — Caddy is intentionally
unused locally. But docker-compose.sample.yml only maps host port 80 via
the caddy service; forgecrm-frontend (nginx :80) has no ports mapping,
so http://localhost never resolves on a fresh local install. Users had
to manually add the port mapping to the gitignored docker-compose.yml.

Fix
- install.sh, local mode: after copying the sample, idempotently inject

      ports:
        - "80:80"

  into the forgecrm-frontend service block of the copied
  docker-compose.yml using awk (portable between GNU and BSD/macOS sed).
- install.ps1: do the same line-by-line in PowerShell after copying the
  sample. The script is local-mode-only by design, so no branching.

Idempotency
The check is scoped to forgecrm-frontend's own block — a naive
file-wide grep for `- "80:80"` would false-positive on the existing
caddy port mapping in the sample. The scoped check walks lines, marks
"in block" between `forgecrm-frontend:` and the next top-level service,
and only matches `- "80:80"` while inside that block.

Verified
- awk injection produces valid YAML (`yaml.safe_load` round-trips
  cleanly, forgecrm-frontend gains `ports: ['80:80']`, caddy keeps
  `ports: ['80:80', '443:443']`).
- Re-running the inject is a no-op (idempotent).
- install.sh server mode is untouched — Caddy still owns host port 80
  there.

Docs were already correct; this just makes the README's promise
("Open http://localhost — it should load") true for fresh installs.

Signed-off-by: KingArthur000 <sathyaprakashelango@gmail.com>
@sathyaprakash000 sathyaprakash000 merged commit 9822e2e into main May 26, 2026
11 checks passed
@sathyaprakash000 sathyaprakash000 deleted the fix/installer-host-port-80 branch May 26, 2026 06:01
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.

1 participant