···881. Have changed since the last pull
992. Are assigned to the current host
10101111+## How It Works
1212+1313+1. **Host Detection**: The tool uses the system hostname to identify the current host
1414+2. **Stack Assignment**: Reads `inventory.yml` to determine which stacks should be deployed on this host
1515+3. **Change Detection**: Compares git commits before and after pulling to find changed stacks
1616+4. **Selective Deployment**: Only deploys stacks that both changed AND are assigned to this host
1717+1118## Repository Structure
12191320Your git repository should have the following structure:
···3441 - nextcloud
3542```
36433737-This format is compatible with Ansible inventory structures and provides a centralized view of all host assignments.
4444+## Requirements
4545+4646+- Go 1.21 or later
4747+- Git
4848+- Docker and Docker Compose
4949+- A git repository with the structure described above
38503951## Installation
4052···8395./compose-sync -config /path/to/config.yml
8496```
85978686-### Systemd Service and Timer (Automatic Execution)
9898+## Automatic Execution
9999+100100+### Systemd Service and Timer
8710188102To run compose-sync automatically using systemd:
89103···121135122136The timer will run compose-sync every 5 minutes. To change the interval, edit `compose-sync.timer` and modify the `OnUnitActiveSec` value.
123137124124-## How It Works
138138+### Cron Job (Alternative)
125139126126-1. **Host Detection**: The tool uses the system hostname to identify the current host
127127-2. **Stack Assignment**: Reads `inventory.yml` to determine which stacks should be deployed on this host
128128-3. **Change Detection**: Compares git commits before and after pulling to find changed stacks
129129-4. **Selective Deployment**: Only deploys stacks that both changed AND are assigned to this host
140140+To run compose-sync using cron instead of systemd:
130141131131-## Requirements
132132-133133-- Go 1.21 or later
134134-- Git
135135-- Docker and Docker Compose
136136-- A git repository with the structure described above
142142+1. **Install the cron job**:
143143+ ```bash
144144+ crontab -e
145145+ ```
146146+ Then add the desired crontab job, for example (every 5min, defaults, logging):
147147+ ```bash
148148+ */5 * * * * /usr/local/bin/compose-sync >> /var/log/compose-sync.log 2>&1
149149+ ```
137150138151## License
139152