You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
graft run alpine echo"hello"# Quick throwaway commands
94
94
```
95
95
96
+
**Automatic Dns Mapping for Cloudflare based DNSs:**
97
+
```bash
98
+
graft map #Automatically detects domains by service and sets DNS
99
+
```
100
+
**Easy Rollback to previous deployments:**
101
+
```bash
102
+
graft rollback #Display previous deployments and allow you to rollback to any of them
103
+
graft rollback config #Set up how many versions to keep
104
+
```
105
+
96
106
**Important caveat:** Interactive sessions (like `graft exec -it backend bash`) don't work due to SSH-in-SSH limitations. For that, use `graft -sh` to drop into a proper SSH session first, then run your Docker commands there.
97
107
98
108
**All your muscle memory still works.** If you know Docker Compose, you know Graft. The only difference is your services are running on a server in some datacenter instead of melting your laptop's CPU.
@@ -180,6 +190,8 @@ graft sync
180
190
graft ps # Check status
181
191
graft logs backend # View logs
182
192
graft restart frontend # Restart service
193
+
graft map #automatically updates cloudflare dns records
194
+
graft rollback #roll back to previous versions
183
195
```
184
196
185
197
**That's it.** Your project is running on the server, managed via familiar commands.
fmt.Println(" map Map all service domains to Cloudflare DNS")
@@ -1889,7 +1901,7 @@ func runRollback() {
1889
1901
}
1890
1902
1891
1903
ifmeta.RollbackBackups<=0 {
1892
-
fmt.Println("❌ Rollback is not configured for this project. Setup rollbacks during 'graft init' or update your project configuration.")
1904
+
fmt.Println("❌ Rollback is not configured for this project. Setup rollbacks during 'graft init' or update your project configuration with 'graft rollback config'.")
1893
1905
return
1894
1906
}
1895
1907
@@ -1954,6 +1966,179 @@ func runRollback() {
1954
1966
}
1955
1967
}
1956
1968
1969
+
funcrunRollbackConfig() {
1970
+
meta, err:=config.LoadProjectMetadata()
1971
+
iferr!=nil {
1972
+
fmt.Println("Error: Could not load project metadata. Run 'graft init' first.")
1973
+
return
1974
+
}
1975
+
1976
+
cfg, err:=config.LoadConfig()
1977
+
iferr!=nil {
1978
+
fmt.Println("Error: No config found.")
1979
+
return
1980
+
}
1981
+
1982
+
fmt.Printf("🔄 Rollback Configuration for project: %s\n", meta.Name)
1983
+
fmt.Printf("Current versions to keep: %d\n", meta.RollbackBackups)
1984
+
1985
+
reader:=bufio.NewReader(os.Stdin)
1986
+
fmt.Print("\nDo you want to change or remove rollback configuration? (y: change, n: remove, enter: skip): ")
1987
+
input, _:=reader.ReadString('\n')
1988
+
input=strings.ToLower(strings.TrimSpace(input))
1989
+
1990
+
varnewVersionToKeepint
1991
+
varactionstring
1992
+
1993
+
ifinput=="y"||input=="yes" {
1994
+
fmt.Print("Enter the new number of versions to keep: ")
fmt.Println("Error: Could not load project metadata. Run 'graft init' first.")
2073
+
return
2074
+
}
2075
+
2076
+
ifmeta.RollbackBackups<=0 {
2077
+
fmt.Println("❌ Rollback is not configured for this project. Setup rollbacks during 'graft init' or update your project configuration with 'graft rollback config'.")
2078
+
return
2079
+
}
2080
+
2081
+
cfg, err:=config.LoadConfig()
2082
+
iferr!=nil {
2083
+
fmt.Println("Error: No config found.")
2084
+
return
2085
+
}
2086
+
2087
+
fmt.Printf("🔍 Connecting to %s (%s)...\n", cfg.Server.RegistryName, cfg.Server.Host)
0 commit comments