From c8d9dcf52dd43cacfbe92294e0ef231cf757eb39 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 19 Aug 2026 00:52:29 -0700 Subject: [PATCH] Point first-run CLI guidance to web setup --- archivebox/cli/archivebox_install.py | 4 ++-- archivebox/cli/archivebox_server.py | 16 ++++++++-------- archivebox/cli/archivebox_status.py | 4 ++-- archivebox/tests/test_setup_script.py | 2 ++ bin/setup.sh | 9 ++++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/archivebox/cli/archivebox_install.py b/archivebox/cli/archivebox_install.py index b9c666fe..b9f5e15f 100755 --- a/archivebox/cli/archivebox_install.py +++ b/archivebox/cli/archivebox_install.py @@ -196,8 +196,8 @@ def install(binaries: tuple[str, ...] = (), binproviders: str = "*", dry_run: bo User = get_user_model() if not User.objects.filter(is_superuser=True).exclude(username="system").exists(): - stderr("\n[+] Don't forget to create a new admin user for the Web UI...", color="green") - stderr(" archivebox manage createsuperuser") + stderr("\n[+] Open the Admin UI to create the first admin and finish web setup:", color="green") + stderr(" http://admin.archivebox.localhost:8000/admin/") print() diff --git a/archivebox/cli/archivebox_server.py b/archivebox/cli/archivebox_server.py index 41d58b0f..ae392a99 100644 --- a/archivebox/cli/archivebox_server.py +++ b/archivebox/cli/archivebox_server.py @@ -251,14 +251,6 @@ def server( manage(args=["createsuperuser"]) print() - if not User.objects.filter(is_superuser=True).exclude(username="system").exists(): - print() - print( - "[violet]Hint:[/violet] To create an [bold]admin username & password[/bold] for the [deep_sky_blue3][underline][link=http://{host}:{port}/admin]Admin UI[/link][/underline][/deep_sky_blue3], run:", - ) - print(" [green]archivebox manage createsuperuser[/green]") - print() - # First non-empty positional arg is the bind spec; otherwise inherit from # config (which defaults to "127.0.0.1:8000"). _parse_and_validate_bind_spec # hard-errors on hostnames so the rest of the server can assume a numeric @@ -266,6 +258,14 @@ def server( bind_spec = next((arg for arg in runserver_args if arg), "") host, port = _parse_and_validate_bind_spec(bind_spec) + if not User.objects.filter(is_superuser=True).exclude(username="system").exists(): + print() + print("[violet]Hint:[/violet] Open the Admin UI to create the first admin and finish web setup:") + print(f" [green]http://localhost:{port}/admin/[/green]") + if host not in ("127.0.0.1", "localhost"): + print(" (When running remotely, replace localhost with this server's IP address or hostname.)") + print() + if daemonize and os.environ.get("ARCHIVEBOX_SERVER_DAEMON_CHILD") != "1": from archivebox.workers.supervisord_util import resolve_env_binary diff --git a/archivebox/cli/archivebox_status.py b/archivebox/cli/archivebox_status.py index 8a36d3e7..b49c2b45 100644 --- a/archivebox/cli/archivebox_status.py +++ b/archivebox/cli/archivebox_status.py @@ -132,8 +132,8 @@ def status(out_dir: Path = CONSTANTS.DATA_DIR) -> None: if not users: print() - print(" [violet]Hint:[/violet] You can create an admin user by running:") - print(" [green]archivebox manage createsuperuser[/green]") + print(" [violet]Hint:[/violet] Open the Admin UI to create the first admin and finish web setup:") + print(" [green]http://admin.archivebox.localhost:8000/admin/[/green]") print() recent_snapshots = snapshots_qs.order_by( diff --git a/archivebox/tests/test_setup_script.py b/archivebox/tests/test_setup_script.py index 43b95f0f..d7aa31b5 100644 --- a/archivebox/tests/test_setup_script.py +++ b/archivebox/tests/test_setup_script.py @@ -76,6 +76,8 @@ def test_setup_script_prints_root_safe_runtime_commands(): assert "pkill -f archivebox " not in script assert '"$DOCKER_BINARY" rm -f archivebox' in script assert "--connect-timeout 1 --max-time 2" in script + assert "manage createsuperuser" not in script + assert "Open http://localhost:8000/admin/ to create the first admin and finish web setup." in script def test_setup_script_pulls_docker_image_once_and_reports_unavailable_docker_accurately(): diff --git a/bin/setup.sh b/bin/setup.sh index eeb602c1..e5f0705c 100755 --- a/bin/setup.sh +++ b/bin/setup.sh @@ -405,7 +405,8 @@ if [ "$DOCKER_IMAGE_READY" = "true" ] && "$DOCKER_BINARY" compose version > /dev echo " ${FOLLOWUP_SUDO}docker compose down" echo " ${FOLLOWUP_SUDO}env ARCHIVEBOX_IMAGE=$ARCHIVEBOX_IMAGE docker compose pull" echo " ${FOLLOWUP_SUDO}docker compose up" - echo " ${FOLLOWUP_SUDO}docker compose exec archivebox archivebox manage createsuperuser" + echo " Open http://localhost:8000/admin/ to create the first admin and finish web setup." + echo " (When running remotely, replace localhost with this server's IP address or hostname.)" echo " ${FOLLOWUP_SUDO}docker compose exec archivebox archivebox add 'https://example.com'" echo " ${FOLLOWUP_SUDO}docker compose exec archivebox archivebox list" echo " ${FOLLOWUP_SUDO}docker compose exec archivebox archivebox help" @@ -432,7 +433,8 @@ elif [ "$DOCKER_IMAGE_READY" = "true" ]; then echo " ${FOLLOWUP_SUDO}docker rm -f archivebox" echo " ${FOLLOWUP_SUDO}docker pull $ARCHIVEBOX_IMAGE" echo " ${FOLLOWUP_SUDO}docker run $DOCKER_PLATFORM_ARGS -v $PWD:/data -d -p 8000:8000 --name=archivebox $ARCHIVEBOX_IMAGE" - echo " ${FOLLOWUP_SUDO}docker run $DOCKER_PLATFORM_ARGS -v $PWD:/data -it $ARCHIVEBOX_IMAGE manage createsuperuser" + echo " Open http://localhost:8000/admin/ to create the first admin and finish web setup." + echo " (When running remotely, replace localhost with this server's IP address or hostname.)" echo " ${FOLLOWUP_SUDO}docker run $DOCKER_PLATFORM_ARGS -v $PWD:/data -it $ARCHIVEBOX_IMAGE add 'https://example.com'" echo " ${FOLLOWUP_SUDO}docker run $DOCKER_PLATFORM_ARGS -v $PWD:/data -it $ARCHIVEBOX_IMAGE list" echo " ${FOLLOWUP_SUDO}docker run $DOCKER_PLATFORM_ARGS -v $PWD:/data -it $ARCHIVEBOX_IMAGE help" @@ -495,7 +497,8 @@ echo echo "[√] Server started on http://127.0.0.1:8000 and data directory initialized in $ARCHIVEBOX_DATA_DIR. Usage:" echo " cd $ARCHIVEBOX_DATA_DIR # see your data dir" echo " ${FOLLOWUP_SUDO}archivebox server 0.0.0.0:8000 # start server process" -echo " ${FOLLOWUP_SUDO}archivebox manage createsuperuser # add an admin user+pass" +echo " Open http://localhost:8000/admin/ to create the first admin and finish web setup." +echo " (When running remotely, replace localhost with this server's IP address or hostname.)" echo " ps aux | grep archivebox # see server process pid" echo " ${FOLLOWUP_SUDO}pkill -f 'archivebox server' # stop the server" echo " curl -fsSL 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/dev/bin/setup.sh' | ${FOLLOWUP_SUDO}bash # update versions"