42 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
01e00cdde4
backups: Allow comments to be added to archives during backup
Tests performed:

- Schedules are able to store and retrieve comments properly. Information about
schedule backups stored in comments is extracted properly.

- Unit tests run.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-01-21 20:33:47 -05:00
Sunil Mohan Adapa
eada506b23
actions/*: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:39:36 +02:00
Sunil Mohan Adapa
dd5d93637f
backups: Don't send passphrase on the command line
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:54 +05:30
Joseph Nuthalapati
3a6dcbe7a7
Verify SSH hostkey before mounting
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:42:41 +05:30
Sunil Mohan Adapa
5e38b169b9
backups: Increase timeout for SSH operations to 30 seconds
It is easy to run into cases where SSH mounting takes more than 5 seconds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:08 -05:00
Sunil Mohan Adapa
01492895c4
backups: Fix incomplete download archives
- Downloaded archives can't be fully extracted as tar.gz is incomplete at the
  end and corrupt. This is due to complete gzip streaming implementation that is
  does not flush the final bytes of gzip stream. Remove custom implementation
  and get gzipped stream directly from borg.

- Fix mimetype for .tar.gz to application/gzip.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:32 -05:00
Sunil Mohan Adapa
eb2b3bd86e
backups: Minor refactoring
- Mark some methods private.

- Fix some flake8 warnings.

- Remove unused exception.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:29 -05:00
Sunil Mohan Adapa
de22c79665
backups: Minor styling fixes
- Run yapf

- Fix flake8 errors/warnings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:24 -05:00
Michael Pimmer
bb95229a91
Backups: unittests for accessing repository with borg directly
- adapt action and write tests for accessing a borg repo directly
  via borg+ssh, without mounting it
- some docstring updates

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:51 -05:00
Michael Pimmer
3724dac9e6
Backups: Cleanup and improved error handling
- fixes issues as supposed by jvalleroy
- new repositories always get a UUID so they can immediately be fully
  used (mounted, queried etc) also before saving them
- remove test connection page -- errors are shown on form submission
- improved error handling when creating remote repositories

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:24 -05:00
Michael Pimmer
eab8991b54
Backups: support for encrypted repositories
- implement download, restore, delete archives of encrypted
  repositories
- change how BorgRepository and SshBorgRepository handle path
- when/before creating remote repositories, check whether the
  connection works
- updated tests

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:17 -05:00
Michael Pimmer
c223250569
Backups: remove unittests to backups test directory
And add one bugfix to reset cfg.actions_dir after changing it

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:00 -05:00
Michael Pimmer
15e26caa23
Backups, remote repositories: create/delete/restore of remote repos
- updated unittests
- implemented create/delete/restore remote archives

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:48 -05:00
Michael Pimmer
cf6bbd6bba
Backups, remote repositories: use object-oriented repositories
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:42 -05:00
Michael Pimmer
3a8b69fc82
Backups, remote repositories: start using sshfs
- actions to mount/umount via sshfs
- tests

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:31 -05:00
Michael Pimmer
4be1b0be76
Backups, remote repositories: uniform parameter handling
- introduce env_vars in backups script and access_params for more
  uniform handling of access parameters
- added tests for creating and deleting an archive

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:27 -05:00
Michael Pimmer
0e2489ec23
Backups, remote repositories: implement init, info and some test
- added functionality to use remote repositories
- added some tests

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:22 -05:00
Michael Pimmer
4eeceaa695
Backups: allow testing the connection of ssh locations
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:27:17 -05:00
Michael Pimmer
e2584be45d
Backups: Make Manifest a dict instead of a list
So it's possible to add more information like metadata etc.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-18 13:58:41 -05:00
Michael Pimmer
8cc74bd203
Backups: minor cleanups
- some variable names, indentation and documentation changes
- removed unused backups action
- changed name of upload session variable to 'fbx-backups-upload-path'

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 09:00:26 -05:00
Michael Pimmer
1f9bb624e8
Backups: Stream archive downloads/exports
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 09:00:13 -05:00
Michael Pimmer
b92b66b7e9
Backups: clean up forms, names and templates
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:59 -05:00
Michael Pimmer
50e0bae67c
Backups: relative paths for borg extract in action script
'borg extract' expects relative paths as patterns for PATH(s)

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:46 -05:00
Michael Pimmer
35305d5e37
Backups: clean up exporting archives functionality
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:40 -05:00
Michael Pimmer
a350ab200e
Backups: Dont fail when borg doesn't find files to extract
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:35 -05:00
Michael Pimmer
c770a7adfb
Backups: Restore directly from archive
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:29 -05:00
Michael Pimmer
ff673b0d73
Backups: export and download archives in one step
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:03 -05:00
James Valleroy
edcf4a5619
backups: Handle permission error during chown
This happens on FAT file systems, where chown operation is not
possible.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-22 18:19:02 -04:00
Joseph Nuthalapati
6be6b847fd
backups: Make plinth the owner of the backup archives
Changing the ownership of the backup archives from "root" to "plinth" fixes the
permission errors when downloading backup archives.

Fixes #1402

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-22 18:17:01 -04:00
Joseph Nuthalapati
968f2a19ed
backups: Allow restoring backups with no files
This still makes sense because restoration might restore settings and state of
application being installed (to be implemented).

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-03 19:18:59 -04:00
James Valleroy
7817111928
backups: Create folder if needed during setup
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:45:29 +05:30
James Valleroy
4d8b3c145d
backups: Use backups API for restore
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:43:43 +05:30
James Valleroy
481a299250
backups: When restoring, only list apps included in backup
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:43:36 +05:30
Joseph Nuthalapati
5633fccaa3
backups: Check if paths exist before passing them to borgbackup
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:42:24 +05:30
James Valleroy
5c12403137
backups: Name borg repo folder more clearly
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:41:49 +05:30
James Valleroy
b272020e94
backups: Use paths from selected apps
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-09-24 19:41:05 +05:30
James Valleroy
04d14e276f
backups: Restore from exported archive
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-08-17 17:31:25 +05:30
James Valleroy
bd45de2915
backups: Add list of exported archives
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-08-17 17:31:15 +05:30
James Valleroy
ab9f961091
backups: Simplify export of backup archive files
- Allow selection of Root Filesystem or any removable drive.
- Export to FreedomBox-backups folder in selection location.
- Handle export location without / at the end

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-08-17 17:31:06 +05:30
James Valleroy
04fc74845a
backups: Move repository location under /var/lib
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-07-16 18:04:29 +05:30
James Valleroy
40607c84c8
backups: Set LANG=C.UTF-8 when extracting archive
This allows for filenames with unicode characters.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-07-16 18:04:20 +05:30
James Valleroy
c852cd824f
backups: New app to manage borgbackup archives
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-07-16 18:03:55 +05:30