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

Uploaded Python 3

File details

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

File metadata

  • Download URL: surf_controller-0.4.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.1.tar.gz
Algorithm Hash digest
SHA256 719e49ec0a7c1b21517eb97fd96c9d509e711f515c2a5f5776f9052286972fc2
MD5 03b3023e9b004d87fa4df42f4913bb85
BLAKE2b-256 23ec9a735a597933e7e6ee56efadbafb0c274dd7e4c6d2b1dea32e75a71f37c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for surf_controller-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ff54a2d40b21320d3ebc6744449a151793e1bee852a816ff6cc26462c54c687
MD5 f74a0a890b9b68ef1336d61c59cbb12c
BLAKE2b-256 9b42e0f385ce3f13a413f4d667427c7bedfaaa28a571f8f7771be092d294cb62

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