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.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-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: surf_controller-0.4.2.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.tar.gz
Algorithm Hash digest
SHA256 0c2bef2c3ac2945151184dbe619ab4fdef5fbfc004c4ad4738d8892701b2e4ec
MD5 b62607facec13e30e0e75b611dc219ef
BLAKE2b-256 b5a49d831e4d5ad7a19dc1b53b24a7b3f25c51b58b115b206b3c7cb2698024bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for surf_controller-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6852068887612abe58ef48fd3d9a36386a5e55d0629f01cd1260318d05bea482
MD5 f3d049896dc918482f0a974260781415
BLAKE2b-256 1626d36312e556c08b82e47901e7b4c65dff7b65776dc452862b848e5430bb50

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