Cloudhub is a CLI tool for monitoring and managing Docker containers in your homelab. It provides features such as listing containers, starting and stopping containers, restarting containers, and managing stacks.
The project is structured into the following packages:
cmd: contains the main entry point of the applicationinternal/cli: contains the CLI commands and their implementationsinternal/compose: contains the stack management functionalityinternal/config: contains the configuration management functionalityinternal/daemon: contains the daemon functionalityinternal/docker: contains the Docker client functionalityinternal/notify: contains the notification functionality
The main flow of the application is as follows:
- The user runs the
cloudhubcommand with a specific subcommand (e.g.ls,start,stop, etc.) - The
cmd/main.gofile executes the corresponding CLI command - The CLI command interacts with the Docker client to perform the desired action
- The Docker client communicates with the Docker daemon to perform the action
- The result of the action is returned to the user
The following features are implemented:
- Listing containers:
cloudhub ls - Starting a container:
cloudhub start <container> - Stopping a container:
cloudhub stop <container> - Restarting a container:
cloudhub restart <container> - Managing stacks:
cloudhub stack <command> - Daemon management:
cloudhub daemon <command> - Notification support:
cloudhub daemon runwith notification flags
To install Cloudhub, you can use the following command:
curl -sSL https://raw.githubusercontent.com/sansoune/cloudhub/main/scripts/install.sh | bashAlternatively, you can build from source by running the following commands:
git clone https://github.com/sansoune/cloudhub.git
cd cloudhub
go build -o cloudhub cmd/main.go
sudo mv cloudhub /usr/local/bin/cloudhubThe configuration file is located at ~/.config/cloudhub/config.yaml. You can edit this file to configure the stack path, daemon interval, and notification settings.
The following flags are available:
--interval: sets the daemon interval--ntfy-server: sets the ntfy server URL--ntfy-topic: sets the ntfy topic name
To contribute to the project, you can follow these steps:
- Fork the repository
- Clone the repository to your local machine
- Make changes to the code
- Run
go buildto build the application - Run
go testto run the tests - Submit a pull request with your changes
Cloudhub is licensed under the MIT license.