Skip to content

Add Portainer install script - #92

Open
Sportarr wants to merge 1 commit into
eshtek:stagingfrom
Sportarr:add-portainer
Open

Sportarr wants to merge 1 commit into
eshtek:stagingfrom
Sportarr:add-portainer

Conversation

@Sportarr

Copy link
Copy Markdown
Contributor

What it does

Portainer manages the Docker containers on the server. This script wraps the TrueNAS community app portainer.

How it installs

There are no install questions. A v6 hook named "Set up Portainer" runs after install and asks for an admin username and password. It creates the admin and connects the local Docker environment, so the user lands on a working dashboard.

Two Portainer behaviours make the hook necessary:

  • Portainer 2.45 refuses admin creation without a one-time setup token that it prints only in its logs (api/http/security/setuptoken). The script sets PORTAINER_NO_SETUP_TOKEN=true, and the hook creates the admin seconds after start. If the hook fails, Portainer's own create-admin page still works with no token.
  • With no admin five minutes after start, Portainer locks its API (api/http/server.go:143). The hook creates the admin first. If the timeout has already passed, the hook says to restart Portainer and run setup again from the card.

Other choices:

  • The HTTP port 31017 is published next to HTTPS on 31015, so the hook can reach the API without the self-signed certificate. The deck then shows both links.
  • Data is on ApplicationsPerformance at portainer/data, owned by apps (the app runs as 568) and snapshotted before updates.
  • Limits are 2 CPUs and 1024 MB.

Testing

  • bun _lib/validate.ts passes with 0 errors and 0 warnings. The hook passes tsc --noEmit in strict mode against _lib/hook_context.ts.
  • I installed it on my HexOS server (TrueNAS 25.10, HexOS 2026.10.16), with the hook inline through Custom Install's request and its inputs answered through the hook inputs endpoint. The hook created the admin and the local environment on unix:///var/run/docker.sock. The admin signed in, a wrong password was refused, and Portainer listed every container on the server.
  • I also ran the hook against the live app for three more cases. A second run skipped both steps. A password under 12 characters failed with a clear message. After the five-minute timeout it failed with the restart message, and after a restart it succeeded.

Something for you to decide

Portainer can see, stop and remove every container on the server, including your agent (ix-hexos). Let me know if that's a problem for the catalog.

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