Skip to content

Commit 1c815b6

Browse files
authored
feat(docs): add getting started instructions to docs (#276)
- Update Linux installation commands - Update Windows install commands and clarifies which should be executed as administrator - Setup automation to keep versions in examples up-to-date - Remove duplicate sections from README and link to docs instead
1 parent ae61475 commit 1c815b6

7 files changed

Lines changed: 193 additions & 173 deletions

File tree

.github/workflows/docs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
branches:
55
- main
66
- test-docs-generator # for testing
7+
# Update version in installation instructions when new version is released
8+
release:
9+
types:
10+
- released
711

812
jobs:
913
generate-and-deploy:
@@ -12,6 +16,8 @@ jobs:
1216
steps:
1317
- name: Checkout head
1418
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
19+
with:
20+
fetch-depth: 0
1521
- name: Setup Go
1622
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
1723
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ dist/
4141
/docs/CHANGELOG.md
4242
/mkdocs.yaml
4343
/site/
44+
/vars.yaml
4445

4546
# Generated release notes
4647
.release_notes

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ MODULE = $(shell env GO111MODULE=on $(GO) list -m)
88
DATE ?= $(shell date +%FT%T%z)
99
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || \
1010
cat $(CURDIR)/.version 2> /dev/null || echo v0)
11+
LATEST_RELEASE ?= $(shell git describe --tags --match=v* --abbrev=0 | grep -o "[0-9]\.[0-9]\.[0-9]")
1112
PKGS = $(or $(PKG),$(shell env GO111MODULE=on $(GO) list ./...))
1213
TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \
1314
'{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \
@@ -59,6 +60,7 @@ install-docs-tools:
5960
docs: clean-docs md-docs install-docs-tools ## Generate documentation (mkdocs site)
6061
$(PYTHON) .ci/docs/generate_dynamic_nav.py
6162
$(PYTHON) .ci/docs/prepare_info_texts_for_mkdocs.py
63+
echo "latest_release: $(LATEST_RELEASE)" > vars.yaml
6264
mkdocs build
6365

6466
.PHONY: build-all

README.md

Lines changed: 17 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -5,165 +5,23 @@
55
`upctl` provides a command-line interface to [UpCloud](https://upcloud.com/) services. It allows you
66
to control your resources from the command line or any compatible interface.
77

8-
```txt
9-
UpCloud command-line interface
10-
11-
`upctl` provides a command-line interface to UpCloud services. It allows you to
12-
control your resources from the command line or any compatible interface.
13-
14-
To be able to manage your UpCloud resources, you need to configure credentials
15-
for `upctl` and enable API access for these credentials. Define the credentials
16-
by setting `UPCLOUD_USERNAME` and `UPCLOUD_PASSWORD` environment variables. API
17-
access can be configured on the Account page of the UpCloud Hub. We recommend
18-
you to set up a sub-account specifically for the API usage with its own username
19-
and password, as it allows you to assign specific permissions for increased
20-
security.
21-
22-
Usage:
23-
upctl [command]
24-
25-
Available Commands:
26-
account Manage accounts
27-
completion Generate the autocompletion script for the specified shell
28-
database Manage databases
29-
help Help about any command
30-
ip-address Manage IP addresses
31-
kubernetes Manage Kubernetes clusters
32-
loadbalancer Manage load balancers
33-
network Manage networks
34-
router Manage routers
35-
server Manage servers
36-
servergroup Manage server groups
37-
storage Manage storages
38-
version Display software information
39-
zone Display zone information
40-
41-
Options:
42-
-t, --client-timeout duration Client timeout to use in API calls.
43-
Default: 0s
44-
45-
--config string Configuration file path.
46-
47-
--debug bool Print out more verbose debug logs.
48-
Default: false
49-
50-
--force-colours Force coloured output despite detected terminal support.
51-
52-
--no-colours Disable coloured output despite detected terminal support. Colours can also be disabled by setting
53-
NO_COLOR environment variable.
54-
55-
-o, --output string Output format (supported: json, yaml and human)
56-
Default: human
57-
58-
Use "upctl [command] --help" for more information about a command.
59-
```
60-
61-
## Installation
62-
63-
Install the latest with Go by running:
64-
65-
```bash
66-
go install github.com/UpCloudLtd/upcloud-cli/v3/...@latest
67-
```
68-
69-
To use upctl as a binary, download it from the
70-
[Releases](https://github.com/UpCloudLtd/upcloud-cli/releases) page. After downloading, verify that the client works.
71-
72-
### macOS
73-
74-
```bash
75-
brew tap UpCloudLtd/tap
76-
brew install upcloud-cli
77-
upctl -h
78-
```
79-
80-
Setting up bash completion requires a few commands more.
8+
## Getting started
819

82-
First, install `bash-completion`, if it is not installed already.
10+
For instructions on how to install `upctl`, configure credentials, and run commands, see [Getting started](https://upcloudltd.github.io/upcloud-cli/) instructions in the documentation.
8311

84-
```bash
85-
brew install bash-completion
86-
echo '[ -f "$(brew --prefix)/etc/bash_completion" ] && . "$(brew --prefix)/etc/bash_completion"' >> ~/.bash_profile
87-
```
12+
## Install with go install
8813

89-
Then configure the shell completions for `upctl` by saving the output of `upctl completion bash` in `upctl` file under `/etc/bash_completion.d/`:
14+
Install the latest version of `upctl` with `go install` by running:
9015

91-
```bash
92-
upctl completion bash > $(brew --prefix)/etc/bash_completion.d/upctl
93-
. $(brew --prefix)/etc/bash_completion
94-
```
95-
96-
### Linux
97-
98-
#### AUR
99-
```
100-
yay -S upcloud-cli
101-
```
102-
103-
#### Other Linux distros
104-
105-
Use the package corresponding to your distro (deb, rpm, apk) from the [releases page](https://github.com/UpCloudLtd/upcloud-cli/releases), example for Debian like:
106-
107-
```bash
108-
# Replace <VERSION> with the version you want to install
109-
curl -Lo upcloud-cli.deb https://github.com/UpCloudLtd/upcloud-cli/releases/download/v<VERSION>/upcloud-cli-<VERSION>_amd64.deb
110-
sudo dpkg -i upcloud-cli.deb
111-
upctl -h
112-
```
113-
114-
Bash completion can also be set up with some extra commands. You should adapt this for your package manager.
115-
116-
First, install `bash-completion`, if it is not installed already.
117-
118-
```bash
119-
sudo apt install bash-completion
120-
echo "[ -f /etc/bash_completion ] && . /etc/bash_completion" >> ~/.bashrc
121-
```
122-
123-
Then configure the shell completions for `upctl` by either sourcing `upctl completion bash` output in your bash `.bashrc` or by saving the output of that command in `upctl` file under `/etc/bash_completion.d/`:
124-
125-
```bash
126-
# First alternative
127-
echo 'source <(upctl completion bash)' >>~/.bashrc
128-
129-
# Second alternative
130-
upctl completion bash | sudo tee /etc/bash_completion.d/upctl > /dev/null
131-
. /etc/bash_completion
132-
```
133-
134-
### Windows
135-
```bash
136-
Invoke-WebRequest -Uri "https://github.com/UpCloudLtd/upcloud-cli/releases/download/v<VERSION>/upcloud-cli-<VERSION>_windows_x86_64.zip" -OutFile "upcloud-cli.zip"
137-
Expand-Archive -Path upcloud-cli.zip -Destination 'C:\Program Files\Upcloud CLI'
138-
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Upcloud CLI", [System.EnvironmentVariableTarget]::Machine)
139-
upctl.exe -h
140-
```
141-
142-
## Quick Start
143-
144-
Create a `upctl.yaml` config file with user credentials into your home
145-
directory's .config dir ($HOME/.config/upctl.yaml).
146-
147-
```yaml
148-
username: your_upcloud_username
149-
password: your_upcloud_password
16+
```sh
17+
go install github.com/UpCloudLtd/upcloud-cli/v3/...@latest
15018
```
15119

152-
Credentials can also be stored at environment variables `UPCLOUD_USERNAME` and `UPCLOUD_PASSWORD`. If variables
153-
are set, matching config file items are ignored.
154-
155-
> NOTE: Make sure your account allows API connections. To do so, log into
156-
> [UpCloud control panel](https://hub.upcloud.com/login) and go to **Account**
157-
> -> **Permissions** -> **Allow API connections** checkbox.
20+
Run `upctl version` to verify that the tool was installed successfully and `upctl help` to print usage instructions.
15821

159-
Run something to test that the credentials are working.
160-
161-
```bash
162-
$ upctl server list
163-
UUID Hostname Plan Zone State
164-
────────────────────────────────────── ──────────────────── ─────────── ───────── ─────────
165-
00229ddf-0e46-45b5-a8f7-cad2c8d11f6a server1 2xCPU-4GB de-fra1 stopped
166-
003c9d77-0237-4ee7-b3a1-306efba456dc server2 1xCPU-2GB sg-sin1 started
22+
```sh
23+
upctl version
24+
upctl help
16725
```
16826

16927
## Exit codes
@@ -214,24 +72,15 @@ If something is missing from there, add an issue or PR in that repository instea
21472

21573
## Development
21674

217-
* upctl uses [UpCloud Go API SDK](https://github.com/UpCloudLtd/upcloud-go-api)
218-
* upctl is built on [Cobra](https://cobra.dev)
75+
* `upctl` uses [UpCloud Go API SDK](https://github.com/UpCloudLtd/upcloud-go-api)
76+
* `upctl` is built on [Cobra](https://cobra.dev)
21977

220-
You need a Go version 1.18+ installed on your development machine.
221-
Use `make` to build and test the CLI. Makefile help can be found:
78+
You need a Go version 1.20+ installed on your development machine.
22279

223-
```
224-
$ make help
225-
build Build program binary for current os/arch
226-
doc Generate documentation (markdown)
227-
build-all Build all targets
228-
build-linux Build program binary for linux x86_64
229-
build-darwin Build program binary for darwin x86_64
230-
build-windows Build program binary for windows x86_64
231-
build-freebsd Build program binary for freebsd x86_64
232-
test Run tests
233-
fmt Run gofmt on all source files
234-
clean Cleanup everything
80+
Use `make` to build and test the CLI. Makefile help can be found by running `make help`.
81+
82+
```sh
83+
make help
23584
```
23685

23786
### Debugging

0 commit comments

Comments
 (0)