Commit graph

342 commits

Author SHA1 Message Date
Alexander Neumann
d2813ea61b
Merge pull request #151 from restic/add-socket-activation
Support running on demand via systemd
2021-08-17 21:39:42 +02:00
Alexander Neumann
f90205eefe Support running on demand systemd socket activation 2021-08-17 21:37:02 +02:00
Alexander Neumann
32784a3072 Run tests on Go 1.17 2021-08-17 21:35:39 +02:00
Alexander Neumann
05773795dd
Merge pull request #142 from MichaelEischer/atomic-upload
Atomic file upload and directory sync
2021-08-17 20:32:33 +02:00
Alexander Neumann
0bd1f612d2
Merge pull request #154 from JsBergbau/master
Updated self-signed certificate creation
2021-08-17 20:27:39 +02:00
JsBergbau
a5b306e65b
Updated self-signed certificate creation 2021-08-17 11:26:23 +02:00
Michael Eischer
64a43228de Prefix temporary file with object id 2021-08-12 22:17:49 +02:00
Michael Eischer
28f569c0df Add changelog 2021-08-12 22:15:08 +02:00
Alexander Neumann
04d206303c Add test for race condition with aborted connection 2021-08-12 22:15:08 +02:00
Alexander Neumann
e6cc79a2ec Fix comment 2021-08-12 22:14:36 +02:00
Alexander Neumann
7fe16b69b2 Mark helper functions 2021-08-12 22:14:36 +02:00
Michael Eischer
ec0766cddd Don't sync directory on Windows
Calling sync on a directory on Windows just returns "The handle is invalid"
and fails.
2021-08-12 22:14:36 +02:00
Michael Eischer
2175029c9e Sync directory to disk after upload
After a file was uploaded, also sync its containing directory to disk to
make sure that also the directory entry is persisted after a system
crash.
2021-08-12 22:08:08 +02:00
Michael Eischer
82816c67e1 Atomic upload for blobs
A upload is now first saved to a temporary file before it gets renamed
to the final filename. This ensures that incomplete uploads don't leave
broken files behind (at least not under their real filename).

In addition, removing failed uploads is no longer prone to a race
condition with a retried upload. That scenario could occur when the
first upload fails partway and the server doesn't notice that
immediately. A later retry by restic will then delete the broken upload
and upload the file again. If the server notices now that the initial
upload has failed, then it will delete the correctly uploaded file.

This has been fixed by only ever deleting the temporary file during
upload.
2021-08-12 22:06:08 +02:00
Alexander Neumann
4db46a5d3d Check error 2021-08-11 14:32:10 +02:00
Alexander Neumann
39839cfac4
Merge pull request #135 from MichaelEischer/cpu-profile-shutdown
Properly close CPU profile on SIGINT
2021-08-11 14:27:52 +02:00
Alexander Neumann
5e71f61ae8
Merge pull request #130 from MichaelEischer/verify-upload
Verify uploaded files
2021-08-11 14:21:51 +02:00
Alexander Neumann
4c8a076976 Reword changelog 2021-08-09 16:28:09 +02:00
Michael Eischer
16889717c6 Add option to disable integrity check on upload 2021-08-09 15:40:50 +02:00
Michael Eischer
54adcb1fc7 Verify uploaded files
Restic uses the sha256 hash to calculate filenames based on the file
content. Check on the rest-server side that the uploaded file is intact
and reject it otherwise.
2021-08-09 15:35:13 +02:00
Alexander Neumann
96a6f0a5c4 Use Cobra for showing the version 2021-08-09 11:31:54 +02:00
Alexander Neumann
28c0b95b8a Upgrade dependencies 2021-08-09 11:31:51 +02:00
Alexander Neumann
d39bc8e6cf
Merge pull request #112 from wojas/split-repo-handler
Split Server component and add support for subrepositories
2021-08-09 10:55:29 +02:00
Alexander Neumann
034302de95 Remove goji dependency 2021-08-09 10:50:44 +02:00
Alexander Neumann
ba9ee5c625 Address linter issues 2021-08-09 10:49:41 +02:00
Alexander Neumann
4e36854cd4 Fix typo 2021-08-09 10:49:41 +02:00
Konrad Wojas
e3b1c5d612 Metrics: require user 'metrics' for private repo mode
To match previous behaviour, require username 'metrics' when private
repo mode is enabled.
2021-08-09 10:49:41 +02:00
Konrad Wojas
aef955c513 Update readme 2021-08-09 10:49:41 +02:00
Konrad Wojas
ff88e6812d Update readme and changelog 2021-08-09 10:49:41 +02:00
Konrad Wojas
9db2d52fbe Prometheus: keep auth by default
Restore the previous behaviour where the Prometheus /metrics endpoint
required auth if auth was enabled.

A new -prometheus-no-auth flag allows you to override this and disable
auth for that specific endpoint.
2021-08-09 10:49:41 +02:00
Konrad Wojas
32c138aa84 Add tests for subrepos 2021-08-09 10:49:41 +02:00
Konrad Wojas
73a6000f10 Fix typo in error message 2021-08-09 10:49:41 +02:00
Konrad Wojas
e957e42336 Return more useful error 2021-08-09 10:49:41 +02:00
Konrad Wojas
c2958906ea Fix TestSplitURLPath 2021-08-09 10:49:41 +02:00
Konrad Wojas
63c8797ba3 Fix tests, add PanicOnError option
- Helper method for internal server errors with consistent logging.
- Add PanicOnError option to panic on internal server errors. This
  makes it easier to traces where the condition was hit in testing.
2021-08-09 10:49:41 +02:00
Konrad Wojas
d4cd47e503 Minor cleanup and fixes
- Do not allow '.' as path component, because it undermines depth
  checks, and add tests
- Fix GiB reporting
- Fix metrics label
- Helper function for http errors
2021-08-09 10:49:41 +02:00
Konrad Wojas
1f593fafaf Make Server use the new repo.Handler
This contains all the glue to make Server use the new repo.Handler:

- Remove all old handlers
- Add ServeHTTP to make Server a single http.Handler
- Remove Goji routing and replace by net/http and custom routing logic

Additionally, this implements two-level backup repositories.
2021-08-09 10:49:41 +02:00
Konrad Wojas
55e549e92c Move maxsizewriter to quota package 2021-08-09 10:49:41 +02:00
Konrad Wojas
79a8785e26 Implement repo.Handler
Refactor the old HTTP handlers to fit the purpose of the new
http.Handler:

- repo.New function to instantiate a handler for a single repo (can be done
  dynamically for every request)
- Single ServeHTTP entrypoint
- Move quota management to two methods that will be implemented later
  (stubs for now)
- Move metrics update to an external function (BlobMetricFunc type)
- Use constants and options for file modes
2021-08-09 10:49:41 +02:00
Konrad Wojas
7f14414363 Add repo package with copy of old handlers.go
Copy the old handlers.go without changes for cleaer diff of
changes later.
2021-08-09 10:49:41 +02:00
Alexander Neumann
bcbfff7b62 Update Go and golangci-lint version 2021-08-09 10:48:58 +02:00
MichaelEischer
c36ae5fe03
Merge pull request #149 from tim-seoss/systemd-unit-file-enhancement
Improve security of example systemd unit file
2021-06-05 14:37:42 +02:00
Tim Small
2bf01df6bf Fixup changelog entry based on feedback. 2021-05-31 11:46:31 +01:00
Tim Small
d1e56e80ee Remove ProcSubset=pid to allow access to /proc/stat etc. 2021-05-31 11:46:31 +01:00
Tim Small
4967dcbf74 Document and sign-post additional systemd resource control options.
The systemd administrator may wish to use additional resource control
facilities which systemd provides. Document the existence of these, and
provide some example options in commented form.
2021-05-31 11:46:31 +01:00
Tim Small
8a1535ba0c Improve commenting of systemd unit file based on review. 2021-05-31 11:46:06 +01:00
MichaelEischer
1ca9ca7e50
Merge pull request #124 from lwis/update-docker
Fix Docker configuration for DISABLE_AUTHENTICATION
2021-05-15 18:39:42 +02:00
Michael Eischer
766f1e0c00 Revert dockerfile changes and cleanup changelog 2021-05-15 18:31:01 +02:00
Lewis Juggins
cec241e5e1 Fix Docker configuration for authentication 2021-05-15 18:28:31 +02:00
MichaelEischer
a44c025cd3
Merge pull request #145 from jinnko/master
Build restic at container build time
2021-05-13 20:00:20 +02:00