Skip to content

Commit 7f1aadb

Browse files
Merge pull request #38 from stackroost/dev
release(v1.0.0): initial stable release of StackRoost CLI
2 parents 0772d02 + fae3a80 commit 7f1aadb

File tree

2 files changed

+119
-11
lines changed

2 files changed

+119
-11
lines changed

README.md

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,77 @@
1-
# StackRoost CLI 🐧
1+
# StackRoost CLI
22

3-
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.
3+
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.
44

5-
---
5+
## Version
6+
7+
v1.0.0
68

79
## Features
810

9-
- Manage Apache, Nginx, and Caddy services
10-
- Add, remove, and update virtual hosts/domains
11-
- Manage Linux users for deployments
12-
- Backup and restore configurations
13-
- SSL configuration helpers
14-
- Interactive CLI prompts
15-
- Easy setup with clean terminal UI
11+
### Domain Management
12+
- `create-domain` – Create a new domain config with Apache/Nginx/Caddy.
13+
- `backup-domain` – Backup public_html and MySQL DB.
14+
- `clone-domain` – Clone full domain configuration and data.
15+
- `list-domains` – List all active domains and statuses.
16+
- `monitor` – Interactive TUI to monitor all domains.
17+
- `remove-domain` – Remove domain, user, database, and config.
18+
- `restore-domain` – Restore from domain backup archive.
19+
- `status-domain` – Inspect domain config, SSL, and user.
20+
- `toggle-site` – Enable or disable a site's config.
21+
- `update-domain-port` – Update the domain port and reload the web server.
22+
23+
### Email
24+
- `test-email` – Check if the server can send mail (mail/sendmail/msmtp).
25+
26+
### Firewall
27+
- `enable-firewall` – Enable UFW and allow common/custom ports.
28+
- `disable-firewall` – Safely disable UFW.
29+
30+
### Logs
31+
- `analyze-log-traffic` – Analyze access log traffic (IP, URL, requests).
32+
- `logs-domain` – View domain logs (access and error).
33+
- `purge-domain-logs` – Delete domain logs safely.
34+
35+
### Security
36+
- `run-security-check` – Run a server hardening security check.
37+
- `secure-server` – Enable UFW, SSH restrictions, and config hardening.
38+
39+
### Server Tools
40+
- `check-port` – Check if a domain's port is open.
41+
- `server-health` – View CPU, RAM, disk usage, uptime, web server status.
42+
- `inspect-config` – View web server config file.
43+
- `restart-server` – Restart Apache/Nginx/Caddy.
44+
- `schedule-restart` – Schedule a restart after delay.
45+
- `sync-time` – Sync time using systemd-timesyncd.
46+
47+
### SSL Certificates
48+
- `enable` – Enable Let's Encrypt SSL for a domain.
49+
- `disable` – Remove SSL config and certs.
50+
- `renew` – Renew SSL certificates.
51+
- `expiry` – Check SSL expiry date.
52+
- `test` – Test domain SSL cert status.
53+
54+
### User Management
55+
- `list-users` – List shell users (UID ≥ 1000).
56+
- `delete-user` – Delete a system user and their home directory.
57+
58+
## Install
59+
60+
Clone and build manually:
61+
```bash
62+
git clone https://github.com/stackroost/stackroost-cli.git
63+
cd stackroost-cli
64+
go build -o stackroost main.go
65+
```
66+
67+
## Usage
68+
69+
```bash
70+
./stackroost --help
71+
./stackroost create-domain --name example.com --server nginx --shelluser --pass mypass --useridr --ssl
72+
./stackroost monitor
73+
```
74+
75+
## License
1676

17-
---
77+
MIT License

cmd/root.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
var rootCmd = &cobra.Command{
2323
Use: "stackroost",
2424
Short: "StackRoost CLI - manage your Linux servers with ease",
25+
Version: "v1.0.0",
2526
Run: func(cmd *cobra.Command, args []string) {
2627
printWelcome()
2728
},
@@ -32,6 +33,10 @@ var createDomainCmd = &cobra.Command{
3233
Short: "Create a web server configuration for a domain",
3334
Run: func(cmd *cobra.Command, args []string) {
3435
logger.Info("Starting create-domain command execution")
36+
if len(args) > 0 && (args[0] == "--help" || args[0] == "-h" || args[0] == "help") {
37+
customHelpFunc(cmd, args)
38+
return
39+
}
3540

3641
domain, _ := cmd.Flags().GetString("name")
3742
port, _ := cmd.Flags().GetString("port")
@@ -377,4 +382,47 @@ func registerUserCmds() {
377382
user.GetListCmd(),
378383
user.GetDeleteCmd(),
379384
)
385+
}
386+
387+
func customHelpFunc(cmd *cobra.Command, args []string) {
388+
fmt.Println("\nStackRoost CLI - manage your Linux servers with ease\n")
389+
fmt.Println("Usage:\n stackroost [command]\n")
390+
fmt.Println("Available Commands:")
391+
392+
group := map[string][]*cobra.Command{}
393+
394+
for _, c := range cmd.Commands() {
395+
if !c.IsAvailableCommand() {
396+
continue
397+
}
398+
switch {
399+
case strings.Contains(c.Use, "domain") || c.Use == "create-domain" || c.Use == "monitor":
400+
group["🔧 Domain Management"] = append(group["🔧 Domain Management"], c)
401+
case strings.Contains(c.Use, "email") || c.Use == "test-email":
402+
group["📧 Email Utilities"] = append(group["📧 Email Utilities"], c)
403+
case strings.Contains(c.Use, "firewall"):
404+
group["🛡 Firewall Control"] = append(group["🛡 Firewall Control"], c)
405+
case strings.Contains(c.Use, "log"):
406+
group["📜 Log Management"] = append(group["📜 Log Management"], c)
407+
case strings.Contains(c.Use, "secure") || strings.Contains(c.Use, "security"):
408+
group["🧰 Security"] = append(group["🧰 Security"], c)
409+
case strings.Contains(c.Use, "server") || strings.Contains(c.Use, "inspect") || strings.Contains(c.Use, "check-port"):
410+
group["🖥 Server Management"] = append(group["🖥 Server Management"], c)
411+
case c.Use == "enable" || c.Use == "disable" || c.Use == "renew" || c.Use == "expiry" || c.Use == "test":
412+
group["🔐 SSL Certificates"] = append(group["🔐 SSL Certificates"], c)
413+
case strings.Contains(c.Use, "user"):
414+
group["👤 User Management"] = append(group["👤 User Management"], c)
415+
default:
416+
group["Other Commands"] = append(group["Other Commands"], c)
417+
}
418+
}
419+
420+
for title, commands := range group {
421+
fmt.Printf("\n%s\n", title)
422+
for _, c := range commands {
423+
fmt.Printf(" %-22s %s\n", c.Use, c.Short)
424+
}
425+
}
426+
427+
fmt.Println("\nUse \"stackroost [command] --help\" for more information about a command.\n")
380428
}

0 commit comments

Comments
 (0)