kl

command module
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 3 Imported by: 0

README

Kloudlite CLI kl & kli

kl and kli are the cli for kloudlite. where kl is the cli for the developers to work with environments and kli is the cli for the infrastructure team to work with kloudlite.

Installation

To install the latest version in Linux or Mac you can run the following command on terminal.

Installation of kl
Install latest with curl
curl https://kl.kloudlite.io/kloudlite/kl! | bash
Install latest with wget
wget -qO- https://kl.kloudlite.io/kloudlite/kl! | bash
Install specific version
curl https://kl.kloudlite.io/kloudlite/kl@v1.0.0! | bash
download but don't install
curl https://kl.kloudlite.io/kloudlite/kl | bash
Installation of kli
Install latest with curl
curl 'https://kl.kloudlite.io/kloudlite/kl!?source=kli' | bash
Install latest with wget
wget -qO- 'https://kl.kloudlite.io/kloudlite/kl!?source=kli' | bash
Install specific version
curl 'https://kl.kloudlite.io/kloudlite/kl@v1.0.0!?source=kli' | bash
download but don't install
curl 'https://kl.kloudlite.io/kloudlite/kl?source=kli' | bash
Authentication

To login and logout you can use the following commands.

kl auth login
kl auth logout
kl auth status
Select Account

To select account you can use the following command.

kl switch account
Initialize your workspace

To work with any project you need to initialize your workspace where you can define environments, managed resouces, mounts and etc. To initialize you workspace you can use the following command.

kl init
Listing Resources

With this CLI you can list accounts, projects, envs, devices, configs, secrets and apps. To list resources you can use the following commands. For more details visit kl list

kl list accounts
kl list projects
kl list envs
kl list devices
kl list configs
kl list secrets
kl list apps

with these commands you can provide the resource id. In case of you don't provide resource it it will show you a picker. For more details visit kl list

Working with vpn

To access services of cluster and tunnel your local app to the server you need to connect to vpn. For that you can use the following commands.

sudo kl vpn start
sudo kl vpn stop
sudo kl vpn status

# to tunnel traffic to your local you need to expose ports also
kl wg expose -p <server_port>:<local_port>
kl wg expose -p <server_port>:<local_port> -d    # provide -d flag to delete
Working with environments

We support multiple environments to work with. these commands will help you to import config,secrets as environment variables, mount and also ipmprting managed resources.

For more details visit kl add.

# Adding
kl add config
kl add secret
kl add mres
kl add mount <file_path/file_name>
Intercepting App

You can tunnel you local running app to the server and intercept your app to forward all the request of that app to your local system. for that you need to perform following actions.

So you can use following commands to work with interception. For more details visit kl vpn intecept start and kl vpn intecept stop

kl vpn intercept start
kl vpn intercept stop
KL Config File structure

This is the structure of app config file which will be generated by executing the command kl -- <cmd> and you can also modify this file according to your requirement.

version: v1
name: <project_name>
mres: 
- name: service/<mres_name>
  env:
  - name: <env_name>
    key: <local_key>
    refkey: <server_key>
configs:
- name: <config_name>
  env:
  - key: <local_key>
    refkey: <server_key>
secrets:
- name: <secret_name>
  env:
  - key: <local_key> 
    refkey: <server_key> 
env:
- key: <env_key>    # eg. NODE_ENV
  value: <env_value>    # eg. development
fileMount:
  mountBasePath: <base_mount_path> # eg. ./.mounts
  mounts:
  - path: <mount_path> # eg. /tmp
    type: <type> # eg. config or secret
    name: <config_name>

Getting All environments

According to above config file you can get all the environments to your local shell. you can use the following commands for getting all environments to working shell.

kl -- <cmd>  # will execute the command with all the environments eg. kl -- npm start
kl -- <shell>  # will open the shell with all the environments eg. kl -- bash

kl -- printenv # will print all the environments

Working with kli

kli is the cli for the infrastructure team to work with kloudlite. visit kli for more details.

This CLI is under development so, more information will will be updated in this doc. also if some new commands will be added to the CLI will be updated to this doc.

for more details visit docs

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL