File size: 6,389 Bytes
fd357f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Syncthing Configuration for DTO Class B/C Mirrors
# Automated distributed file synchronization for non-critical data transfers

# Global Syncthing Settings
syncthing:
  host: "localhost"
  port: 8384
  api_key: "${SYNCTHING_API_KEY}"
  config_dir: "/data/adaptai/platform/dataops/dto/syncthing"
  
# DTO Mirror Environments
environments:
  production:
    devices:
      vast1:
        device_id: "${VAST1_SYNCTHING_DEVICE_ID}"
        name: "vast1-prod-mirror"
        address: "vast1.adapt.ai:22000"
        role: "primary"
      vast2:
        device_id: "${VAST2_SYNCTHING_DEVICE_ID}" 
        name: "vast2-prod-mirror"
        address: "vast2.adapt.ai:22000"
        role: "secondary"
      archive1:
        device_id: "${ARCHIVE1_SYNCTHING_DEVICE_ID}"
        name: "archive1-prod-mirror"
        address: "archive1.adapt.ai:22000"
        role: "archive"
        
  staging:
    devices:
      vast1-staging:
        device_id: "${VAST1_STAGING_SYNCTHING_DEVICE_ID}"
        name: "vast1-staging-mirror"
        address: "vast1-staging.adapt.ai:22000"
        role: "primary"
      vast2-staging:
        device_id: "${VAST2_STAGING_SYNCTHING_DEVICE_ID}"
        name: "vast2-staging-mirror" 
        address: "vast2-staging.adapt.ai:22000"
        role: "secondary"

# Data Class Configurations
data_classes:
  CLASS_B:
    # Research and development data - moderate sync frequency
    sync_config:
      rescan_interval: 1800      # 30 minutes
      folder_type: "sendreceive"
      versioning:
        type: "simple"
        keep: 3
      bandwidth:
        max_send_kbps: 50000     # 50 MB/s limit
        max_recv_kbps: 50000
      options:
        ignore_perms: false
        auto_normalize: true
        fs_watcher_enabled: true
        fs_watcher_delay: 10
        weak_hash_threshold: 25
        
    # Storage paths by environment
    storage_paths:
      production: "/data/adaptai/platform/dataops/dto/mirrors/class_b/prod"
      staging: "/data/adaptai/platform/dataops/dto/mirrors/class_b/staging"
      
    # Priority and scheduling
    priority: "normal"
    schedule:
      active_hours: "00:00-23:59"  # Always active
      maintenance_window: "02:00-04:00"
      
  CLASS_C:
    # Archive and backup data - low sync frequency
    sync_config:
      rescan_interval: 3600      # 1 hour
      folder_type: "sendreceive"
      versioning:
        type: "simple" 
        keep: 5
      bandwidth:
        max_send_kbps: 20000     # 20 MB/s limit (lower priority)
        max_recv_kbps: 20000
      options:
        ignore_perms: true
        auto_normalize: true
        fs_watcher_enabled: false  # Manual scan only
        weak_hash_threshold: 50    # More aggressive weak hashing
        
    # Storage paths by environment
    storage_paths:
      production: "/data/adaptai/platform/dataops/dto/mirrors/class_c/prod"
      staging: "/data/adaptai/platform/dataops/dto/mirrors/class_c/staging"
      archive: "/data/adaptai/platform/dataops/dto/mirrors/class_c/archive"
      
    # Priority and scheduling
    priority: "low"
    schedule:
      active_hours: "22:00-06:00"  # Night hours only
      maintenance_window: "02:00-04:00"

# Mirror Policies
mirror_policies:
  # Automatic mirror setup based on data patterns
  auto_setup:
    enabled: true
    data_size_threshold: 10737418240  # 10GB minimum for auto-mirror
    file_count_threshold: 100
    data_types:
      - "research_datasets"
      - "model_checkpoints" 
      - "experiment_results"
      - "backup_archives"
      
  # Retention policies
  retention:
    CLASS_B:
      keep_days: 30
      archive_after_days: 90
      cleanup_failed_syncs: true
    CLASS_C:
      keep_days: 90
      archive_after_days: 365
      cleanup_failed_syncs: true
      
  # Health monitoring
  health_checks:
    interval_seconds: 300
    connection_timeout: 30
    max_disconnect_time: 3600  # 1 hour before alert
    
# Integration Settings
integrations:
  # NATS event publishing
  nats:
    subjects:
      mirror_setup: "dto.events.syncthing.mirror_setup"
      sync_progress: "dto.events.syncthing.sync_progress"
      sync_completed: "dto.events.syncthing.sync_completed"
      health_status: "dto.events.syncthing.health_status"
      
  # Slack notifications for sync issues
  slack:
    notify_on:
      - "device_disconnected"
      - "sync_failed"
      - "mirror_setup_failed"
      - "health_check_failed"
    channels:
      alerts: "#dto-alerts"
      status: "#dto-status"
      
  # Prometheus metrics
  metrics:
    enabled: true
    port: 8385
    metrics:
      - "syncthing_device_connections"
      - "syncthing_folder_sync_status"
      - "syncthing_bandwidth_usage"
      - "syncthing_sync_completion_time"

# Security Settings
security:
  # Device discovery and auto-accept
  discovery:
    enabled: true
    global_discovery: false  # Local network only
    local_discovery: true
    
  # Device authentication
  authentication:
    auto_accept_devices: false
    device_verification_required: true
    certificate_validation: true
    
  # Folder sharing
  folder_security:
    auto_accept_folders: false
    folder_verification_required: true
    ignore_patterns:
      - ".git/*"
      - "*.tmp"
      - "*.log"
      - "__pycache__/*"
      - ".DS_Store"

# Performance Tuning
performance:
  # Connection limits
  connections:
    max_concurrent_requests: 64
    request_timeout: 60
    connect_timeout: 30
    
  # Scanning performance
  scanning:
    max_concurrent_scans: 2
    scan_progress_interval: 2
    weak_hash_selection_method: "auto"
    
  # Bandwidth management
  bandwidth:
    limit_enabled: true
    peak_hours: "08:00-18:00"
    peak_limit_factor: 0.7  # 70% of max during peak hours
    
  # Memory and CPU limits
  resources:
    max_memory_mb: 2048
    max_cpu_percent: 50
    gc_interval: 300

# Logging Configuration  
logging:
  level: "INFO"
  file: "/data/adaptai/platform/dataops/dto/logs/syncthing-automation.log"
  max_size_mb: 100
  max_files: 5
  format: "json"
  
# Backup and Recovery
backup:
  config_backup:
    enabled: true
    interval_hours: 24
    backup_dir: "/data/adaptai/platform/dataops/dto/syncthing/backups"
    keep_backups: 7
    
  disaster_recovery:
    config_restore_script: "/data/adaptai/platform/dataops/dto/syncthing/restore_config.sh"
    device_id_backup: "/data/adaptai/platform/dataops/dto/syncthing/device_ids.json"