Skip to content

module_netbox: pass postgres image and tag as separate args (fix HTTP 404 pull)#908

Closed
igorpecovnik wants to merge 1 commit into
mainfrom
netbox-postgres-image-args
Closed

module_netbox: pass postgres image and tag as separate args (fix HTTP 404 pull)#908
igorpecovnik wants to merge 1 commit into
mainfrom
netbox-postgres-image-args

Conversation

@igorpecovnik
Copy link
Copy Markdown
Member

Symptom

Installing netbox fails on the first dependency step with:

Failed to pull: postgres:17-alpine:postgres-netbox
HTTP 404 from Docker API

(see screenshot)

Root cause

module_postgres accepts six positional args after install:

module_postgres install <user> <password> <db> <image-repo> <image-tag> <container-name>

and assembles dockerimage="${image-repo}:${image-tag}" and dockername="${container-name}".

module_netbox was passing five — fusing image and tag into one arg and dropping the container-name slot:

local DATABASE_IMAGE="postgres:17-alpine"
local DATABASE_HOST="postgres-netbox"
…
module_postgres install $DATABASE_USER $DATABASE_PASSWORD $DATABASE_NAME $DATABASE_IMAGE $DATABASE_HOST

So inside module_postgres:

  • postgres_image="postgres:17-alpine" (already contains a tag)
  • postgres_tag="postgres-netbox" (was meant to be the container name)
  • postgres_container="" → defaulted to "postgres"

Result: dockerimage="postgres:17-alpine:postgres-netbox" (Docker rejects with 404 — image refs only allow one :), and the postgres container would have spawned under the name postgres, colliding with any standalone postgres install.

Fix

Split DATABASE_IMAGE into DATABASE_IMAGE (postgres) + DATABASE_TAG (17-alpine) and pass DATABASE_HOST in its proper sixth slot:

module_postgres install "$DATABASE_USER" "$DATABASE_PASSWORD" "$DATABASE_NAME" \
    "$DATABASE_IMAGE" "$DATABASE_TAG" "$DATABASE_HOST"

This matches the pattern module_immich already uses — netbox was the one outlier.

Test plan

  • On a host without an existing postgres container: module_netbox install pulls postgres:17-alpine, names the resulting container postgres-netbox, and proceeds to install netbox itself without the 404 dialog.
  • On a host that already has a standalone postgres container: module_netbox install doesn't disturb it (creates postgres-netbox alongside).
  • docker container ls -a after install shows both postgres-netbox and netbox running.

… 404 pull)

module_postgres install takes six positional args:
  <user> <password> <db> <image-repo> <image-tag> <container-name>

netbox was passing five — fusing image and tag into one arg and
omitting the container-name slot entirely. The fused arg landed in
postgres_image and the actual container-name landed in postgres_tag,
so module_postgres built dockerimage="postgres:17-alpine:postgres-netbox"
which Docker 404s on pull, and dockername defaulted to "postgres"
which would also collide with any standalone postgres install.

Split DATABASE_IMAGE into DATABASE_IMAGE + DATABASE_TAG and add
DATABASE_HOST in its proper sixth slot. module_immich already does
this correctly — pattern now matches.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

Warning

Rate limit exceeded

@igorpecovnik has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 11 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fdc27a56-56ca-4ff7-8a7c-a20377cb42fb

📥 Commits

Reviewing files that changed from the base of the PR and between 5ded5c7 and f308bd7.

📒 Files selected for processing (1)
  • tools/modules/software/module_netbox.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch netbox-postgres-image-args

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 and usage tips.

@github-actions github-actions Bot added size/small PR with less then 50 lines 05 Milestone: Second quarter release labels May 9, 2026
igorpecovnik added a commit that referenced this pull request May 10, 2026
linuxserver/reverse-proxy-confs:master doesn't ship a sample for every
service we package — netbox and immich are the obvious gaps. The
existing docker_configure_swag_proxy() returns 1 when no sample is
present, so the swag-aware install paths in those modules silently
no-op on real deployments.

Add a generic helper next to docker_configure_swag_proxy:

  docker_seed_swag_proxy_conf <servicename> <<'NGINX'
      location ^~ /<svc> { … }
  NGINX

Reads the conf body from stdin and writes it as
/config/nginx/proxy-confs/<svc>.subfolder.conf.sample inside the SWAG
container. Returns 2 on no-SWAG (no-op), 0 on success or if a sample
already exists (defer to LSIO upstream when they eventually ship one,
keep an admin's hand-edited sample intact across re-installs), 1 on
docker exec failure.

module_netbox now seeds its own subfolder proxy-conf before calling
docker_configure_swag_proxy, and conditionally adds BASE_PATH=netbox
to the netbox container env when a SWAG container is present at
install time. Without BASE_PATH the rendered HTML emits absolute
/static/ /api/ … URLs that 404 once SWAG serves NetBox at /netbox.
Trade-off: direct port access (http://host:port/) stops working —
only http://host:port/netbox/ — but SWAG is the intended way in once
it's set up.

Same pattern can be reused for immich and any future
no-LSIO-sample service in a follow-up; the helper is generic.

Depends on #908 (passes postgres image+tag separately) for the netbox
install to reach this code path.
@igorpecovnik
Copy link
Copy Markdown
Member Author

Superseded — squashed into #906 alongside the SWAG wiring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release size/small PR with less then 50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant