Skip to main content

CLI interface to control SURF VMs

Project description

🏄‍♂️ Surf Controller

🌊 Overview

Surf Controller is a powerful CLI tool for managing your cloud workspaces with ease! It provides a user-friendly interface to monitor, pause, and resume your virtual machines (VMs) effortlessly.

🚀 Features

  • 📊 Interactive CLI interface
  • 🔄 Real-time VM status updates
  • ⏸️ Pause and ▶️ resume VMs with a single keystroke
  • 📋 Multi-select functionality for batch operations
  • 📜 Live log viewing

🛠️ Installation

config dir

By default, your ~/.surf_controller/ dir will be used for data. You can modify this by specifying SURF_CONTROLLER_CONFIG_DIR in your env, eg

export SURF_CONTROLLER_CONFIG_DIR=/srv/shared/

install as tool

Use uv to install surf-controller globally or add it to your local environment. Of course, you can also use pip to install it. Here are three different commands you could use, the first one (uv tools) is recommended to install it globally.

uv tools install surf-controller
uv add surf-controller
pip install surf-controller

These commands all installs the surfcontroller command.

🔑 First-time Setup of tokens

You can find the SURF API documentation here: API Documentation

On your profile you can create your own API token.

You can obtain the CSRF tokens by authorizing directly with the Surf API. Use the green lock icon in the top right corner to authorize with your API-token and obtain the CSRF token by executing a request.

Copy both tokens and use them during configuration.

Run the configuration by starting the controller:

surfcontroller

On first run, Surf Controller will:

  1. 📁 Create a configuration directory in your SURF_CONTROLLER_CONFIG_DIR folder (defaults to ~)
  2. 📄 Copy a default configuration file into your configdir
  3. 🔒 Prompt you for API and CSRF tokens and stores them in your configdir

🎮 Usage

Run the controller:

surfcontroller

🕹️ Controls

navigate / select

  • j: Move cursor down
  • k: Move cursor up
  • Enter: Select/deselect VM
  • a: toggle Select all VMs
  • 'f': toggle Filter VMs (by username)
  • 'n': rename username
  • 'l': toggle view logs

Actions

  • p: Pause selected VMs
  • r: Resume selected VMs
  • e: add VM to exclusion list
  • 'u': Update VM list
  • 's': ssh into selected VM (select just one VM)

Note that adding to the exclusion list only adds the id of the vm to exclusions.json. The actual shutting down of the VM is done from a VM we control on the Surf cloud, so toggling this on your computer doesnt impact the actual pausing at 21:00.

📝 Configuration

Edit ~/.surf_controller/config.toml to customize your settings.

🤝 Contributing

Contributions are welcome!

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

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

surf_controller-0.4.2.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

surf_controller-0.4.2.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file surf_controller-0.4.2.1.tar.gz.

File metadata

  • Download URL: surf_controller-0.4.2.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for surf_controller-0.4.2.1.tar.gz
Algorithm Hash digest
SHA256 ea4518e41968140837f2da61d3bef48b94814245ff52cb5cd9bf1b6ac1ddf849
MD5 0ce6502aed7e3bd3e60d691948886dd8
BLAKE2b-256 b317c2267fec219a552529fec83465de37654d6f31192212313b202905f1c09a

See more details on using hashes here.

File details

Details for the file surf_controller-0.4.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for surf_controller-0.4.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2760dad2d8667396287ce1b38681448c4604a242158c25f8e926afd6be95a89
MD5 d1cfa07c890addf025738ae326e52ce6
BLAKE2b-256 c30a9e7b748c1c407f265684e17c004bf109501f50db84407b38cd6736f4a11f

See more details on using hashes here.

Supported by

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