Skip to content

Commit 9b7aa68

Browse files
committed
Updated Documentation and readme and help arg
1 parent 0be07b5 commit 9b7aa68

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

.goreleaser.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ release:
4040
### V2.1 Highlights:
4141
1. **Cloudflare API Integration**: Automated DNS zone mapping based on Traefik host labels.
4242
2. **Cloudflare Zone Registry**: Manage multiple Cloudflare accounts and zones with an interactive selection menu.
43-
3. **Bug Fixes**: Improved domain detection and duplicate record handling.
44-
43+
3. **Database Backup Automation(Infrastructure)**: Easily backup Infrastructure databases to S3/R2(Experimental).
44+
4. **Bug Fixes**: Improved domain detection and duplicate record handling.
45+
4546
### V2 Highlights:
4647
This release introduces significant enhancements to Graft, moving from basic local-to-server deployments to a more robust CI/CD-driven workflow using GitHub Actions and our new `graft-hook` service.
4748

COMMANDS.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,28 @@ graft infra reload
303303
304304
---
305305
306+
### `graft infra db backup`
307+
Schedule or run an automated database backup to an S3-compatible service.
308+
309+
```bash
310+
graft infra db backup
311+
```
312+
313+
**What it does:**
314+
- Interactively prompts for S3 credentials (if not configured).
315+
- Offers to setup a daily cron job (2 AM) for automated backups.
316+
- Generates and uploads a `backup.sh` script to the server.
317+
- Uses a Docker container (`amazon/aws-cli`) to perform the upload safely.
318+
- Optionally saves S3 credentials on the server for automated tasks.
319+
320+
**Interactive Flow:**
321+
1. **S3 Config**: Provide Endpoint, Region, Bucket, Access Key, and Secret Key.
322+
2. **Scheduling**: Choose to enable daily backups via cron.
323+
3. **Save Info**: Choose to persist credentials on the server.
324+
4. **Immediate Backup**: Option to run the first backup immediately to verify setup.
325+
326+
---
327+
306328
## Deployment Commands
307329
308330
### `graft sync`

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ curl -sSL https://raw.githubusercontent.com/skssmd/Graft/main/bin/install.sh | s
147147
powershell -ExecutionPolicy ByPass -Command "iwr -useb https://raw.githubusercontent.com/skssmd/Graft/main/bin/install.ps1 | iex"
148148
```
149149

150+
**Or via WinGet:**
151+
```bash
152+
winget install graft
153+
```
154+
150155
### From Source
151156
```bash
152157
git clone https://github.com/skssmd/Graft
@@ -250,7 +255,7 @@ If you need Kubernetes, use Kubernetes. Graft is for everyone else who just want
250255

251256
Planned features:
252257
- Dev/prod environment separation
253-
- Database backup automation (with S3/R2)
258+
- Database backup automation (with S3/R2) [Added-Experimental]
254259
- Rollback mechanism
255260
- Slack/Discord notifications
256261
- Health checks and monitoring

cmd/graft/main.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ func main() {
2626

2727
args := os.Args[1:]
2828

29+
// Handle version and help flags
30+
if len(args) > 0 {
31+
arg := args[0]
32+
if arg == "-v" || arg == "--version" {
33+
fmt.Println("v2.1.1")
34+
return
35+
}
36+
if arg == "--help" {
37+
printUsage()
38+
return
39+
}
40+
}
41+
2942
// Handle target registry flag: graft -r registryname ...
3043
var registryContext string
3144
if args[0] == "-r" || args[0] == "--registry" {
@@ -204,13 +217,16 @@ func printUsage() {
204217
fmt.Println(" -p, --project <name> Run command in specific project context")
205218
fmt.Println(" -r, --registry <name> Target a specific server context")
206219
fmt.Println(" -sh, --sh [cmd] Execute shell command on target (or start SSH session)")
220+
fmt.Println(" -v, --version Show version information")
221+
fmt.Println(" --help Show this help message")
207222
fmt.Println("\nCommands:")
208223
fmt.Println(" init [-f] Initialize a new project")
209224
fmt.Println(" registry [ls|add|del] Manage registered servers")
210225
fmt.Println(" projects ls List local projects")
211226
fmt.Println(" pull <project> Pull/Clone project from remote")
212227
fmt.Println(" host [init|clean|sh|self-destruct] Manage current project's host context")
213228
fmt.Println(" infra [db|redis] ports:<v> Change infra port mapping (null to hide)")
229+
fmt.Println(" infra db backup Setup automated database backups to S3")
214230
fmt.Println(" infra reload Pull and reload infrastructure services")
215231
fmt.Println(" db/redis <name> init Initialize shared infrastructure")
216232
fmt.Println(" sync [service] [-h] Deploy project to server")

0 commit comments

Comments
 (0)