fix(installer): map host port 80 to frontend in local mode#41
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Both
install.sh(in local mode) andinstall.ps1copydocker-compose.sample.ymland then start onlyforgecrm-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://localhostnever resolves.What changed
install.sh, local mode only — after copying the sample, idempotently injectports: - "80:80"into theforgecrm-frontendblock viaawk.install.ps1— same line-by-line in PowerShell.install.shuntouched — 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_loadround-trip:forgecrm-frontend.ports == ['80:80'], caddy untouched.bash -n install.shclean.51 insertions(+).