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

docs(site): Add 'How do I automate backups?' to FAQ #3358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jmbrunskill
Copy link

Adds an FAQ section on how to automate backups based on discourse answer here:
https://kopia.discourse.group/t/basics-questions-thanks-for-your-time/258/5

A colleague spent a lot of time trying to figure out how to automate kopia backups, which makes me think adding some basic docs & explaination is useful.
The design is a little confusing because policies can setup scheduled, but they don't run without the server running or a cron job.

I've put in very minimal examples cron jobs and systemd service, neither of which have had much testing.

Perhaps it's better to explain the socket based systemd approach mentioned here?
https://kopia.io/docs/repository-server/#kopia-with-systemd
I don't really understand it though, so would need some input on that.

This docs current focus on linux, but I think it would be helpful to have similar docs for windows, and mac.

@basldfalksjdf
Copy link
Collaborator

basldfalksjdf commented Sep 27, 2023

A few thoughts on this:

(1) IMO, if a guide or tip or whatever is fairly long, such as the proposed changed, it should be on its own page rather than in the FAQs. We can create a FAQ for it but then use the FAQ to link to the new page rather than within the FAQ. Otherwise, the FAQ will get way too long

(2) The proposed change is incomplete as it does not discuss KopiaUI, which you don't need to do anything to automate snapshots

(3) I don't use Kopia CLI, but I thought that too allowed you to automate backups by setting up policies? Without the need to use cron?

@jmbrunskill
Copy link
Author

Many thanks for your feedback!

(1) IMO, if a guide or tip or whatever is fairly long, such as the proposed changed, it should be on its own page rather than in the FAQs. We can create a FAQ for it but then use the FAQ to link to the new page rather than within the FAQ. Otherwise, the FAQ will get way too long

Fair enough, I agree, do you have a suggestion on where it would go?
Maybe we leave the FAQ (How do I automate backups) and add a cron example under the CLI section here?
https://kopia.io/docs/getting-started/

(2) The proposed change is incomplete as it does not discuss KopiaUI, which you don't need to do anything to automate snapshots

If I understand correctly, KopiaUI runs kopia server which (if running) can automate snapshots.
I haven't done enough with it to really understand the ins and outs of it, but pretty confident it can be run without actually serving the UI component.

(3) I don't use Kopia CLI, but I thought that too allowed you to automate backups by setting up policies? Without the need to use cron?

This is exactly the kind of confusion I would like to see cleared up and clarified in the docs, and I'm very happy to be pointed at the information about how to do it if so.

Kopia docs are unclear as it seems to imply automation that doesn't come out of the box if you install on linux at least.

From what I can tell you have to run kopia server, which is what I tried to suggest using systemd.
I'm guessing a lot of linuxy people are probably going to use cron though, so maybe it's just a matter of pointing to the idea rather than giving two options?

@basldfalksjdf
Copy link
Collaborator

@jkowalski can clarify about whether Kopia CLI explicitly needs to be set to run via cron or setting a policy is enough to automate backups. Im pretty sure setting a policy is enough, but as I said I don't use Kopia CLI.

If setting the policy is enough, then we don't really need an extra page for this. We could create a FAQ and do a short one paragraph writeup in that FAQ that says something like "Kopia automatically runs backups based on the policies that you create." The getting started guide already has information on setting up policies.

If you do need to use cron to automate, then I think a dedicated page is the way to go and then just link to that page in the FAQ.

@RayZ0rr
Copy link

RayZ0rr commented Oct 3, 2023

@jkowalski can clarify about whether Kopia CLI explicitly needs to be set to run via cron or setting a policy is enough to automate backups. Im pretty sure setting a policy is enough, but as I said I don't use Kopia CLI.

@basldfalksjdf Kopia CLI doesn't imply any sort of automatic backup. You need a daemon, or something like that, running to execute the policies. What is the daemon for kopia?

I can clearly see the confusion that @jmbrunskill raises as I had the same confusion when setting up automatic kopia backups in my cronjobs.

Maybe there is an easier way by running kopia server start or something but a FAQ or docs page like this PR suggests is very helpful.

I now use

export KOPIA_CONFIG_PATH="${HOME}/path/to/config"
# need to securely provide password:
export KOPIA_PASSWORD="some-password"

# snip

${KOPIA_CMD} snapshot create --tags="${BACKUP_TAGS}" "${BACKUP_TARGET}" | tee -a "${logFile}"

@jkowalski jkowalski changed the title (docs) Add 'How do I automate backups?' to FAQ docs(site): Add 'How do I automate backups?' to FAQ Oct 6, 2023
@jkowalski
Copy link
Contributor

note that passing kopia password is generally only needed on repository connect. The password is then stored in keystore/keychain or in a local file if those are unavailable.

The exception is when you pass --no-persist-credentials on connect, in such case you need to provide the password each time.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a934629) 75.82% compared to head (c8f4805) 75.87%.

❗ Current head c8f4805 differs from pull request most recent head f31ad70. Consider uploading reports for the commit f31ad70 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3358      +/-   ##
==========================================
+ Coverage   75.82%   75.87%   +0.04%     
==========================================
  Files         465      463       -2     
  Lines       37171    37100      -71     
==========================================
- Hits        28185    28149      -36     
+ Misses       7057     7025      -32     
+ Partials     1929     1926       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@Kumen Kumen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants