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

Uploaded Python 3

File details

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

File metadata

  • Download URL: surf_controller-0.4.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.tar.gz
Algorithm Hash digest
SHA256 af8e630f1250f66fba7d6f32b1933f86296cf5259716fb4693e11f85d2b32951
MD5 274e99d53217fc3c3b545c25c0265e1e
BLAKE2b-256 37baf09c71768a9657a1aaf094958275917287dbd6a7d02745d035011c338f0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for surf_controller-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 285fd007cbe36aaecb832d613394eefa6119df0d370914f0433e15ccefd363ff
MD5 b032f4fd2ddcb9a2db379ab0c1a37202
BLAKE2b-256 cd9061f1ee223795e7fd3fbb93824919d194c8f7982ec22f7241869d081741a8

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