Skip to content

ElefantOne/simplepod-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimplePod Client

Minimal PSR-compliant PHP 8.3 CLI project for managing SimplePod Docker instances through the SimplePod REST API.

Features

  • List your SimplePod instances.
  • List rentable market offers.
  • List your private templates.
  • Create Docker instances from a JSON payload or CLI flags.
  • Delete instances by ID.
  • No framework dependency required to run the CLI.

Requirements

  • PHP 8.3
  • ext-curl
  • ext-json
  • A SimplePod API key in SIMPLEPOD_API_KEY

This client is aligned to the SimplePod REST endpoints used in the provided API spec:

  • GET /instances/list
  • GET /instances/market/list
  • GET /instances/templates/list
  • POST /instances
  • DELETE /instances/{id}

Project layout

bin/                    CLI entrypoint
examples/               Example API payloads
src/                    PSR-4 application code
autoload.php            Fallback autoloader for local execution without Composer install
composer.json           Package metadata and PHP 8.3 requirement
phpcs.xml.dist          PSR-12 coding standard config

Setup

export SIMPLEPOD_API_KEY=your-api-key
chmod +x bin/simplepod-client

If you are using Composer with PHP 8.3 or newer:

composer install

Usage

Show help:

bin/simplepod-client help

List your instances:

bin/simplepod-client instances:list
bin/simplepod-client instances:list --search=trainer
bin/simplepod-client instances:list --json

List rentable Docker offers:

bin/simplepod-client market:list
bin/simplepod-client market:list --gpu-model="RTX 4090" --gpu-count=1 --price-per-gpu-max=1
bin/simplepod-client market:list --mode=vm --region="Europe"

List your private templates:

bin/simplepod-client templates:list
bin/simplepod-client templates:list --search=ubuntu

Create an instance from the included payload:

bin/simplepod-client instances:create --payload=examples/create-instance.json

Create an instance directly from CLI flags:

bin/simplepod-client instances:create \
  --market-id=1 \
  --template-id=38 \
  --gpu-count=1 \
  --start-script='echo ready' \
  --env=JUPYTER_TOKEN=replace-me

Delete an instance:

bin/simplepod-client instances:delete --id=<instance-id>

Notes

  • examples/create-instance.json matches the SimplePod POST /instances request shape for Docker instances.
  • Authentication uses the X-AUTH-TOKEN header expected by SimplePod.
  • templates:list reads your private templates because instances:create expects an instanceTemplate IRI such as /instances/templates/38.

License

MIT. See LICENSE.

About

A simple PHP client for SimplePod service with minimal functionality

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages