Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move migrations to the autopilot #1735

Merged
merged 22 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dd121fb
downloader: move downloadManager to its own package
ChrisSchinnerl Dec 6, 2024
d9fec9f
internal: move upload manager
peterjan Dec 9, 2024
66dddf1
docs: add changelog file
peterjan Dec 9, 2024
119609d
testing: fix upload tests
peterjan Dec 9, 2024
88a4455
testing: fix parameter order
peterjan Dec 9, 2024
77d86b3
Merge branch 'its-happening' of github.com:SiaFoundation/renterd into…
peterjan Dec 9, 2024
00e6bc3
Merge branch 'its-happening' of github.com:SiaFoundation/renterd into…
peterjan Dec 10, 2024
066a6c4
cluster: move migrations from worker to autopilot
peterjan Dec 10, 2024
df9976d
testing: fix TestDownloadAllHosts
peterjan Dec 10, 2024
99c6b09
Merge branch 'its-happening' of github.com:SiaFoundation/renterd into…
peterjan Dec 10, 2024
a933e31
docs: add changelog
peterjan Dec 10, 2024
8aa2f27
worker: remove migrate slab from worker API
peterjan Dec 10, 2024
b9cffad
internal: deduplicate spending and host manager
peterjan Dec 10, 2024
738cd3f
worker: set host manager
peterjan Dec 10, 2024
33f7996
migrator: cleanup
peterjan Dec 10, 2024
cde0fb1
host: remove FundAccount
peterjan Dec 10, 2024
8da3f8d
all: implement review remarks
peterjan Dec 11, 2024
75dc1f6
Merge branch 'its-happening' of github.com:SiaFoundation/renterd into…
peterjan Dec 11, 2024
a3c4316
Merge branch 'its-happening' of github.com:SiaFoundation/renterd into…
peterjan Dec 12, 2024
9c08718
Merge branch 'dev' into pj/move-migrations
ChrisSchinnerl Dec 12, 2024
4e08d66
Merge branch 'dev' of github.com:SiaFoundation/renterd into pj/move-m…
peterjan Dec 16, 2024
030c351
Merge branch 'pj/move-migrations' of github.com:SiaFoundation/renterd…
peterjan Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/move_migrations_to_the_autopilot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: major
---

# Move migrations to the autopilot
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ overview of all settings configurable through the CLI.
| `Worker.UploadOverdriveTimeout` | Timeout for overdriving slab uploads | `3s` | `--worker.uploadOverdriveTimeout` | - | `worker.uploadOverdriveTimeout` |
| `Worker.Enabled` | Enables/disables worker | `true` | `--worker.enabled` | `RENTERD_WORKER_ENABLED` | `worker.enabled` |
| `Worker.AllowUnauthenticatedDownloads` | Allows unauthenticated downloads | - | `--worker.unauthenticatedDownloads` | `RENTERD_WORKER_UNAUTHENTICATED_DOWNLOADS` | `worker.allowUnauthenticatedDownloads` |
| `Worker.RemoteAddrs` | List of remote worker addresses (semicolon delimited) | - | - | `RENTERD_WORKER_REMOTE_ADDRS` | `worker.remotes` |
| `Worker.RemotePassword` | API password for the remote workers | - | - | `RENTERD_WORKER_API_PASSWORD` | `worker.remotes` |
| `Autopilot.Enabled` | Enables/disables autopilot | `true` | `--autopilot.enabled` | `RENTERD_AUTOPILOT_ENABLED` | `autopilot.enabled` |
| `Autopilot.AccountsRefillInterval` | Interval for refilling workers' account balances | `24h` | `--autopilot.accountRefillInterval` | - | `autopilot.accountsRefillInterval` |
| `Autopilot.Heartbeat` | Interval for autopilot loop execution | `30m` | `--autopilot.heartbeat` | - | `autopilot.heartbeat` |
| `Autopilot.MigrationHealthCutoff` | Threshold for migrating slabs based on health | `0.75` | `--autopilot.migrationHealthCutoff` | - | `autopilot.migrationHealthCutoff` |
| `Autopilot.MigratorRefillInterval` | Interval for refilling account balances | `24h` | `--autopilot.migratorAccountRefillInterval` | - | `autopilot.migratorAccountsRefillInterval` |
| `Autopilot.MigratorHealthCutoff` | Threshold for migrating slabs based on health | `0.75` | `--autopilot.migratorHealthCutoff` | - | `autopilot.migratorHealthCutoff` |
| `Autopilot.MigratorNumThreads` | Number of threads migrating slabs | `1` | `--autopilot.migratorNumThreads` | - | `autopilot.migratorNumThreads` |
| `Autopilot.MigratorDownloadMaxOverdrive` | Max overdrive workers for migration downloads | `5` | `--autopilot.migratorDownloadMaxOverdrive` | - | `autopilot.migratorDownloadMaxOverdrive` |
| `Autopilot.MigratorDownloadOverdriveTimeout` | Timeout for overdriving migration downloads | `3s` | `--autopilot.migratorDownloadOverdriveTimeout` | - | `autopilot.migratorDownloadOverdriveTimeout` |
| `Autopilot.MigratorUploadMaxOverdrive` | Max overdrive workers for migration uploads | `5` | `--autopilot.migratorUploadMaxOverdrive` | - | `autopilot.migratorUploadMaxOverdrive` |
| `Autopilot.MigratorUploadOverdriveTimeout` | Timeout for overdriving migration uploads | `3s` | `--autopilot.migratorUploadOverdriveTimeout` | - | `autopilot.migratorUploadOverdriveTimeout` |
| `Autopilot.RevisionBroadcastInterval`| Interval for broadcasting contract revisions | `168h` (7 days) | `--autopilot.revisionBroadcastInterval` | `RENTERD_AUTOPILOT_REVISION_BROADCAST_INTERVAL` | `autopilot.revisionBroadcastInterval` |
| `Autopilot.ScannerBatchSize` | Batch size for host scanning | `1000` | `--autopilot.scannerBatchSize` | - | `autopilot.scannerBatchSize` |
| `Autopilot.ScannerInterval` | Interval for scanning hosts | `24h` | `--autopilot.scannerInterval` | - | `autopilot.scannerInterval` |
| `Autopilot.ScannerNumThreads` | Number of threads for scanning hosts | `100` | - | - | `autopilot.scannerNumThreads` |
| `Autopilot.MigratorParallelSlabsPerWorker` | Parallel slab migrations per worker | `1` | `--autopilot.migratorParallelSlabsPerWorker` | `RENTERD_MIGRATOR_PARALLEL_SLABS_PER_WORKER` | `autopilot.migratorParallelSlabsPerWorker` |
| `S3.Address` | Address for serving S3 API | `:9982` | `--s3.address` | `RENTERD_S3_ADDRESS` | `s3.address` |
| `S3.DisableAuth` | Disables authentication for S3 API | `false` | `--s3.disableAuth` | `RENTERD_S3_DISABLE_AUTH` | `s3.disableAuth` |
| `S3.Enabled` | Enables/disables S3 API | `true` | `--s3.enabled` | `RENTERD_S3_ENABLED` | `s3.enabled` |
Expand Down Expand Up @@ -135,11 +137,7 @@ occur. Therefor it is important to start the worker after the bus is reachable.

To run the autopilot separately, the worker has to be disabled using the
`--worker.enabled` flag. Similar to the worker, the autopilot has to be
configured with a remote bus for the node not to start a bus itself. Alongside
with knowing where the bus is located, the autopilot also has to be aware of the
workers. These remote workers can be configured through yaml under the option
`worker.remotes`, or through environment variables
(`RENTERD_WORKER_REMOTE_ADDRS` and `RENTERD_WORKER_API_PASSWORD`).
configured with a remote bus for the node not to start a bus itself.

#### Example docker-compose with minimal configuration

Expand Down Expand Up @@ -193,8 +191,6 @@ services:
- RENTERD_API_PASSWORD=autopilot-pass
- RENTERD_BUS_API_PASSWORD=bus-pass
- RENTERD_BUS_REMOTE_ADDR=http://bus:9980/api/bus
- RENTERD_WORKER_API_PASSWORD=<worker-password>
- RENTERD_WORKER_REMOTE_ADDRS=http://worker-1:9980/api/worker;http://worker-2:9980/api/worker
ports:
- "9984:9980"
depends_on:
Expand Down
33 changes: 2 additions & 31 deletions autopilot/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
)

var (
alertHealthRefreshID = alerts.RandomAlertID() // constant until restarted
alertLowBalanceID = alerts.RandomAlertID() // constant until restarted
alertOngoingMigrationsID = alerts.RandomAlertID() // constant until restarted
alertPruningID = alerts.RandomAlertID() // constant until restarted
alertLowBalanceID = alerts.RandomAlertID() // constant until restarted
alertPruningID = alerts.RandomAlertID() // constant until restarted
)

func (ap *Autopilot) RegisterAlert(ctx context.Context, a alerts.Alert) {
Expand Down Expand Up @@ -58,30 +56,3 @@ func newContractPruningFailedAlert(hk types.PublicKey, version, release string,
Timestamp: time.Now(),
}
}

func newOngoingMigrationsAlert(n int, estimate time.Duration) alerts.Alert {
data := make(map[string]interface{})
if rounded := estimate.Round(time.Minute); rounded > 0 {
data["estimate"] = fmt.Sprintf("~%v remaining", rounded)
}

return alerts.Alert{
ID: alertOngoingMigrationsID,
Severity: alerts.SeverityInfo,
Message: fmt.Sprintf("Migrating %d slabs", n),
Timestamp: time.Now(),
Data: data,
}
}

func newRefreshHealthFailedAlert(err error) alerts.Alert {
return alerts.Alert{
ID: alertHealthRefreshID,
Severity: alerts.SeverityCritical,
Message: "Health refresh failed",
Data: map[string]interface{}{
"error": err.Error(),
},
Timestamp: time.Now(),
}
}
Loading
Loading