astro-cli icon indicating copy to clipboard operation
astro-cli copied to clipboard

Support and document installation to location that does not require root

Open danielhoherd opened this issue 7 months ago • 1 comments

Description

We should support and document a method for installing to a location that does not require elevated privileges. Traditionally this location would be $HOME/.local/bin.

Currently (as of 2025-03-11) the documentation does not instruct the user about how to do this: https://www.astronomer.io/docs/astro/cli/install-cli/#install-the-astro-cli

Unix systems are the main environment that I am referring to, I do not know how this would function under windows.

Proposed solution

Allow setting the destination as an env var. Currently we see this:

$ curl -sSL install.astronomer.io
#!/usr/bin/env bash

TAG=$1

if (( EUID != 0 )); then
    echo "Please run command as root."
    exit
fi

DOWNLOADER="https://raw.githubusercontent.com/astronomer/astro-cli/main/godownloader.sh"
curl -sL -o- ${DOWNLOADER} | bash -s -- -b /usr/local/bin "$TAG"

Which indicates that we could do something like:

$ DOWNLOADER="https://raw.githubusercontent.com/astronomer/astro-cli/main/godownloader.sh"
$ curl -sL -o- ${DOWNLOADER} | bash -s -- -b "$HOME"/.local/bin "$TAG"
astronomer/astro-cli info Using Latest(v1.33.1) version
astronomer/astro-cli info found version: 1.33.1 for v1.33.1/linux/amd64
astronomer/astro-cli info installed /home/danielh/.local/bin/astro

Which indeed does work. So if we could just set DESTINATION_DIR="${DESTINATION_DIR:-/usr/local/bin}" or something I think that would do it.

Links

danielhoherd avatar Mar 11 '25 21:03 danielhoherd