···8181- Find changed stacks
8282- Deploy only changed stacks assigned to this host
83838484-### Dry Run
8585-8686-To see what would be deployed without actually deploying:
8787-8888-```bash
8989-./compose-sync -dry-run
9090-```
9191-9284### Custom Config Path
93859486```bash
+1
config.yml.example
···11# Configuration file for compose-sync
22repo_url: "git@github.com:user/compose-repo.git" # Optional: URL for cloning (not used if repo_path already exists)
33repo_path: "/path/to/local/repo" # Required: Local path to the git repository
44+branch: "main" # Optional: Git branch to sync (default: current branch or main)
45concurrency: 3 # Optional: Number of concurrent deployments (default: 3)
56
+2-11
main.go
···12121313func main() {
1414 configPath := flag.String("config", "config.yml", "Path to configuration file")
1515- dryRun := flag.Bool("dry-run", false, "Show what would be deployed without actually deploying")
1615 flag.Parse()
17161817 cfg, err := loadConfig(*configPath)
···3837 }
3938 fmt.Printf("Detected host: %s\n", currentHost)
40394141- fmt.Println("Pulling git repository...")
4242- changedStacks, err := pullAndDetectChanges(cfg.RepoPath)
4040+ fmt.Printf("Pulling git repository (branch: %s)...\n", cfg.Branch)
4141+ changedStacks, err := pullAndDetectChanges(cfg.RepoPath, cfg.Branch)
4342 if err != nil {
4443 log.Fatalf("Failed to pull or detect changes: %v", err)
4544 }
···7170 }
72717372 fmt.Printf("Stacks to deploy: %v\n", stacksToDeploy)
7474-7575- if *dryRun {
7676- fmt.Println("DRY RUN: Would deploy the following stacks:")
7777- for _, stack := range stacksToDeploy {
7878- fmt.Printf(" - %s\n", stack)
7979- }
8080- return
8181- }
82738374 deployStacks(cfg.RepoPath, stacksToDeploy, cfg.Concurrency)
8475}