diff --git a/archivebox/misc/checks.py b/archivebox/misc/checks.py index aa06ca68..43631297 100644 --- a/archivebox/misc/checks.py +++ b/archivebox/misc/checks.py @@ -138,20 +138,25 @@ def check_data_dir_permissions(config=None, **config_kwargs): # data_owned_by_default_user = data_dir_uid == DEFAULT_PUID or data_dir_gid == DEFAULT_PGID data_owner_doesnt_match = (data_dir_uid != ARCHIVEBOX_USER and data_dir_gid != ARCHIVEBOX_GROUP) if not IS_ROOT else False data_not_writable = not (os.path.isdir(DATA_DIR) and os.access(DATA_DIR, os.W_OK)) - if data_owned_by_root: + if data_not_writable: STDERR.print( - "\n[yellow]:warning: Warning: ArchiveBox [blue]DATA_DIR[/blue] is currently owned by [red]root[/red], it must be changed before archiving can run![/yellow]", + f"\n[yellow]:warning: Warning: ArchiveBox [blue]DATA_DIR[/blue] is not writable by ArchiveBox user [blue]{ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP}[/blue] ({USER}).[/yellow]", ) - elif data_owner_doesnt_match or data_not_writable: + elif data_owned_by_root: + STDERR.print( + "\n[yellow]:warning: Warning: ArchiveBox [blue]DATA_DIR[/blue] appears to be owned by [red]root[/red]. If this is an NFS or mapped volume and writes work, no change is required.[/yellow]", + ) + elif data_owner_doesnt_match: STDERR.print( f"\n[yellow]:warning: Warning: ArchiveBox [blue]DATA_DIR[/blue] is currently owned by [red]{data_dir_uid}:{data_dir_gid}[/red], but ArchiveBox user is [blue]{ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP}[/blue] ({USER})! (ArchiveBox may not be able to write to the data dir)[/yellow]", ) - if data_owned_by_root or data_owner_doesnt_match or data_not_writable: + if data_not_writable: STDERR.print( - f"[violet]Hint:[/violet] Change the current ownership [red]{data_dir_uid}[/red]:{data_dir_gid} (PUID:PGID) to a non-root user & group that will run ArchiveBox, e.g.:", + f"[violet]Hint:[/violet] Change the current ownership [red]{data_dir_uid}[/red]:{data_dir_gid} (PUID:PGID) to the user & group that will run ArchiveBox, e.g.:", ) STDERR.print(f" [grey53]sudo[/grey53] chown -R [blue]{DEFAULT_PUID}:{DEFAULT_PGID}[/blue] {DATA_DIR.resolve()}") + STDERR.print(" Avoid recursive chown on very large archives unless you know the full tree needs repair.") STDERR.print() STDERR.print("[blue]More info:[/blue]") STDERR.print( diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 5b2706c1..43033a8e 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -60,6 +60,8 @@ export DETECTED_PUID="${DETECTED_OWNER%%:*}" export DETECTED_PGID="${DETECTED_OWNER##*:}" export PUID="${PUID:-$DETECTED_PUID}" export PGID="${PGID:-$DETECTED_PGID}" +export REQUESTED_PUID="$PUID" +export REQUESTED_PGID="$PGID" if [[ ! "$PUID" =~ ^[0-9]+$ || ! "$PGID" =~ ^[0-9]+$ ]]; then echo -e "\n[X] Error: PUID and PGID must be numeric, got PUID=$PUID PGID=$PGID." > /dev/stderr @@ -67,11 +69,14 @@ if [[ ! "$PUID" =~ ^[0-9]+$ || ! "$PGID" =~ ^[0-9]+$ ]]; then exit 3 fi -# If user tries to set PUID or PGID to root values manually, warn but allow it. +# If user tries to set PUID or PGID to root values, keep root only for entrypoint +# setup and run ArchiveBox/Chrome as the default non-root user instead. if [[ "$PUID" == "0" || "$PGID" == "0" ]]; then - echo -e "\n[!] Warning: Got PUID=$PUID and PGID=$PGID, ArchiveBox/Chrome will run as root." > /dev/stderr - echo -e " This is not recommended because root-owned DATA_DIR files may be inaccessible to non-root users later." > /dev/stderr - echo -e " Default is $DEFAULT_PUID:$DEFAULT_PGID. See https://docs.linuxserver.io/general/understanding-puid-and-pgid" > /dev/stderr + [[ "$PUID" == "0" ]] && export PUID="$DEFAULT_PUID" + [[ "$PGID" == "0" ]] && export PGID="$DEFAULT_PGID" + echo -e "\n[!] Warning: Got PUID=$REQUESTED_PUID PGID=$REQUESTED_PGID, but ArchiveBox/Chrome should not run as root." > /dev/stderr + echo -e " The entrypoint will use root only for startup permission repair, then run ArchiveBox as a non-root user." > /dev/stderr + echo -e " Using PUID=$PUID PGID=$PGID. See https://docs.linuxserver.io/general/understanding-puid-and-pgid" > /dev/stderr fi if [[ "$(id -u)" == "0" ]]; then @@ -193,7 +198,7 @@ find "$PERSONAS_DIR" -type f \( \ find /tmp "$TMP_DIR" -maxdepth 1 -type d -name "archivebox-chrome-profile.*" -mmin +30 -exec rm -rf {} + >/dev/null 2>&1 || true -ensure_runtime_tree "/home/$ARCHIVEBOX_USER" +ensure_dir "/home/$ARCHIVEBOX_USER" ensure_runtime_tree "$PLAYWRIGHT_BROWSERS_PATH" ensure_runtime_tree "$TMP_DIR" ensure_runtime_tree "$LIB_DIR" diff --git a/bin/release_dev_stack.sh b/bin/release_dev_stack.sh index 3386d3b7..140596cf 100755 --- a/bin/release_dev_stack.sh +++ b/bin/release_dev_stack.sh @@ -121,10 +121,10 @@ build_and_prek() { ( cd "$repo" rm -rf dist - uv build + uv build --out-dir dist uv run prek run --all-files rm -rf dist - uv build + uv build --out-dir dist ) } @@ -136,7 +136,10 @@ commit_push_publish() { ( cd "$repo" - git add -A -- . ':!dist' ':!dist/**' + git add -u + while IFS= read -r path; do + git add -- "$path" + done < <(git ls-files --others --exclude-standard) if ! git diff --cached --quiet; then git commit -m "release: ${package} ${version}" else @@ -187,20 +190,32 @@ release_python_repo() { wait_for_pypi "$package" "$version" } -ABXPKG_VERSION="$(next_patch_version "$(current_version "$(repo_dir abxpkg)")")" -ABX_SHARED_VERSION="$(next_patch_version "$(current_version "$(repo_dir abx-plugins)")" "$(current_version "$(repo_dir abx-dl)")")" +if [[ -n "${ABXPKG_VERSION:-}" ]]; then + ABXPKG_VERSION="$ABXPKG_VERSION" +elif [[ "${SKIP_ABXPKG:-0}" == "1" ]]; then + ABXPKG_VERSION="$(current_version "$(repo_dir abxpkg)")" +else + ABXPKG_VERSION="$(next_patch_version "$(current_version "$(repo_dir abxpkg)")")" +fi +ABX_SHARED_VERSION="${ABX_SHARED_VERSION:-$(next_patch_version "$(current_version "$(repo_dir abx-plugins)")" "$(current_version "$(repo_dir abx-dl)")")}" -bump_patch_to "$(repo_dir abxpkg)" "$ABXPKG_VERSION" -release_python_repo abxpkg main abxpkg "$ABXPKG_VERSION" +if [[ "${SKIP_ABXPKG:-0}" != "1" ]]; then + bump_patch_to "$(repo_dir abxpkg)" "$ABXPKG_VERSION" + release_python_repo abxpkg main abxpkg "$ABXPKG_VERSION" +fi -bump_patch_to "$(repo_dir abx-plugins)" "$ABX_SHARED_VERSION" -set_dependency_version "$(repo_dir abx-plugins)" abxpkg "$ABXPKG_VERSION" -release_python_repo abx-plugins main abx-plugins "$ABX_SHARED_VERSION" +if [[ "${SKIP_ABX_PLUGINS:-0}" != "1" ]]; then + bump_patch_to "$(repo_dir abx-plugins)" "$ABX_SHARED_VERSION" + set_dependency_version "$(repo_dir abx-plugins)" abxpkg "$ABXPKG_VERSION" + release_python_repo abx-plugins main abx-plugins "$ABX_SHARED_VERSION" +fi -bump_patch_to "$(repo_dir abx-dl)" "$ABX_SHARED_VERSION" -set_dependency_version "$(repo_dir abx-dl)" abxpkg "$ABXPKG_VERSION" -set_dependency_version "$(repo_dir abx-dl)" abx-plugins "$ABX_SHARED_VERSION" -release_python_repo abx-dl main abx-dl "$ABX_SHARED_VERSION" +if [[ "${SKIP_ABX_DL:-0}" != "1" ]]; then + bump_patch_to "$(repo_dir abx-dl)" "$ABX_SHARED_VERSION" + set_dependency_version "$(repo_dir abx-dl)" abxpkg "$ABXPKG_VERSION" + set_dependency_version "$(repo_dir abx-dl)" abx-plugins "$ABX_SHARED_VERSION" + release_python_repo abx-dl main abx-dl "$ABX_SHARED_VERSION" +fi ARCHIVEBOX_VERSION="$(bump_archivebox_rc)" set_dependency_version "$ARCHIVEBOX_REPO" abxpkg "$ABXPKG_VERSION" diff --git a/etc/package.json b/etc/package.json index ad5f31f0..bbcad299 100644 --- a/etc/package.json +++ b/etc/package.json @@ -1,6 +1,6 @@ { "name": "archivebox", - "version": "0.9.31rc15", + "version": "0.9.31rc16", "repository": "github:ArchiveBox/ArchiveBox", "license": "MIT", "dependencies": { diff --git a/pyproject.toml b/pyproject.toml index c73e4e7d..1bb7b3cc 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "archivebox" -version = "0.9.31rc15" +version = "0.9.31rc16" requires-python = ">=3.13" description = "Self-hosted internet archiving solution." authors = [{name = "Nick Sweeting", email = "pyproject.toml@archivebox.io"}] @@ -79,9 +79,9 @@ dependencies = [ ### Extractor dependencies (optional binaries detected at runtime via shutil.which) ### Binary/Package Management "abxbus>=2.5.4", # EventBus API - "abxpkg>=1.10.7", # for: detecting, versioning, and installing binaries via apt/brew/pip/npm - "abx-plugins>=1.10.74", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring - "abx-dl>=1.10.74", # shared ArchiveBox downloader package with blocking install preflight + "abxpkg>=1.10.8", # for: detecting, versioning, and installing binaries via apt/brew/pip/npm + "abx-plugins>=1.10.75", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring + "abx-dl>=1.10.75", # shared ArchiveBox downloader package with blocking install preflight ### UUID7 backport for Python <3.14 "uuid7>=0.1.0; python_version < '3.14'", # provides the uuid_extensions module on Python 3.13 ]