cslcmgr
CodeSpace LifeCycle Manager: a Web API server (with optional Web UI frontend) that can be used to start and stop GitHub Codespaces.
This is meant to be run locally on your PC, or behind a reverse proxy with authentication.
Usage
Important: this has been tested with Python 3.11.2 on Debian 12 (bookworm).
First of all you need to generate one or more GitHub PATs (Personal Access Tokens) to be able to control your Codespaces using the GitHub API. The tokens must have the following permissions:
- "Codespaces" repository permissions (read)
- "Codespaces lifecycle admin" repository permissions (write)
Note: for more information on why these permissions are needed, see https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28
Set up a Python venv (virtual environment) and install some packages inside it:
Then set the necessary configuration environment variables. Example:
Bash | |
---|---|
Note: for more details about the supported environment variables, see the
get_config
function in the code.
Then you can run the app either in a development or production configuration.
Development:
Bash | |
---|---|
Production:
Bash | |
---|---|
Note: for more information about running a Flask application with Gunicorn, see https://flask.palletsprojects.com/en/3.0.x/deploying/gunicorn/