chore: full update content, links, yaml,etc
This commit is contained in:
parent
b233fa3e4d
commit
8bfc73452e
143
README.md
143
README.md
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
<img style="margin-top: 1em;width: 500px;border: 0" alt="Fork me on GitHub" src="logo/upclapi.svg?sanitize=true">
|
<img style="margin-top: 1em;width: 500px;border: 0" alt="Fork me on GitHub" src="logo/upclapi.svg?sanitize=true">
|
||||||
|
|
||||||
## Declarative [UpCloud](https://upcloud.com) Go API with YAML
|
## Declarative & command-line interface for [UpCloud](https://upcloud.com) resources
|
||||||
|
|
||||||
This was created to:
|
This was created since December 2020 to:
|
||||||
|
|
||||||
|
- to use YAML config definition files for resources and services
|
||||||
- create,delete,start,stop [UpCloud servers](https://upcloud.com/products/cloud-servers/).
|
- create,delete,start,stop [UpCloud servers](https://upcloud.com/products/cloud-servers/).
|
||||||
- modify, delete [UpCloud storages](https://upcloud.com/products/maxiops-storage/).
|
- modify, delete [UpCloud storages](https://upcloud.com/products/maxiops-storage/).
|
||||||
- Run commands with **ssh** in [UpCloud servers](https://upcloud.com/products/cloud-servers/).
|
- Run commands with **ssh** in [UpCloud servers](https://upcloud.com/products/cloud-servers/).
|
||||||
@ -28,19 +29,26 @@ It clearly does not try to replace tools like [Terraform](https://www.terraform.
|
|||||||
- resources lists in **json**
|
- resources lists in **json**
|
||||||
- prototyping
|
- prototyping
|
||||||
...
|
...
|
||||||
|
- As a provider tool for other **LibreClouds** [Klouds](https://rlung.librecloud.online/LibreCloud/Klouds#klouds) tools: [CloudMandala](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala) and [Zteron](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala)
|
||||||
|
|
||||||
|
Since March 2021 [UpCloud](https://github.com/UpCloudLtd) made available a [UpCloud CLI - upctl](https://github.com/UpCloudLtd/upcloud-cli#upcloud-cli---upctl) to allow resources control from command line.
|
||||||
|
[UpClapi](https://rlung.librecloud.online/LibreCloud/Upclapi#upclapi) was create to be used with a [Declarative](https://en.wikipedia.org/wiki/Declarative_programming) approach to manage infrastructures although some tasks can be solved with imperative command calls, resources relationship and their dependencies should be set and declared somewhere at least for monitoring,management,etc.
|
||||||
|
|
||||||
|
Both developments ([upctl](https://github.com/UpCloudLtd/upcloud-cli#upcloud-cli---upctl) and [upclapi](https://rlung.librecloud.online/LibreCloud/Upclapi#upclapi)) use [Official UpCloudLtd GO API](https://github.com/UpCloudLtd/upcloud-go-api) extensively.
|
||||||
|
|
||||||
|
> [UpClapi](https://rlung.librecloud.online/LibreCloud/Upclapi#upclapi) is used as a tool to provision and manage **UpCloud** ressources for **LibreClouds** [Klouds](https://rlung.librecloud.online/LibreCloud/Klouds#klouds) with [CloudMandala](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala) and [Zteron](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala) as major tools.
|
||||||
## Requirements for build
|
## Requirements for build
|
||||||
|
|
||||||
- Go `1.11+`
|
- Go `1.16+`
|
||||||
- Go Modules
|
- Go Modules defined in [go.mod](https://rlung.librecloud.online/LibreCloud/Upclapi/src/branch/master/go.mod)
|
||||||
|
|
||||||
## Build from source
|
## Build from source
|
||||||
|
|
||||||
- Clone this repository and go to folder:
|
- Clone this repository and go to folder:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/JesusPerez/upclapi.git
|
git clone https://rlung.librecloud.online/LibreCloud/Upclapi.git
|
||||||
cd upclapi
|
cd Upclapi
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build:
|
- Build:
|
||||||
@ -65,6 +73,12 @@ export UPCLOUD_USERNAME="api-username"
|
|||||||
export UPCLOUD_PASSWORD="api-password"
|
export UPCLOUD_PASSWORD="api-password"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
As an alternative this can be set as in an enviroment file with paths:
|
||||||
|
/etc/upcloud/.env or /usr/local/etc/upcloud/.env
|
||||||
|
|
||||||
|
Another alternative is to use default [UpCloud CLI - upctl](https://github.com/UpCloudLtd/upcloud-cli#quick-start) config set path:
|
||||||
|
$HOME/.config/upctl.yaml
|
||||||
|
|
||||||
If creadentials are not found, this message will be displayed:
|
If creadentials are not found, this message will be displayed:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
@ -73,7 +87,7 @@ or
|
|||||||
Auth info: Password must be specified
|
Auth info: Password must be specified
|
||||||
```
|
```
|
||||||
|
|
||||||
As an option it is possible to encrypt sensitive informations like:
|
As a more secure option it is possible to encrypt sensitive informations like:
|
||||||
|
|
||||||
- Credentials (username/password)
|
- Credentials (username/password)
|
||||||
- Data config file in yaml
|
- Data config file in yaml
|
||||||
@ -86,12 +100,13 @@ go run ./... --help
|
|||||||
```
|
```
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
|
Usage of upclapi:
|
||||||
-c string
|
-c string
|
||||||
command to run [
|
command to run [
|
||||||
createserver, infoserver, restartserver, startserver, stopserver, deleteserver,
|
createserver, infoserver, restartserver, startserver, stopserver, modifyserver, deleteserver,
|
||||||
infofloatip, movefloatip, modifyip,
|
infofloatip, movefloatip, modifyip,
|
||||||
infotags, addtags, deletetags
|
infotags, addtags, deletetags (use -t keep to keep storages)
|
||||||
deletestorage, modifystorage,
|
liststorages, fixstorage (-t size | part0 | part1 | final), deletestorage, modifystorage, createstorageimage (-t title),
|
||||||
inventory, pubhosts, prvhosts
|
inventory, pubhosts, prvhosts
|
||||||
runssh, runcmd
|
runssh, runcmd
|
||||||
] (default "infoserver")
|
] (default "infoserver")
|
||||||
@ -100,11 +115,13 @@ go run ./... --help
|
|||||||
-f string
|
-f string
|
||||||
path to data file (default "datacfg.yaml")
|
path to data file (default "datacfg.yaml")
|
||||||
-id string
|
-id string
|
||||||
server uuid
|
resource name or uuid
|
||||||
-kdr string
|
-kdr string
|
||||||
use coder
|
use coder
|
||||||
-o string
|
-o string
|
||||||
output format
|
output format (json|yaml)
|
||||||
|
-t string
|
||||||
|
target item for command
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create Server
|
- Create Server
|
||||||
@ -167,6 +184,101 @@ make show_coverage
|
|||||||
## YAML Config Example
|
## YAML Config Example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
# Controller to manage and monitor
|
||||||
|
cntrllrs:
|
||||||
|
- cldPath: relative-path-for-controller
|
||||||
|
host: hostname
|
||||||
|
masterPath: ''
|
||||||
|
sshaccess:
|
||||||
|
host: hostname
|
||||||
|
keyPath: ''
|
||||||
|
password: ''
|
||||||
|
port: 22
|
||||||
|
user: ssh-user
|
||||||
|
utype: key
|
||||||
|
domainName: domain-name
|
||||||
|
floatIP: ''
|
||||||
|
group: group-name
|
||||||
|
group_path: relative-group-path
|
||||||
|
hostPrefix: hostprefix-
|
||||||
|
mainName: main-name
|
||||||
|
# UpCloud as provider
|
||||||
|
provider: upcloud
|
||||||
|
resolvDNS: ''
|
||||||
|
servers:
|
||||||
|
# Apps to install
|
||||||
|
- apps:
|
||||||
|
- critical: no
|
||||||
|
liveness: ''
|
||||||
|
name: none
|
||||||
|
path: ''
|
||||||
|
req: ''
|
||||||
|
target: ''
|
||||||
|
arch: linux_amd64
|
||||||
|
backup:
|
||||||
|
- ''
|
||||||
|
clients:
|
||||||
|
- ''
|
||||||
|
cluster:
|
||||||
|
role: role-tag
|
||||||
|
hostname: hostname
|
||||||
|
loginUser:
|
||||||
|
sshKeys:
|
||||||
|
- ''
|
||||||
|
metadata: 1
|
||||||
|
networks:
|
||||||
|
- access: utility
|
||||||
|
family: IPv4
|
||||||
|
source_ip_filtering: yes
|
||||||
|
- access: public
|
||||||
|
family: IPv4
|
||||||
|
source_ip_filtering: yes
|
||||||
|
# If use SDN
|
||||||
|
- access: private
|
||||||
|
family: IPv4
|
||||||
|
ipaddress: 'ip-for-sdn'
|
||||||
|
network: "sdn-uuid"
|
||||||
|
source_ip_filtering: no
|
||||||
|
# UpCloud server plan
|
||||||
|
plan: "1xCPU-1GB"
|
||||||
|
rules:
|
||||||
|
- ''
|
||||||
|
sshAccess:
|
||||||
|
host: hostname
|
||||||
|
keyPath: ''
|
||||||
|
password: ''
|
||||||
|
port: 22
|
||||||
|
user: "ssh-user"
|
||||||
|
utype: key
|
||||||
|
storages:
|
||||||
|
- action: clone
|
||||||
|
size: 20
|
||||||
|
# this can be used to create partitions
|
||||||
|
finalSize: 20
|
||||||
|
makefs: ""
|
||||||
|
partSizes: ''
|
||||||
|
source: source-name
|
||||||
|
storage: UUID-for-source-image
|
||||||
|
tier: maxiops
|
||||||
|
title: Title-for-this-storage
|
||||||
|
tags:
|
||||||
|
- cd
|
||||||
|
- ci
|
||||||
|
timeZone: UTC
|
||||||
|
title: titls-of-this-host
|
||||||
|
# Tasks & Services to install,maintain,monitor, etc.
|
||||||
|
tsksrvcs:
|
||||||
|
- critical: no
|
||||||
|
liveness: ''
|
||||||
|
name: sysconfig
|
||||||
|
path: ''
|
||||||
|
req: ''
|
||||||
|
target: ''
|
||||||
|
useFloatIP: false
|
||||||
|
userData: ''
|
||||||
|
# UpCloud Zone
|
||||||
|
zone: es-mad1
|
||||||
|
|
||||||
floatIP: float-ip-for-servers
|
floatIP: float-ip-for-servers
|
||||||
# "hostname" should start with hostPrefix or comment/remove this setting
|
# "hostname" should start with hostPrefix or comment/remove this setting
|
||||||
hostPrefix: prefix-for-severs
|
hostPrefix: prefix-for-severs
|
||||||
@ -193,7 +305,6 @@ servers:
|
|||||||
loginUser:
|
loginUser:
|
||||||
sshKeys: # ssh-rsa public keys to add
|
sshKeys: # ssh-rsa public keys to add
|
||||||
- ssh-rsa ....
|
- ssh-rsa ....
|
||||||
|
|
||||||
plan: "1xCPU-1GB" # UpCloud Plan if is using an UpCloud "Simple Plan"
|
plan: "1xCPU-1GB" # UpCloud Plan if is using an UpCloud "Simple Plan"
|
||||||
metaData: 1
|
metaData: 1
|
||||||
timeZone: "UTC"
|
timeZone: "UTC"
|
||||||
@ -203,8 +314,8 @@ servers:
|
|||||||
# List of Storage Devices, at least one
|
# List of Storage Devices, at least one
|
||||||
storageDevices:
|
storageDevices:
|
||||||
- action: clone # UpCloud Storage Action
|
- action: clone # UpCloud Storage Action
|
||||||
title: "Ubuntu Server 20.04 LTS (Focal Fossa)"
|
title: "storage-title"
|
||||||
storage: "01000000-0000-4000-8000-000030200200" # UpCloud Storage UUID
|
storage: "UpCloud Storage UUID"
|
||||||
size: 25 # Volume Size in GB
|
size: 25 # Volume Size in GB
|
||||||
tier: maxiops
|
tier: maxiops
|
||||||
# If this sever can use floatIP set to 1
|
# If this sever can use floatIP set to 1
|
||||||
@ -215,7 +326,7 @@ servers:
|
|||||||
family: IPv4
|
family: IPv4
|
||||||
- access: public # only if is need it
|
- access: public # only if is need it
|
||||||
family: IPv4
|
family: IPv4
|
||||||
- access: private # if is going to use SDN
|
- access: private # if is going to use SDN or remove
|
||||||
family: IPv4
|
family: IPv4
|
||||||
network: UUID-SDN-NETWORK
|
network: UUID-SDN-NETWORK
|
||||||
ipaddress: SDN-ip-address-or-use-SDN-DHCP
|
ipaddress: SDN-ip-address-or-use-SDN-DHCP
|
||||||
|
Loading…
Reference in New Issue
Block a user