Compare commits

..
5 Commits
9 changed files with 51 additions and 15 deletions
+4 -1
View File
@@ -40,6 +40,9 @@ func NewAddCommand() *cobra.Command {
Short: "Add a remote machine to a cluster.",
Long: `Add a new machine to an existing Uncloud cluster.
By default, it installs Docker and the Uncloud daemon on the machine over SSH unless --no-install
is specified, which assumes they are already installed and running.
Connection methods:
[ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required)
ssh+go://user@host - Use Go's built-in SSH library`,
@@ -79,7 +82,7 @@ Connection methods:
)
cmd.Flags().BoolVar(
&opts.noInstall, "no-install", false,
"Skip installation of Docker, Uncloud daemon, and dependencies on the machine. "+
"Skip installation of Docker and the Uncloud daemon on the machine. "+
"Assumes they're already installed and running.",
)
cmd.Flags().StringVar(
+4 -1
View File
@@ -45,6 +45,9 @@ func NewInitCommand() *cobra.Command {
Long: `Initialise a new cluster by setting up a remote machine as the first member.
This command creates a new context in your Uncloud config to manage the cluster.
By default, it installs Docker and the Uncloud daemon on the machine over SSH unless --no-install
is specified, which assumes they are already installed and running.
Connection methods:
[ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required)
ssh+go://user@host - Use Go's built-in SSH library`,
@@ -117,7 +120,7 @@ Connection methods:
)
cmd.Flags().BoolVar(
&opts.noInstall, "no-install", false,
"Skip installation of Docker, Uncloud daemon, and dependencies on the machine. "+
"Skip installation of Docker and the Uncloud daemon on the machine. "+
"Assumes they're already installed and running.",
)
cmd.Flags().StringVar(
+1 -2
View File
@@ -136,8 +136,7 @@ func remove(ctx context.Context, uncli *cli.CLI, nameOrID string, opts removeOpt
return fmt.Errorf("confirm removal: %w", err)
}
if !confirmed {
fmt.Println("Cancelled. Machine was not removed.")
return nil
return cli.Cancelled("Cancelled. Machine was not removed.")
}
}
+1 -2
View File
@@ -92,8 +92,7 @@ func remove(ctx context.Context, uncli *cli.CLI, names []string, opts removeOpti
return fmt.Errorf("confirm removal: %w", err)
}
if !confirmed {
fmt.Println("Cancelled. No volumes were removed.")
return nil
return cli.Cancelled("Cancelled. No volumes were removed.")
}
}
+2 -3
View File
@@ -31,9 +31,8 @@ const (
//
// The two minimums are independent: a client might require a newer daemon for new
// features, while that same daemon could still handle requests from older clients.
// TODO: update to 0.20.0 before releasing 0.20.0.
MinClientVersion = "0.20.0-nightly"
MinServerVersion = "0.20.0-nightly"
MinClientVersion = "0.20.0"
MinServerVersion = "0.20.0"
ReleaseURL = "https://github.com/psviderski/uncloud/releases/latest"
)
+30 -3
View File
@@ -3,10 +3,30 @@ set -e
GITHUB_REPO="psviderski/uncloud"
INSTALL_DIR=${INSTALL_DIR:-/usr/local/bin}
# Use the latest version or specify the version to install:
# Use the latest version or specify the version to install (the 'v' prefix is optional):
# curl ... | VERSION=v1.2.3 sh
VERSION=${VERSION:-latest}
# Normalise numeric versions to a 'vX.Y.Z' release tag so VERSION can be passed with or without
# the 'v' prefix. Non-numeric refs such as 'nightly' are tags as-is and left untouched.
case "${VERSION#v}" in
[0-9]*) VERSION="v${VERSION#v}" ;;
esac
# The CLI archive and binary were renamed from 'uncloud' to 'uc' in v0.20.0. Returns success (0) when VERSION
# is a numeric release older than v0.20.0, which still uses the legacy 'uncloud_*' archive and 'uncloud' binary name.
# Newer versions and non-numeric refs such as 'nightly' use 'uc'.
is_legacy_version() {
v="${VERSION#v}"
major="${v%%.*}"
rest="${v#*.}"
minor="${rest%%.*}"
case "$major" in ''|*[!0-9]*) return 1 ;; esac
case "$minor" in ''|*[!0-9]*) return 1 ;; esac
[ "$major" -eq 0 ] && [ "$minor" -lt 20 ]
}
print_manual_install() {
RELEASES_URL="https://github.com/${GITHUB_REPO}/releases/${VERSION}"
echo "Failed while attempting to install uncloud CLI. You can install it manually:"
@@ -63,7 +83,14 @@ esac
if [ "$VERSION" = "latest" ]; then
fetch_latest_version
fi
BINARY_NAME="uc_${BINARY_OS}_${BINARY_ARCH}.tar.gz"
# Pick the archive and binary name for the requested version. Pre-v0.20.0 releases ship the legacy 'uncloud' name.
# v0.20.0 and newer ship 'uc'.
CLI_NAME="uc"
if is_legacy_version; then
CLI_NAME="uncloud"
fi
BINARY_NAME="${CLI_NAME}_${BINARY_OS}_${BINARY_ARCH}.tar.gz"
BINARY_URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${BINARY_NAME}"
CHECKSUM_URL="https://github.com/${GITHUB_REPO}/releases/download/$VERSION/checksums.txt"
@@ -94,7 +121,7 @@ if [ -z "${SUDO}" ]; then
else
echo "Installing uc binary to ${INSTALL_DIR} using sudo. You may be prompted for your password."
fi
if ! $SUDO install ./uc "${INSTALL_DIR}/uc"; then
if ! $SUDO install "./${CLI_NAME}" "${INSTALL_DIR}/uc"; then
echo "Failed to install uc binary to ${INSTALL_DIR}"
print_manual_install
exit 1
@@ -116,7 +116,7 @@ Alternatively, you can download `.deb` packages directly from the repository
After installation, verify that `uc` command is working:
```shell
uc --version
uc version
```
## Next steps
@@ -6,6 +6,9 @@ Add a remote machine to a cluster.
Add a new machine to an existing Uncloud cluster.
By default, it installs Docker and the Uncloud daemon on the machine over SSH unless --no-install
is specified, which assumes they are already installed and running.
Connection methods:
[ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required)
ssh+go://user@host - Use Go's built-in SSH library
@@ -20,7 +23,7 @@ uc machine add [USER@]HOST[:PORT] [flags]
-h, --help help for add
-n, --name string Assign a name to the machine. (default is the machine's hostname)
--no-caddy Don't deploy Caddy reverse proxy service to the machine.
--no-install Skip installation of Docker, Uncloud daemon, and dependencies on the machine. Assumes they're already installed and running.
--no-install Skip installation of Docker and the Uncloud daemon on the machine. Assumes they're already installed and running.
--public-ip string Public IP address of the machine for ingress configuration. Use 'auto' for automatic detection, blank '' or 'none' to disable ingress on this machine, or specify an IP address. (default "auto")
-i, --ssh-key string Path to SSH private key for remote login (if not already added to SSH agent). (default "~/.ssh/id_ed25519")
--version string Version of the Uncloud daemon to install on the machine. (default "latest")
@@ -7,6 +7,9 @@ Initialise a new cluster with a remote machine as the first member.
Initialise a new cluster by setting up a remote machine as the first member.
This command creates a new context in your Uncloud config to manage the cluster.
By default, it installs Docker and the Uncloud daemon on the machine over SSH unless --no-install
is specified, which assumes they are already installed and running.
Connection methods:
[ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required)
ssh+go://user@host - Use Go's built-in SSH library
@@ -42,7 +45,7 @@ uc machine init [schema://]USER@HOST[:PORT] [flags]
--network string IPv4 network CIDR to use for machines and services. (default "10.210.0.0/16")
--no-caddy Don't deploy Caddy reverse proxy service to the machine. You can deploy it later with 'uc caddy deploy'.
--no-dns Don't reserve a cluster domain in Uncloud DNS. You can reserve it later with 'uc dns reserve'.
--no-install Skip installation of Docker, Uncloud daemon, and dependencies on the machine. Assumes they're already installed and running.
--no-install Skip installation of Docker and the Uncloud daemon on the machine. Assumes they're already installed and running.
--public-ip string Public IP address of the machine for ingress configuration. Use 'auto' for automatic detection, blank '' or 'none' to disable ingress on this machine, or specify an IP address. (default "auto")
-i, --ssh-key string Path to SSH private key for remote login (if not already added to SSH agent). (default "~/.ssh/id_ed25519")
--version string Version of the Uncloud daemon to install on the machine. (default "latest")