Skip to main content

Oasees SDK

Project description

Oasees SDK

The OASEES SDK is a Python package that consists of two modules: the Command Line Interface (CLI) module and the Python Environment module.


CLI

The CLI module's purpose is to handle the Kubernetes aspect of the OASEES framework. It provides the user with a few simple commands to quickly provision and configure a Kubernetes cluster, as well as automate and facilitate its nodes' connection to the OASEES blockchain

Installation

Like any other user Python package published on the PyPi repository, the user can install the OASEES SDK using pip.

  1. Ensure that pip is present on your machine. If not, install it:

    sudo apt install python3-pip
    
  2. Install with pip:

    pip install oasees_sdk
    
  3. Set up the CLI module for use by adding its installation folder to your system's PATH (example for Ubuntu):

    export PATH="/home/{USERNAME}/.local/bin:$PATH"
    

    And make sure that its running properly by executing:

    oasees-sdk
    

    Which will also provide you with the CLI's available commands and a very short description for each one.


    NOTE: An extended description for each of the CLI's commands can be provided by executing:

    oasees-sdk [COMMAND] --help
    

Usage

Important: Before starting to use the CLI module, ensure that an instance of the OASEES stack is up and running.

The SDK is designed to work in parallel with the rest of the stack and before provisioning a cluster, the user will be prompted to enter the stack's IP address and their blockchain account information (if you're using a test account, make sure it's the same one that you've imported on MetaMask).

Should any typing mistake happen during the input prompts, you can edit the configuration file located in /home/{username}/.oasees_sdk/config.json, or use oasees-sdk config-full-reset to completely reset the configuration and force the prompts to reappear.


The CLI's typical flow of usage can be described with the following steps:

  1. Install the OASEES SDK on all the machines that will participate in the cluster (both the master node and the worker nodes) using the installation commands mentioned above.


  2. Provision a K3S Cluster on the machine that represents the cluster's master node:

    oasees-sdk init-cluster
    

    The cluster should be visible on your Portal's home page almost immediately.


  3. Retrieve your cluster's token:

    oasees-sdk get-token
    

  4. Execute the join-cluster command on each of your worker devices to join them with your cluster, providing the master's IP address and the retrieved token.

    oasees-sdk join-cluster --ip {K3S_MASTER_IP_ADDRESS} --token {K3S_MASTER_TOKEN}
    

  5. Execute the register-new-nodes command on your master node to create blockchain accounts for each of your unregistered worker devices, register them to the blockchain and associate them with your cluster.

    oasees-sdk register-new-nodes
    

    NOTE: This command detects and handles only the nodes that aren't already registered on the blockchain, so you can use it multiple times as you scale your K3S Cluster with new devices / nodes.


  6. If you intend to associate your cluster with a blockchain DAO, execute the apply-dao-logic command, providing the IPFS hash of your uploaded DAO contracts.

    oasees-sdk apply-dao-logic {DAO_CONTRACTS_IPFS_HASH}
    

    After the DAO logic is applied, devices that are already registered on the blockchain, as well as devices that get registered at a later point, will automatically be able to perform DAO actions such as creating proposals and voting.


  7. Launching a Jupyter Notebook or a Python shell (**both of which can be found) :

    from oasees_sdk import oasees_sdk
    

    The CLI module's purpose is to handle the Kubernetes aspect of the OASEES framework. It provides the user with a few simple commands to quickly provision and configure a Kubernetes cluster, as well as connect it to the OASEES blockchain

    The SDK is embedded into the Jupyter Notebook image which is built upon the creation of the Oasees Stack. This means that no installation of the SDK and its requirements is needed from the user's side. It only needs to be imported either into a Jupyter Notebook or Python Console by running:

    import oasees_sdk
    

    Or in the stack's Jupyter Terminal (all three options are found in the portal's Notebook tab), where you first need to launch the python shell by running:

    python3
    

    And then import the oasees_sdk.


    Usage / Instructions (outdated)

    As soon as the SDK gets successfully imported into the chosen python environment, the following brief documentation about its functions and their usage is printed:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oasees_sdk-0.4.3.tar.gz (53.4 kB view hashes)

Uploaded Source

Built Distribution

oasees_sdk-0.4.3-py2.py3-none-any.whl (30.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page