Skip to main content

Onctl

onctl is a tool to manage virtual machines in multi-cloud.

Check 🌍 https://onctl.sh for detailed documentation

build Lint CodeQL codecov Github All Releases GitHub release (latest SemVer)

What onctl brings​

  • 🌍 Simple intuitive CLI to run VMs in seconds.
  • ⛅️ Supports multiple cloud providers (aws, azure, gcp, hetzner, ovh) plus local microVMs via Firecracker (fc) and Cloud Hypervisor (ch) -- no cloud account needed for those two
  • 🚀 Sets your public key and Gives you SSH access with onctl ssh <vm-name>
  • ✨ Cloud-init support. Set your own cloud-init file onctl up -n qwe --cloud-init <cloud.init.file>
  • 🤖 Use ready to use templates to configure your vm. Check onctl-templates onctl up -n qwe -a k3s/k3s-server.sh
  • 🗂️ Use your custom local or http accessible scripts to configure your vm. onctl ssh qwe -a <my_local_script.sh>

Quick Start​

initialize project. this will create a .onctl directory. check configuration file and set as needed.

# initialize the onctl environment
❯ onctl init
onctl environment initialized

macOS and Linux​

# install the latest release
curl -fsSL https://onctl.sh/get.sh | bash

The installer downloads the release for your OS and architecture, verifies it against the release checksums, installs onctl to ~/.local/bin (override with ONCTL_INSTALL_DIR), and adds that directory to your PATH in ~/.bashrc, ~/.zshrc or fish's config if it isn't there already. No sudo. Open a new terminal afterwards. To install a specific version, set ONCTL_VERSION=v0.1.34. Windows users can grab onctl-windows-amd64.zip from the releases page.

Edge build (latest main, Linux and macOS)​

To install or update to the edge build, a binary rebuilt from the tip of main on every push (no Windows build):

# install the latest main (edge build)
curl -fsSL https://onctl.sh/get-edge.sh | bash

Tab completion​

The install scripts also set up tab completion for your shell (bash, zsh or fish): subcommands, flags, and the names of your own VMs, so onctl ssh my-b<TAB> finishes the name for you. Open a new terminal after installing to pick it up.

It works by writing a completion script to your shell's per-user completion folder and, for bash and zsh, adding one line to ~/.bashrc or ~/.zshrc that loads it. To skip this, run the installer with ONCTL_NO_COMPLETION=1:

curl -fsSL https://onctl.sh/get.sh | ONCTL_NO_COMPLETION=1 bash

To set it up by hand instead:

echo 'source <(onctl completion bash)' >> ~/.bashrc # bash
echo 'source <(onctl completion zsh)' >> ~/.zshrc # zsh
onctl completion fish > ~/.config/fish/completions/onctl.fish

VM names are looked up live from your cloud provider, so completing them needs an initialized .onctl directory and working credentials.

Windows​

  • download windows binary from releases page
  • unzip and copy onctl.exe to a location in PATH

Enjoy ✅

❯ onctl
onctl is a tool to manage cross platform resources in cloud

Usage:
onctl [command]

Examples:
# List all VMs
onctl ls

# Create a VM with docker installed
onctl create -n test -a docker/docker.sh

# SSH into a VM
onctl ssh test

# Destroy a VM
onctl destroy test

Available Commands:
action Execute a custom action from GitHub
completion Generate the autocompletion script for the specified shell
create Create a VM
deploy Deploy a Docker image to a remote VM
destroy Destroy VM(s)
env Manage environments
help Help about any command
images List available OS images for the current cloud provider
import Import an existing server so it can be managed with ssh/ls
init init onctl environment
ls List VMs
pause Snapshot and delete a VM to stop compute cost (keeps its IP)
resume Recreate a paused VM from its snapshot
ssh Spawn an SSH connection to a VM
templates Manage onctl templates
version Print the version number of onctl
vm Manage virtual machines

Flags:
-c, --config string Path to onctl.yaml configuration file (overrides the .onctl directory lookup)
-h, --help help for onctl
--project gcloud config get-value project GCP: project ID (falls back to gcloud config get-value project when the onctl.yaml placeholder is present)
-p, --provider string cloud provider: aws, hetzner, azure, gcp, ovh, fc, ch, static (overrides ONCTL_CLOUD)
--resource-group string Azure: resource group (required for the azure provider; falls back to the az CLI's configured default group, if any)
--service-name string OVH: Public Cloud project service name (required for the ovh provider)
--subscription-id az account show Azure: subscription ID (required for the azure provider; falls back to az account show)

Use "onctl [command] --help" for more information about a command.