1350 Commits

Author SHA1 Message Date
Jarek Kowalski
3531d6e92b server: pre-read request body to fix HTTP/2 deadlock (backported from master 2b029a4) v0.6.2 2020-08-16 11:50:38 -07:00
Jarek Kowalski
984480908b Updated documentation for v0.6.0 release (#525)
* cli: small tweaks to kopia server mode

  * print SHA256 certficate thumbprint for auto-generated certs.
  * client will accept both upper- and lowercase thumbprint values

* site: updated documentation for v0.6.0 release

Co-authored-by: Julio López <julio+gh@kasten.io>
v0.6.0
2020-08-10 21:11:48 -07:00
Jarek Kowalski
bb2434dc28 upload: auto-ignore kopia cache directories when creating snapshots (#524)
This creates a marker file named `.kopia-cache` in the directory
that is the root of cache. When the uploader finds this file, it will
treat the entire directory as if it were empty.

This allows excluding directory caches from entire home and root
directories.
2020-08-10 11:19:54 -07:00
Jarek Kowalski
505ab92e21 Support for repository sync (#522)
* blob: added DisplayName() method to blob.Storage

* cli: added 'kopia repo sync-to <provider>' which replicates BLOBs

Usage demo: https://asciinema.org/a/352299

Fixes #509

* implemented suggestion by Ciantic to fail sync if the destination repository is not compatible with the source

* cli: added 'kopia repo sync --must-exist'

This ensures that target repository is not empty, otherwise syncing to
an accidentally unmounted filesystem directory might copy everything
again.
2020-08-09 12:36:41 -07:00
Michal Guerquin
d0e631a7a7 fix typo in url (#523)
This makes the link render correctly.
2020-08-08 12:07:18 -07:00
Jarek Kowalski
b995a1d015 app: Disabled progress percentage display above 100% (#521)
Fixes #513
2020-08-07 21:03:55 -07:00
Jarek Kowalski
04fdd0105e Fix for policy manager not setting labels in some cases (#517)
* cli: fixed 'kopia policy rm' deleting global when passed policy ID

* policy: additional unit test coverage for policy manager

* fixed path parsing logic to avoid the use filepath package which is platform-dependent, added more tests
v0.6.0-rc4
2020-08-06 21:25:48 -07:00
Nick
8532e843cc Fix #516 - Chown not suported on Windows (#518)
Proposed fix for #516: Do not attempt to call `os.Chown` on Windows. The
command is unsupported on windows and will always return
`syscall.EWINDOWS`.

Handling for user ID and group ID on Windows already hardcodes
both values to zero. If a snapshot is restored with non-zero UID/GID
values (for instance if the snapshot was created on a different OS),
filesystem entries will be restored without changing UID/GID, resulting
in a state similar to how they would look if the snapshot was
taken on Windows in the first place.
2020-08-05 18:32:53 -07:00
Nick
7867513732 [Fix #519] Fix pack blob parse in TestRestoreFail (#520)
Fix parsing of pack blob ID by using a specific regex
instead of a strings.Contains. This prevents the test from
misidentifying other blob IDs as pack blobs, such as
`kopia.maintenance`.
2020-08-05 18:31:48 -07:00
Jarek Kowalski
9de7348a75 cli: auto-upgrade the repository to 0.6.0 (#512)
On first 'kopia snapshot' or 'kopia server' use where the 'maintenance'
manifest cannot be found, we create a default one and display usage
note.
2020-08-04 23:53:18 -07:00
Jarek Kowalski
04254b68db Upgrade build-time dependencies (#510)
* goreleaser: upgraded to v1.140.1
* site: upgrade to latest Hugo, fixed deprecation warnings
* app: upgraded NPM dependencies to latest version to address some low-severity vulnerabilities
2020-08-04 15:54:05 -07:00
Jarek Kowalski
eea6b466af maintenance: fixed scheduling of quick maintenance (#507)
* maintenance: fixed scheduling of quick maintenance

* Makefile: increase unit test timeouts
v0.6.0-rc3
2020-08-01 06:57:10 -07:00
Jarek Kowalski
fca8155283 update_check: clean up version numbers to always include 'v' prefix 2020-07-31 22:35:20 -07:00
Jarek Kowalski
bc0df1e58e app: removed extra 'v' from KopiaUI window captions 2020-07-31 22:35:20 -07:00
Jarek Kowalski
40acf238f3 Fixed arm and arm64 build. (#506)
* fixed a number of cases where misaligned data was causing panics on armv7 (but not armv8)
* travis: enable arm64
* test: reduce compressed data sizes when running on arm
* arm: wait longer for snapshots
v0.6.0-rc2
2020-07-30 17:31:28 -07:00
Jarek Kowalski
cfa30f2e45 switched back to using v-prefixed tag names.
KOPIA_VERSION will now always be v-prefixed and we will strip the
prefix before embedding it in KopiaUI manifest.

Also upgraded Node and app NPM dependencies to latest versions.
v0.6.0-rc1
2020-07-25 17:22:35 -07:00
Jarek Kowalski
ff244b54ff go.mod: upgrade github.com/klauspost/compress to v1.10.10
See https://github.com/klauspost/compress/issues/272#issuecomment-663567344

Fixes #490.
2020-07-24 08:23:16 -07:00
Jarek Kowalski
8ead49b779 restore: support for zip, tar and tar.gz restore outputs (#482)
* restore: support for zip, tar and tar.gz restore outputs

Moved restore functionality to its own package.

* Fix enum values in the 'mode' flag

Co-authored-by: Julio López <julio+gh@kasten.io>
2020-07-22 22:56:11 -07:00
Jarek Kowalski
52e763158b kopia-ui: fixed missing 'log' when clicking 'Launch At Startup' 2020-07-21 22:12:52 -07:00
Jarek Kowalski
7e9ce61f9e server: automatically flush the repository after setting or deleting a policy (#489)
Fixes #479
2020-07-20 20:59:21 -07:00
Jarek Kowalski
a544e0c32b kopia-ui: Added logging when waiting for notarization response from Apple.
Fixed #488
2020-07-18 15:49:15 -07:00
Jarek Kowalski
2c21582ef2 kopia-ui: added option to disable TLS and force HTTP
Fixes #476
2020-07-18 15:35:20 -07:00
Jarek Kowalski
73ed5adb01 kopia-ui: cleaned up console logging 2020-07-18 14:11:33 -07:00
darkdragon-001
8c941ccd4b Fix BUILD.md (#481)
Fix `make` command for `kopia-ui`.
2020-07-18 12:11:01 -07:00
Jarek Kowalski
0b2d12dfac kopia-ui: build deb and rpm packages
Fixes #478
2020-07-17 20:03:37 -07:00
Nick
ce5e6dcd13 [Robustness] Add first robustness tests
Add two tests:
- TestManySmallFiles: writes 100k files size 4k to a directory. Snapshots the data tree, restores and validates data.
- TestModifyWorkload: Loops over a simple randomized workload. Performs a series of random file writes to some random sub-directories, then takes a snapshot of the data tree. All snapshots taken during this test are restore-verified at the end.

A global test engine is instantiated in main_test.go, to be used in the robustness test suite across tests (saves time loading/saving metadata once per run instead of per test).
2020-07-14 22:37:11 -07:00
Nick
82a2fa0ea5 [Robustness] Add test engine to manage snapshot verification testing (#468)
* Add test engine to manage snapshot verification testing

Test engine manages the test and metadata repositories, snapshot
checker, metadata storage persistence, and file writer. It is
the high level helper that will be invoked in the snapshot
verification testing suite.

- modify data directory file structure
- issue snapshot/restore/delete to the data directory
- accumulate metadata over the course of the test suite
- flush accumulated metadata to the metadata repository
- load historical metadata from the repository on initialization
- perform automatic data integrity verification on snap restore

This change corresponds to the robustness execution engine component from the design documentation.
2020-06-27 23:46:37 -07:00
Jarek Kowalski
d44c01fabb content: do not short circuit compaction if there's one index but there are contents to delete 2020-06-24 08:39:56 -07:00
Jarek Kowalski
64a6cb42dc parallelwork: fixed error handling, which caused parallel work to never finish on any error 2020-06-24 08:39:56 -07:00
Jarek Kowalski
1c2534199c cli: fixed panic() during snapshot verification caused by refactoring to new Repository interface 2020-06-24 08:39:56 -07:00
Jarek Kowalski
3843ed6727 cli: added content verify --include-deleted flag 2020-06-24 08:39:56 -07:00
Jarek Kowalski
ed9511bae1 b2: fix GetMetadata() implementation
Fixes #459
2020-06-08 19:00:51 -07:00
Jarek Kowalski
25934a544d content: fixed deletion of cleanup blobs (#462)
* content: ensure that cleanup blobs have unique contents to prevent situation where they keep getting rewritten and thus never deleted

* cli: added '--decrypt' option to 'kopia blob show'
2020-06-08 08:14:01 -07:00
Jarek Kowalski
79757672ca server: implemented 'flush' and 'refresh' API
Added test that verifies that when client performs Flush (which happens
at the end of each snapshot and when repository is closed), the
server writes new blobs to the storage.

Fixes #464
2020-06-07 19:38:13 -07:00
Jarek Kowalski
293cb10471 cosmetic changes to maintenance behavior (#461)
- run maintenance even if the command is about to return an error
  (otherwise if folks have persistent error causing snapshots to fail
  they will never run maintenance)
- disable progress output after snapshotting so that
  'kopia snapshot --all' output is clean
2020-06-01 23:38:18 -07:00
Pavan Navarathna
c13b5f820f Remove extra whitespaces and fix minor typos (#460) 2020-06-01 13:40:57 -07:00
Samuel BENARD
85aa4ae6e5 Add 'repositories' page (#454)
Add sftp and webdav as repositories to "Getting started" documentation page, "Setting Up Repository" chapter.

Add repositories list and usage examples to doc.
2020-06-01 01:08:58 -07:00
Julio Lopez
deb1099c52 Trivial: remove unused logging.Option type 2020-06-01 00:59:51 -07:00
Jarek Kowalski
6bc47cb399 content: emit warning whenever the number of index blobs gets too high, which is an indication that maintenance has not run in a long time 2020-06-01 00:57:32 -07:00
Jarek Kowalski
960c33475e maintenance: disabled automatic compaction on repository opening
instead moved to run as part of maintenance ('kopia maintenance run')

added 'kopia maintenance run --force' flag which runs maintenance even
if not owned
2020-06-01 00:57:32 -07:00
Julio López
6cb970f156 Revert "Fix #360: Leverage Go 1.14 testing.T.Cleanup() (#455)" (#458)
This reverts commit 73b913c (#455)

Pulled the trigger too soon.
2020-05-31 22:39:39 -07:00
Julio López
73b913c406 Fix #360: Leverage Go 1.14 testing.T.Cleanup() (#455)
Revert "testing: ensure cleanup of content managers, fixes #356" (commit 06fbaba)
Re-applies commit 9a3e1e1

Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
2020-05-31 22:11:41 -07:00
Nick
b30da511e7 Wire up snapshot-store-compare behavior
Connect the snapshotter, the storer, and the comparer. Invoke
the snapshotter to take/restore/delete snapshots on the repo,
the comparer to gather metadata before the snapshot and
after the restore, and the storer to save metadata for later
lookup when verifying restores.
2020-05-31 21:12:31 -07:00
Jarek Kowalski
d68273a576 Improvements for dealing with eventually-consistent stores (S3) (#437)
* content: added support for cache of own writes

Thi keeps track of which blobs (n and m) have been written by the
local repository client, so that even if the storage listing
is eventually consistent (as in S3), we get somewhat sane behavior.

Note that this is still assumming read-after-create semantics, which
S3 also guarantees, otherwise it's very hard to do anything useful.

* compaction: support for compaction logs

Instead of compaction immediately deleting source index blobs, we now
write log entries (with `m` prefix) which are merged on reads
and applied only if the blob list includes all inputs and outputs, in
which case the inputs are discarded since they are known to have been
superseded by the outputs.

This addresses eventual consistency issues in stores such as S3,
which don't guarantee list-after-put or list-after-delete. With such
stores the repository is ultimately eventually consistent and there's
not much that can be done about it, unless we use second strongly
consistent storage (such as GCS) for the index only.

* content: updated list cache to cache both `n` and `m`

* repo: fixed cache clear on windows

Clearing cache requires closing repository first, as Windows is holding
the files locked.

This requires ability to close the repository twice.

* content: refactored index blob management into indexBlobManager

* testing: fixed blobtesting.Map storage to allow overwrites

* blob: added debug output String() to blob.Metadata

* testing: added indexBlobManager stress test

This works by using N parallel "actors", each repeatedly performing
operations on indexBlobManagers all sharing single eventually consistent
storage.

Each actor runs in a loop and randomly selects between:

- *reading* all contents in indexes and verifying that it includes
  all contents written by the actor so far and that contents are
  correctly marked as deleted
- *creating* new contents
- *deleting* one of previously-created contents (by the same actor)
- *compacting* all index files into one

The test runs on accelerated time (every read of time moves it by 0.1
seconds) and simulates several hours of running.

In case of a failure, the log should provide enough debugging
information to trace the exact sequence of events leading up to the
failure - each log line is prefixed with actorID and all storage
access is logged.

* makefile: increase test timeout

* content: fixed index blob manager race

The race is where if we delete compaction log too early, it may lead to
previously deleted contents becoming temporarily live again to an
outside observer.

Added test case that reproduces the issue, verified that it fails
without the fix and passed with one.

* testing: improvements to TestIndexBlobManagerStress test

- better logging to be able to trace the root cause in case of a failure
- prevented concurrent compaction which is unsafe:

The sequence:

1. A creates contentA1 in INDEX-1
2. B creates contentB1 in INDEX-2
3. A deletes contentA1 in INDEX-3
4. B does compaction, but is not seeing INDEX-3 (due to EC or simply
   because B started read before #3 completed), so it writes
   INDEX-4==merge(INDEX-1,INDEX-2)
   * INDEX-4 has contentA1 as active
5. A does compaction but it's not seeing INDEX-4 yet (due to EC
   or because read started before #4), so it drops contentA1, writes
   INDEX-5=merge(INDEX-1,INDEX-2,INDEX-3)
   * INDEX-5 does not have contentA1
7. C sees INDEX-5 and INDEX-5 and merge(INDEX-4,INDEX-5)
   contains contentA1 which is wrong, because A has been deleted
   (and there's no record of it anywhere in the system)

* content: when building pack index ensure index bytes are different each time by adding 32 random bytes
2020-05-31 17:11:20 -07:00
Jarek Kowalski
9123e3ebff cli: 'kopia server' made --ui default (#452) 2020-05-25 19:09:26 -07:00
Julio López
130712a1b4 Remove unused content.Manager.closed channel (#451) 2020-05-25 11:10:45 -07:00
Jarek Kowalski
e445dc5e61 repo: moved creating cache directory from connect to first use (#450) 2020-05-22 10:08:48 -07:00
Julio Lopez
fff2b44e19 Upgrade AWS SDK to 1.31.3 from 1.31.1
Change log:

https://github.com/aws/aws-sdk-go/releases

Notably:

SDK Bugs
service/s3/s3crypto: Add missing return in encryption client (#3258)
Fixes a missing return in the encryption client that was causing a nil
dereference panic.
2020-05-21 16:12:13 -07:00
Julio Lopez
0642b261a3 Upgrade github.com/klauspost/compress to 1.10.6
Change log:
https://github.com/klauspost/compress/releases
2020-05-21 16:12:13 -07:00
Julio Lopez
0afd1a5424 Upgrade github.com/minio/minio 2020-05-21 16:12:13 -07:00