Skip to content

serverscom/srvctl

Repository files navigation

srvctl - CLI for Servers.com infrastructure

Go Reference Go Report Card

Description

Manage your Servers.com bare metal servers, cloud servers, and infrastructure directly from the terminal.

srvctl wraps the Servers.com Public API into a fast, scriptable command-line interface built in Go.

Quick Start

Homebrew (macOS & Linux):

brew tap serverscom/serverscom
brew install srvctl

Docker:

docker pull ghcr.io/serverscom/srvctl:latest
docker run --rm -it ghcr.io/serverscom/srvctl:latest --help

Binary releases:

Download the latest release for your OS and architecture from the Releases page.

Usage

Authentication

Create a context with your Servers.com API token:

$ srvctl login default 
Enter API token: *****

Successfully logged in with context "default"
Context "default" set as default

Configuration

The config file is stored at $XDG_CONFIG_HOME/srvctl/config.yaml, if XDG_CONFIG_HOME exists. Otherwise it will rely on $HOME/.config/srvctl/config.yaml. You can override this with the SRVCTL_CONFIG_PATH environment variable.

srvctl supports multiple contexts, allowing you to manage several Servers.com accounts or API endpoints from a single installation:

globalConfig: {}
defaultContext: default
contexts:
    - name: default
      endpoint: https://api.servers.com/v1
      token: <YOUR_API_TOKEN>
      config: {}
    - name: different-context
      endpoint: https://api.servers.com/v2
      token: <2ND_API_TOKEN>
      config: {
        proxy: "",
        http-timeout: 30,
        verbose: true, /* (true|false) */
        output: "json" /* (text|json|yaml) */
      }

You can adjust the context later on:

# changing the context name
srvctl context update <context-name> --name=<new-name>

# setting context to act as default
srvctl context update <context-name> --default

# delete specific context
srvctl context delete <context-name>

Shell Completion

srvctl can generate completion scripts for bash, zsh, fish, and powershell.

Quick check (current shell only):

source <(srvctl completion bash)   # or: zsh / fish

Permanent install — bash:

# Linux
srvctl completion bash | sudo tee /etc/bash_completion.d/srvctl >/dev/null

# macOS (with Homebrew's bash-completion)
srvctl completion bash > "$(brew --prefix)/etc/bash_completion.d/srvctl"

Requires the bash-completion package. Start a new shell after install.

Permanent install — zsh:

# Ensure compinit is enabled in ~/.zshrc:
#   autoload -U compinit && compinit
srvctl completion zsh > "${fpath[1]}/_srvctl"

Permanent install — fish:

srvctl completion fish > ~/.config/fish/completions/srvctl.fish

For full details on any shell, run srvctl completion <shell> --help.

Documentation

Documentation is accessible via man or via --help flag, for example:

# man option
$ man srvctl-hosts-ds-list

# help option, short command help
$ srvctl hosts ds list --help

Man pages are based on the documentation info located in /docs directory.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

srvctl is released under the Apache 2.0 License.

About

Command-line tool for managing Servers.com dedicated and cloud server infrastructure

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages