An open API service indexing awesome lists of open source software.

https://github.com/davidroman0o/tpi

Go implementation of the Turing Pi CLI for controlling and managing Turing Pi boards.
https://github.com/davidroman0o/tpi

arm-cluster bmc-api cli-tool cluster-management compute-modules golang homelab turing-pi turing-pi2 turingpi

Last synced: 5 months ago
JSON representation

Go implementation of the Turing Pi CLI for controlling and managing Turing Pi boards.

Awesome Lists containing this project

README

          

# Turing Pi Control Tools

This repository contains tools for controlling Turing Pi boards, split into two components:

## Components

### 1. [Client Library](/client)

A Go library for programmatically controlling Turing Pi boards via their BMC API.

```bash
go get github.com/davidroman0O/tpi
```

[Learn more about the client library →](/client)

### 2. [CLI Tool](/cli)

A command-line interface for controlling Turing Pi boards.

```bash
# Install pre-built binary (see releases)
# or build from source:
cd cli && go build
```

[Learn more about the CLI tool →](/cli)

## Repository Structure

```
tpi/
├── client/ # Client library (minimal dependencies)
│ ├── *.go # Core functionality files
│ └── testdata/ # Test data
├── cli/ # Command-line interface
│ ├── commands/ # CLI command implementations
│ └── main.go # CLI entry point
└── .github/ # GitHub workflows and config
```

## Quick Start

### Using the CLI

```bash
# Power on node 1
./cli/tpi power on 1 --host=192.168.1.91

# Get power status
./cli/tpi power status --host=192.168.1.91
```

### Using the Client Library

```go
package main

import (
"fmt"
"os"

"github.com/davidroman0O/tpi/client"
)

func main() {
// Create a client
c, err := client.NewClient(
client.WithHost("192.168.1.91"),
client.WithCredentials("root", "turing"),
)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

// Power on node 1
if err := c.PowerOn(1); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

fmt.Println("Node 1 powered on!")
}
```

### Using the Agent Client

```go
package main

import (
"fmt"
"os"

"github.com/davidroman0O/tpi/client/agent"
)

func main() {
// Create an agent client to connect to a remote agent server
c, err := agent.NewAgentClient(
agent.WithAgentHost("192.168.1.91"),
agent.WithAgentPort(9977),
agent.WithAgentSecret("mysecret"),
)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

// Power on node 1 remotely
if err := c.PowerOn(1); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

fmt.Println("Node 1 powered on remotely!")
}
```

## Agent Mode

The library and CLI now support an Agent Mode that allows you to control a Turing Pi board remotely without direct access to the BMC. This works by running an agent server on a machine with direct access to the Turing Pi board, and connecting to it from a remote machine.

[Learn more about Agent Mode →](/cli/AGENT.md)

## License

Apache License 2.0