Point first-run CLI guidance to web setup

This commit is contained in:
Nick Sweeting 2026-08-19 00:52:29 -07:00
parent ef6dae95dc
commit c8d9dcf52d
No known key found for this signature in database
5 changed files with 20 additions and 15 deletions

View File

@ -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()

View File

@ -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

View File

@ -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(

View File

@ -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():

View File

@ -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"