Skip to content
/ mikrus Public

Go client library and CLI for MIKR.US VPS Provider

License

Notifications You must be signed in to change notification settings

qba73/mikrus

Repository files navigation

Go Reference Go Report Card Tests GitHub go.mod Go version GitHub

mikrus

mikrus is a Go library and command-line client for MIKRUS VPS provider. It allows you to interact with provisioned servers and perform various tasks, for example:

  • show information about your server
  • list provisioned servers
  • restart your server
  • check last log messages
  • boost your server performance by turning on Amfetamina functionality
  • show config for your DB(s) (Postgres, MySQL)
  • execute remote commands on your server
  • show usage / resource utilization statistics
  • show ports assigned to your server
  • show cloud functions assigned to your account (including stats)
  • add / change domain assigned to your server

Installing the command-line client

To install the client binary, run:

go install github.com/qba73/mikrus/cmd/mikctl@latest

Using the command-line client

To see help on using the client, run:

mikctl -h

Setting your API key and Server ID

To use the client with your Mikrus account, you will need the API Key and Server ID provisioned in your Mikrus account. Go to the Mikrus page, sign up for the service. When your account is ready, go to the panel page and get your server ID and corresponding API key.

There are three ways to pass your API key to the client: in a config file, in an environment variable, or on the command line.

In a config file

The mikctl client will read a config file named .mikrus.yaml (or .mikrus.json, or any other extension that Viper supports) in your home directory, or in the current directory.

For example, you can put your API key and sever ID in the file $HOME/.mikrus.yaml, and mikctl will find and read them automatically (replace XXX with your own API key, and YYY with your server ID):

apiKey: XXX
srvID: YYY

In an environment variable

mikctl will look for the API key and server ID in an environment variable named MIKRUS_API_KEY and MIKRUS_SRV_ID:

export MIKRUS_API_KEY=XXX
export MIKRUS_SRV_ID=YYY
mikctl ...

On the command line

You can also pass your API key and server ID to the mikctl client using the --apiKey and --srvID flags like this:

mikctl --apiKey XXX --srvID YYY

Testing your configuration

To test that your API key is correct and mikctl is reading it properly, run:

mikctl server

or

 mikctl --srvID YYY --apiKey XXX server

Getting server info

The mikctl server command will list information about your server:

mikctl --srvID XXX --apiKey YYY server
ServerID: j230
Server name:
Expiration date: 2026-06-08 00:00:00
Cytrus expiration date:
Storage expiration date:
RAM size: 1024
Disk size: 10
Last log time: 2024-06-07 09:06:35
Is Pro service: nie

Listing servers

The mikctl servers command will list basic information about your provisioned servers:

mikctl --srvID XXX --apiKey YYY  servers

Server ID: a135
Server name:
Expiration date: 2025-06-05 00:00:00
RAM size: 1024
ParamDisk: 10

Server ID: j330
Server name:
Expiration date: 2026-06-08 00:00:00
RAM size: 1024
ParamDisk: 10

Listing logs

The mikctl logs command will list last ten (max) log messages:

mikctl --srvID j230 --apiKey XXX logs

ID: 3756
Server ID: j230
Task: sshkey
Created: 2024-06-07 09:06:58
Done: 2024-06-07 09:07:01
Output: Uploaded SSH key

ID: 3751
Server ID: j230
Task: restart
Created: 2024-06-05 09:57:54
Done: 2024-06-05 09:58:07
Output: OK

ID: 3749
Server ID: j230
Task: password
Created: 2024-06-05 09:16:50
Done: 2024-06-05 09:17:02
Output: OK

ID: 3748
Server ID: j230
Task: upgrade
Created: 2024-06-05 08:59:28
Done: 2024-06-05 09:00:04
Output: === Aktualne parametry: 768 RAM / 10 DYSK 2 / 20 Dodaje: 256MB RAM oraz 0GB dysku Po zmianie: 1024 MB / 10 GB [succes] GOTOWE!

Bugs and feature requests

If you find a bug in the mikrus client or library, please open an issue. Similarly, if you'd like a feature added or improved, let me know via an issue.

Not all the functionality of the Mikrus API is implemented yet.

Pull requests welcome!

About

Go client library and CLI for MIKR.US VPS Provider

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages