From fae3a80b54fe832cc44ab5c6fc883d07d67c43b8 Mon Sep 17 00:00:00 2001 From: mahesh bhatiya Date: Wed, 2 Jul 2025 01:03:12 +0530 Subject: [PATCH] release(v1.0.0): initial stable release of StackRoost CLI --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++------- cmd/root.go | 48 +++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c6b8c3f..35f0e78 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,77 @@ -# StackRoost CLI 🐧 +# StackRoost CLI -A simple and powerful terminal-based tool to manage Linux web servers. Built in Go, it supports popular stacks like **Apache**, **Nginx**, and **Caddy**, with domain and user management features. +StackRoost is a powerful command-line tool to manage Linux servers with ease. It supports domain configuration, user management, SSL setup, logs, monitoring, and more. ---- +## Version + +v1.0.0 ## Features -- Manage Apache, Nginx, and Caddy services -- Add, remove, and update virtual hosts/domains -- Manage Linux users for deployments -- Backup and restore configurations -- SSL configuration helpers -- Interactive CLI prompts -- Easy setup with clean terminal UI +### Domain Management +- `create-domain` – Create a new domain config with Apache/Nginx/Caddy. +- `backup-domain` – Backup public_html and MySQL DB. +- `clone-domain` – Clone full domain configuration and data. +- `list-domains` – List all active domains and statuses. +- `monitor` – Interactive TUI to monitor all domains. +- `remove-domain` – Remove domain, user, database, and config. +- `restore-domain` – Restore from domain backup archive. +- `status-domain` – Inspect domain config, SSL, and user. +- `toggle-site` – Enable or disable a site's config. +- `update-domain-port` – Update the domain port and reload the web server. + +### Email +- `test-email` – Check if the server can send mail (mail/sendmail/msmtp). + +### Firewall +- `enable-firewall` – Enable UFW and allow common/custom ports. +- `disable-firewall` – Safely disable UFW. + +### Logs +- `analyze-log-traffic` – Analyze access log traffic (IP, URL, requests). +- `logs-domain` – View domain logs (access and error). +- `purge-domain-logs` – Delete domain logs safely. + +### Security +- `run-security-check` – Run a server hardening security check. +- `secure-server` – Enable UFW, SSH restrictions, and config hardening. + +### Server Tools +- `check-port` – Check if a domain's port is open. +- `server-health` – View CPU, RAM, disk usage, uptime, web server status. +- `inspect-config` – View web server config file. +- `restart-server` – Restart Apache/Nginx/Caddy. +- `schedule-restart` – Schedule a restart after delay. +- `sync-time` – Sync time using systemd-timesyncd. + +### SSL Certificates +- `enable` – Enable Let's Encrypt SSL for a domain. +- `disable` – Remove SSL config and certs. +- `renew` – Renew SSL certificates. +- `expiry` – Check SSL expiry date. +- `test` – Test domain SSL cert status. + +### User Management +- `list-users` – List shell users (UID ≥ 1000). +- `delete-user` – Delete a system user and their home directory. + +## Install + +Clone and build manually: +```bash +git clone https://github.com/stackroost/stackroost-cli.git +cd stackroost-cli +go build -o stackroost main.go +``` + +## Usage + +```bash +./stackroost --help +./stackroost create-domain --name example.com --server nginx --shelluser --pass mypass --useridr --ssl +./stackroost monitor +``` + +## License ---- +MIT License \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 4395d11..f1d38b5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -22,6 +22,7 @@ import ( var rootCmd = &cobra.Command{ Use: "stackroost", Short: "StackRoost CLI - manage your Linux servers with ease", + Version: "v1.0.0", Run: func(cmd *cobra.Command, args []string) { printWelcome() }, @@ -32,6 +33,10 @@ var createDomainCmd = &cobra.Command{ Short: "Create a web server configuration for a domain", Run: func(cmd *cobra.Command, args []string) { logger.Info("Starting create-domain command execution") + if len(args) > 0 && (args[0] == "--help" || args[0] == "-h" || args[0] == "help") { + customHelpFunc(cmd, args) + return + } domain, _ := cmd.Flags().GetString("name") port, _ := cmd.Flags().GetString("port") @@ -377,4 +382,47 @@ func registerUserCmds() { user.GetListCmd(), user.GetDeleteCmd(), ) +} + +func customHelpFunc(cmd *cobra.Command, args []string) { + fmt.Println("\nStackRoost CLI - manage your Linux servers with ease\n") + fmt.Println("Usage:\n stackroost [command]\n") + fmt.Println("Available Commands:") + + group := map[string][]*cobra.Command{} + + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() { + continue + } + switch { + case strings.Contains(c.Use, "domain") || c.Use == "create-domain" || c.Use == "monitor": + group["🔧 Domain Management"] = append(group["🔧 Domain Management"], c) + case strings.Contains(c.Use, "email") || c.Use == "test-email": + group["📧 Email Utilities"] = append(group["📧 Email Utilities"], c) + case strings.Contains(c.Use, "firewall"): + group["🛡 Firewall Control"] = append(group["🛡 Firewall Control"], c) + case strings.Contains(c.Use, "log"): + group["📜 Log Management"] = append(group["📜 Log Management"], c) + case strings.Contains(c.Use, "secure") || strings.Contains(c.Use, "security"): + group["🧰 Security"] = append(group["🧰 Security"], c) + case strings.Contains(c.Use, "server") || strings.Contains(c.Use, "inspect") || strings.Contains(c.Use, "check-port"): + group["🖥 Server Management"] = append(group["🖥 Server Management"], c) + case c.Use == "enable" || c.Use == "disable" || c.Use == "renew" || c.Use == "expiry" || c.Use == "test": + group["🔐 SSL Certificates"] = append(group["🔐 SSL Certificates"], c) + case strings.Contains(c.Use, "user"): + group["👤 User Management"] = append(group["👤 User Management"], c) + default: + group["Other Commands"] = append(group["Other Commands"], c) + } + } + + for title, commands := range group { + fmt.Printf("\n%s\n", title) + for _, c := range commands { + fmt.Printf(" %-22s %s\n", c.Use, c.Short) + } + } + + fmt.Println("\nUse \"stackroost [command] --help\" for more information about a command.\n") } \ No newline at end of file