-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Repos are not initialized if configured via JSON #627
Comments
Hi, unfortunately there's a foot gun here irrespective of how I approach this
I think a one-click init button could make sense as a nice to add, in the mean time I'll update the docs to recommend that if adding repos by config they should be already initialized OR can be initialized via run command. Since backrest is backup software I've opted to be very conservative here and prefer making the user take action whenever there's ambiguity -- but this does mean there are more times that a user might be presented with an error that requires intervention. |
That makes sense @garethgeorge ... I assume I can just run a bare |
Hmm. This is interesting actually -- with the latest update (1.7.0) there's a new concept of a repo GUID which means any added repo must have a random unique ID specified in its configuration. Using init through backrest's add repo flow will populate this for you (from the repo's config) but running init externally won't. I'll likely need to submit some sort of patch to fix this for you elsewise you're likely to get an error when attempting to load your config. You can work around the problem by simply generating a 256 bit (64 char hex) random ID in the GUID field, but it really is something that backrest should be doing for you. tl;dr not sure that there was a problem here when you asked, I think there might be now. I'll include this in the set of fixes for 1.7.1. |
Appreciated! Id be fine with generating a random ID, but ideally Id just be able to provide a config like this on boot and backrest does whats needed: {
"modno": 1,
"version": 4,
"instance": "minipc",
"repos": [
{
"id": "s3-minipc",
"uri": "s3:https://s3.ca-east-006.backblazeb2.com/...",
"password": "...",
"prunePolicy": {
"schedule": {
"cron": "5 4 * * 0",
"clock": "CLOCK_LAST_RUN_TIME"
},
"maxUnusedPercent": 10
},
"checkPolicy": {
"schedule": {
"cron": "0 0 1 * *",
"clock": "CLOCK_LAST_RUN_TIME"
},
"readDataSubsetPercent": 0
},
"commandPrefix": {}
},
{
"id": "raid_array",
"uri": "/raid_array",
"password": "12345",
"prunePolicy": {
"schedule": {
"cron": "0 */6 * * *",
"clock": "CLOCK_LAST_RUN_TIME"
},
"maxUnusedPercent": 10
},
"checkPolicy": {
"schedule": {
"cron": "0 0 1 * *",
"clock": "CLOCK_LAST_RUN_TIME"
},
"readDataSubsetPercent": 0
},
"commandPrefix": {}
}
],
"plans": [
{
"id": "s3-minipc",
"repo": "s3-minipc",
"paths": [
"/wd_2tb"
],
"schedule": {
"cron": "0 * * * *",
"clock": "CLOCK_LOCAL"
},
"retention": {
"policyTimeBucketed": {
"hourly": 24,
"daily": 7,
"monthly": 1
}
},
"hooks": [
{
"conditions": [
"CONDITION_UNKNOWN",
"CONDITION_ANY_ERROR",
"CONDITION_SNAPSHOT_ERROR",
"CONDITION_SNAPSHOT_WARNING",
"CONDITION_SNAPSHOT_SKIPPED"
],
"actionShoutrrr": {
"shoutrrrUrl": "ntfy://...",
"template": "{{ .Summary }}"
}
}
]
},
{
"id": "raid_array",
"repo": "raid_array",
"paths": [
"/wd_2tb"
],
"schedule": {
"cron": "0 * * * *",
"clock": "CLOCK_LOCAL"
},
"retention": {
"policyTimeBucketed": {
"hourly": 24,
"daily": 30,
"monthly": 12
}
},
"hooks": [
{
"conditions": [
"CONDITION_UNKNOWN",
"CONDITION_ANY_ERROR",
"CONDITION_SNAPSHOT_ERROR",
"CONDITION_SNAPSHOT_WARNING",
"CONDITION_SNAPSHOT_SKIPPED"
],
"actionShoutrrr": {
"shoutrrrUrl": "ntfy://...",
"template": "{{ .Summary }}"
}
}
]
}
],
"auth": {
"disabled": true,
"users": [
{
"name": "jules2689",
"passwordBcrypt": "12345"
}
]
}
} |
This wound up being surprisingly painful but I think important to address. The solution I've come up with for the time being is a new The PR is #650 . In a followup backrest will use a similar flow to automatically populate the GUID for config entries missing it. |
Describe the bug
A clear and concise description of what the bug is.
I'm not sure if this is a bug or a feature request, but ultimately landed on considering it a bug for the purpose of this issue because it seems that backrest encourages the use of config.json, especially when restoring.
In my case, I am using Ansible to programmatically set up my computer. In my scripts I am generating a valid config.json file that includes repos and plans - Backrest has no problem detecting these, but leaves them uninitialized. This leads to checks failing, and backups cannot run. I can fix this by running
init
in theRun Command
mode, but this is not ideal - im unsure if there are missing options (e.g. theopts
variable on this line https://github.com/garethgeorge/backrest/blob/b3402a18d2026a2b5998ecdae5a9802f7b3c844a/pkg/restic/restic.go#L116C64-L116C68)In an ideal world, backrest would loop through the repos on boot and initialize any of them that are not initialized (perhaps this can be a config in config.json!)
To Reproduce
Steps to reproduce the behavior:
3.Go to repo and click "check now"
unable to open config file: stat ...
Expected behavior
Repos should either:
Platform Info
garethgeorge/backrest:latest
The text was updated successfully, but these errors were encountered: