From 4aba89c063c6a7910c65fc1f2d24a21e59c2d135 Mon Sep 17 00:00:00 2001 From: Magent release tooling Date: Sat, 19 Sep 2026 18:22:25 +1200 Subject: [PATCH] feat(setup): center onboarding and add secure token help --- README.md | 9 +- docs/PORTAINER.md | 14 +-- docs/PUBLIC_RELEASE.md | 8 +- frontend/app/setup/SetupTokenHelp.tsx | 91 ++++++++++++++++++++ frontend/app/setup/page.tsx | 21 ++--- frontend/app/setup/setup-token-help.test.tsx | 60 +++++++++++++ frontend/app/setup/setup-token-help.ts | 24 ++++++ frontend/app/setup/setup.module.css | 19 +++- 8 files changed, 218 insertions(+), 28 deletions(-) create mode 100644 frontend/app/setup/SetupTokenHelp.tsx create mode 100644 frontend/app/setup/setup-token-help.test.tsx create mode 100644 frontend/app/setup/setup-token-help.ts diff --git a/README.md b/README.md index 0160216..7ffdcfe 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,9 @@ Paste [compose.yml](compose.yml) into a Portainer **Docker Standalone** stack. It uses `rephl3xnz/magent:latest`, persists data in a named volume and needs no environment variables or Dockerfile on the user's machine. -**Image availability:** this source snapshot has not yet been published to -Docker Hub. The current `latest` image may not include this setup flow. Until a -compatible image is published, use the source-build command below for testing. -Only Linux/amd64 has been validated. +**Image availability:** the managed-install image is published on Docker Hub. +Only Linux/amd64 has been validated. `latest` is mutable; record the resolved +image digest before updating, or pin an immutable release tag. 1. Deploy the stack and wait for the container to become healthy. 2. In its console, select `/bin/ash` and user `magent`, then run: @@ -24,6 +23,8 @@ Only Linux/amd64 has been validated. 3. Open the Docker host's address on port 3000. Confirm the browser-facing URL in setup and use the token to create the first administrator. + The **Get setup token** button shows the console instructions and lets you + copy the command; it never reveals the token to public visitors. 4. Connect your apps, choose preferences and finish setup. Optional apps can be skipped. Save an encrypted backup afterwards. diff --git a/docs/PORTAINER.md b/docs/PORTAINER.md index 4507493..9cc8682 100644 --- a/docs/PORTAINER.md +++ b/docs/PORTAINER.md @@ -8,11 +8,11 @@ through administrator and app setup. Users do not need a Dockerfile, source checkout, Python installation, `.env` file or another database container. **Release availability:** the image with zero-input managed bootstrap and -wizard-configured origins still needs publishing to Docker Hub. These repository -changes have not published an image or changed a live deployment. Until the -release owner updates `latest` with this release, the template may pull an older -image that lacks these features. `latest` is mutable, not an immutable release -identifier; record the deployed digest and review release notes before updating. +wizard-configured origins is published on Docker Hub. `latest` is mutable, not +an immutable release identifier; record the deployed digest and review release +notes before updating. If an existing stack still uses an older image, updating +the Compose text alone does not pull the new image: explicitly re-pull it when +redeploying, while retaining the same persistent volume. ## Requirements @@ -49,6 +49,10 @@ identifier; record the deployed digest and review release notes before updating. private: anyone with that token and access to an unclaimed installation can create its first administrator. The command refuses to reveal it once an administrator exists. + The setup page's **Get setup token** button also shows these instructions and + offers **Copy command**. On browsers without clipboard access, select and + copy the displayed command manually. This help dialog does not generate or + reveal a token over the public web interface. 5. Open Magent at the browser address you intend to use, such as `http://192.168.1.50:3000` on a trusted LAN or `https://magent.example.com` through your configured HTTPS proxy. Use the **Docker host's reachable diff --git a/docs/PUBLIC_RELEASE.md b/docs/PUBLIC_RELEASE.md index 1301deb..6fd364a 100644 --- a/docs/PUBLIC_RELEASE.md +++ b/docs/PUBLIC_RELEASE.md @@ -31,10 +31,10 @@ token-authorized first-administrator wizard; matching CORS and cookie security follow the saved URL automatically. Managed SQLite stays at `/app/data/magent.db`, and API documentation stays disabled. -**Publication is still pending:** the new image must be published before the -`latest` stack can supply this behaviour. Repository changes do not publish or -deploy an image; an older `latest` image remains incompatible with this new -workflow. `latest` is mutable, so record the resolved digest before an upgrade. +The managed-install image is published on Docker Hub. Repository changes alone +do not update an existing deployment: explicitly pull the image when upgrading, +retaining the same persistent volume. `latest` is mutable, so record the resolved +digest before an upgrade; older cached images may lack this setup workflow. The Compose runtime-security block stays enabled and must be left unchanged. See the [complete environment reference](ENVIRONMENT.md) for all supported variables and the difference between managed, manual and tooling controls. diff --git a/frontend/app/setup/SetupTokenHelp.tsx b/frontend/app/setup/SetupTokenHelp.tsx new file mode 100644 index 0000000..0252406 --- /dev/null +++ b/frontend/app/setup/SetupTokenHelp.tsx @@ -0,0 +1,91 @@ +"use client"; + +import { useRef, useState } from "react"; +import { copySetupTokenCommand, SETUP_TOKEN_COMMAND } from "./setup-token-help"; +import styles from "./setup.module.css"; + +export default function SetupTokenHelp({ disabled = false }: { disabled?: boolean }) { + const dialog = useRef(null); + const trigger = useRef(null); + const commandField = useRef(null); + const [copyStatus, setCopyStatus] = useState(""); + + const copyCommand = async () => { + const result = await copySetupTokenCommand(navigator.clipboard, commandField.current); + setCopyStatus( + result === "copied" + ? "Command copied. Paste it into the Magent container console." + : result === "selected" + ? "Automatic copying is unavailable. The command is selected; press Ctrl+C (Command+C on Mac), or touch and hold to copy." + : "Automatic copying is unavailable. Select and copy the command above.", + ); + }; + + return ( +
+ + trigger.current?.focus()} + > +
+

Get your setup token

+ +
+

+ Magent generates a private setup token when a managed installation starts. Retrieve it from your server + console to create the first administrator. +

+
    +
  1. In Portainer, open Containers and select the healthy Magent container.
  2. +
  3. + Open Console, choose command /bin/ash and user magent, then connect. +
  4. +
  5. Run the command below, then copy its output into the Setup token field on this page.
  6. +
+ +