Compare commits

...
Author SHA1 Message Date
Michael Barz bf20509bcf Automated changelog update [skip ci] 2025-03-07 00:04:13 +00:00
Michael Barz 96f0d1c2ab Automated changelog update [skip ci] 2025-03-06 00:03:14 +00:00
Michael Barz beb9c4ebc3 Automated changelog update [skip ci] 2025-02-25 00:04:29 +00:00
Michael Barz db54c8f9f6 Automated changelog update [skip ci] 2025-02-24 00:06:11 +00:00
Michael Barz 4400412746 Automated changelog update [skip ci] 2025-02-22 00:05:37 +00:00
Michael Barz 81587d59b0 Automated changelog update [skip ci] 2025-02-19 00:36:26 +00:00
Michael Barz 3008f53ea0 Automated changelog update [skip ci] 2025-02-18 00:36:04 +00:00
Michael Barz 28d1819bac Automated changelog update [skip ci] 2025-02-17 00:35:27 +00:00
Michael Barz f502234b7b Automated changelog update [skip ci] 2025-02-12 00:55:35 +00:00
Michael Barz 5f48d98624 Automated changelog update [skip ci] 2025-02-11 00:54:32 +00:00
Michael Barz 31a03a9aef Automated changelog update [skip ci] 2025-02-09 00:54:43 +00:00
Michael Barz cbd32b1ad9 Automated changelog update [skip ci] 2025-02-08 00:55:32 +00:00
Michael Barz 2c5d0c34fc Automated changelog update [skip ci] 2025-02-04 00:56:01 +00:00
Michael Barz 716b948c3c Automated changelog update [skip ci] 2025-02-03 00:54:24 +00:00
Michael Barz 19b2247186 Automated changelog update [skip ci] 2025-02-01 00:56:12 +00:00
Michael Barz 2f4a131acb Automated changelog update [skip ci] 2025-01-31 00:57:51 +00:00
Michael Barz 007a24815f Automated changelog update [skip ci] 2025-01-28 00:55:19 +00:00
Michael Barz d82c29d7bb Automated changelog update [skip ci] 2025-01-23 00:28:02 +00:00
Michael Barz a26e18c6d6 Automated changelog update [skip ci] 2025-01-22 07:50:46 +00:00
Michael Barz ff4dd0406a Automated changelog update [skip ci] 2025-01-18 00:27:28 +00:00
Michael Barz bfd6496740 Automated changelog update [skip ci] 2025-01-08 00:33:28 +00:00
Michael Barz cf6f8aa397 Automated changelog update [skip ci] 2024-11-14 12:32:59 +00:00
Michael Barz ffc8a85383 Merge pull request #10568 from owncloud/release-5.0.9
[full-ci] chore: prepare release, bump version
2024-11-14 13:32:22 +01:00
Michael Barz 0721bd31fc chore: prepare release, bump version 2024-11-14 12:22:33 +01:00
kobergj 2c97c90edf Automated changelog update [skip ci] 2024-11-05 12:34:39 +00:00
kobergj 0ee36ee73d Merge pull request #10458 from kobergj/BackportRestartPPReworked
[full-ci] Backport Restart Postprocessing
2024-11-05 13:31:06 +01:00
jkoberg 0e75793305 docs(postprocessing): update docs
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-11-04 14:24:29 +01:00
jkoberg c546ac5b1f fix(postprocessing): restart postprocessing properly
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-11-04 14:24:19 +01:00
Michael Barz b890d7277c Automated changelog update [skip ci] 2024-10-17 10:01:46 +00:00
Michael Barz 4a18dc56b3 Merge pull request #10270 from rhafer/backport/5.0/thumbnailer
Backport thumbnailer fixes to stable-5.0
2024-10-17 12:01:12 +02:00
Viktor Scharf 6b7bc90f2a Automated changelog update [skip ci] 2024-10-15 00:13:09 +00:00
Viktor Scharf 8f85097d7c Automated changelog update [skip ci] 2024-10-12 01:09:08 +00:00
Ralf Haferkamp 2d108636e9 fix(webdav): Set Retry-After header for 429 responses
We're now setting a 'Retry-After' in the webdav response when the
thunbnailer is rate limiting the requests. For now the timeout is just
a random number between 1 and 15 seconds.

(cherry picked from commit f536dacd4d)
2024-10-10 17:12:30 +02:00
Ralf Haferkamp cd82257487 fix(webdav): missing Status 429 handling in some thumbnail endpoints
(cherry picked from commit 74d54579cb)
2024-10-10 17:11:38 +02:00
Viktor Scharf f285c1da3c Automated changelog update [skip ci] 2024-10-10 00:09:17 +00:00
Ralf Haferkamp a4f27e5407 fix(thumbnails): Implement ratelimit for the grpc service
This moves the ratelimit ('THUMBNAILS_MAX_CONCURRENT_REQUESTS') from the
HTTP endpoint to the GRPC endpoint. The HTTP endpoint is just used for
downloading already created thumbnails. But the resource consuming part of
thumbnail generation happens in the GRPC service.

(cherry picked from commit e2d7251893)
2024-10-09 14:23:02 +02:00
Ralf Haferkamp d0ab77c014 add thumbnailer backport PR to changelog 2024-10-09 11:44:41 +02:00
Benedikt Kulmann 916d0675e4 fix: thumbnail max input height
Thumbnail max input width and height need to be the same, because images
can be portrait or landscape. See https://github.com/owncloud/ocis/issues/9234

(cherry picked from commit 6117e19d4f)
2024-10-09 11:33:48 +02:00
Thomas Müller 380ca73007 feat: add maximum image file size to be processed by the thumbnailer (#9069)
(cherry picked from commit 06bb8c9654)
2024-10-09 11:33:02 +02:00
Thomas Müller df77832524 feat: add maximum image dimension to be processed by the thumbnailer (#9035)
* feat: add maximum image dimension to be processed by the thumbnailer

* chore: make golangci-lint happy

(cherry picked from commit 9db3fd028e)
2024-10-09 11:30:25 +02:00
Viktor Scharf 43cc735071 Merge pull request #10192 from owncloud/deleteCodingStandartPhpStepFromCIIftag
[test-only] do not run coding standart php step when releasing
2024-10-01 11:14:32 +02:00
Viktor Scharf 962a4a4fd6 do not run coding standart php step when releasing 2024-09-30 17:45:48 +02:00
Viktor Scharf e394ae2185 Automated changelog update [skip ci] 2024-09-30 15:28:31 +00:00
Viktor Scharf 78c616213e Merge pull request #10191 from owncloud/release-5.0.8
[full-ci]bump version, prepare changelog
2024-09-30 17:27:50 +02:00
Viktor Scharf 2c8ff56ae6 bump version, prepare changelog 2024-09-30 16:48:23 +02:00
Christian Richter d11f5c052b Automated changelog update [skip ci] 2024-09-25 00:05:45 +00:00
Christian Richter a5ca5ed33d Automated changelog update [skip ci] 2024-09-24 00:42:45 +00:00
Christian Richter 264fa18cfd Automated changelog update [skip ci] 2024-09-23 15:02:57 +00:00
Christian Richter 42f5177368 Merge pull request #10138 from owncloud/stable5/bump-reva-to-2.19.8
bump reva to 2.19.8
2024-09-23 15:02:25 +00:00
Jörn Friedrich Dreyer d797fe7c8f bump reva to 2.19.8
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-09-23 16:10:42 +02:00
Jörn Friedrich Dreyer fc35a9ec28 Automated changelog update [skip ci] 2024-09-21 00:44:01 +00:00
Jörn Friedrich Dreyer 2be55fb787 Merge pull request #10103 from owncloud/backport/stable5/bump-reva-f246d1b82fd6
[full-ci] stable 5 - bump reva to f246d1b82fd6
2024-09-20 11:34:24 +02:00
Michael Barz 39dfdea218 Automated changelog update [skip ci] 2024-09-20 00:46:04 +00:00
Jörn Friedrich Dreyer a725c82d54 bump sonarcloud cli 5.0 -> 11.0
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-09-19 13:40:22 +02:00
Jörn Friedrich Dreyer eca7007574 bump reva to f9a75a1a9fd4
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-09-19 11:38:01 +02:00
Jörn Friedrich Dreyer be5f039f0b tests should expect correct filename* values
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-09-19 11:05:49 +02:00
Michael Barz 3af07a0aff Automated changelog update [skip ci] 2024-09-19 00:44:07 +00:00
Jörn Friedrich Dreyer f3772d10ad bump reva to f246d1b82fd6
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-09-18 16:38:11 +02:00
Michael Barz 52074362ab Automated changelog update [skip ci] 2024-09-18 00:41:17 +00:00
Michael Barz c140e7264a Automated changelog update [skip ci] 2024-09-17 00:07:05 +00:00
Michael Barz 4891d859e1 Automated changelog update [skip ci] 2024-09-15 00:09:12 +00:00
Michael Barz 30e2446935 Automated changelog update [skip ci] 2024-09-13 00:09:01 +00:00
Michael Barz ee015b23c3 Automated changelog update [skip ci] 2024-09-11 00:39:28 +00:00
Michael Barz bc61e96600 Automated changelog update [skip ci] 2024-09-10 00:40:25 +00:00
Michael Barz 67354a3436 Automated changelog update [skip ci] 2024-09-09 00:39:30 +00:00
Michael Barz 738222ff1b Automated changelog update [skip ci] 2024-09-05 06:19:33 +00:00
Michael Barz f70fe4ada3 Merge pull request #9979 from owncloud/release-5.0.7
[full-ci] chore: bump version, prepare changelog
2024-09-05 08:19:03 +02:00
Michael Barz a3951fb153 Automated changelog update [skip ci] 2024-09-05 03:46:58 +00:00
Michael Barz de129fee16 chore: bump version, prepare changelog 2024-09-04 13:23:59 +02:00
Michael Barz ca815b0704 Automated changelog update [skip ci] 2024-09-04 00:38:44 +00:00
Michael Barz c17423adcd Automated changelog update [skip ci] 2024-09-03 04:48:31 +00:00
Michael Barz 3f2ba604cc Automated changelog update [skip ci] 2024-09-02 14:39:50 +00:00
Michael Barz 46c46eb48c Merge pull request #9963 from owncloud/stable-latest
chore: add latest manifest to stable tag
2024-09-02 15:30:40 +02:00
Michael Barz e060eb8b44 chore: add latest manifest to stable tag 2024-09-02 13:14:16 +02:00
Michael Barz 9fc5d89bc7 Automated changelog update [skip ci] 2024-09-02 10:09:30 +00:00
Michael Barz d046d5e726 Merge pull request #9958 from owncloud/bump-web-8.0.5
[full-ci] chore: bump ownCloud Web to v8.0.5
2024-09-02 12:08:56 +02:00
Jannik Stehle 552941184a chore: bump ownCloud Web to v8.0.5 2024-09-02 10:36:32 +02:00
kobergj 3e40c278a7 Automated changelog update [skip ci] 2024-09-02 00:05:13 +00:00
kobergj a2e642aead Automated changelog update [skip ci] 2024-09-01 00:06:55 +00:00
kobergj 58447b3e96 Automated changelog update [skip ci] 2024-08-31 00:06:43 +00:00
kobergj 2fbb6c9933 Automated changelog update [skip ci] 2024-08-30 00:04:34 +00:00
kobergj c04f3dad0d Automated changelog update [skip ci] 2024-08-29 00:04:45 +00:00
kobergj 89754fd412 Automated changelog update [skip ci] 2024-08-28 00:04:43 +00:00
kobergj ef277d3267 Automated changelog update [skip ci] 2024-08-27 00:04:49 +00:00
kobergj 94aee2d367 Automated changelog update [skip ci] 2024-08-26 03:42:22 +00:00
kobergj ed48814009 Automated changelog update [skip ci] 2024-08-25 00:53:43 +00:00
kobergj 42e7220528 Automated changelog update [skip ci] 2024-08-24 00:53:50 +00:00
kobergj db41f46697 Automated changelog update [skip ci] 2024-08-19 12:48:31 +00:00
kobergj 621ec66baf Merge pull request #9831 from kobergj/BackportSessionCommand
[full-ci] Backport Sessions Command
2024-08-19 14:47:59 +02:00
Martin 690175236c Merge pull request #9847 from owncloud/make_volumes_configurable
[docs-only][stable-5.0] ocis_wopi deployment example, make data and config volumes configurable
2024-08-19 14:00:02 +02:00
mmattel 2b755c39bf [docs-only][stable-5.0] Deployment example, make data and config paths configurable 2024-08-19 10:59:21 +02:00
jkoberg 204ff6574b feat(ocis): backport adjustments
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-16 16:13:07 +02:00
jkoberg 8a1241bb3c feat(storage-users): document sessions command
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-16 11:28:33 +02:00
jkoberg 39ef9d92e1 feat(storage-users): add virusfilter to sessions command
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-16 11:28:21 +02:00
jkoberg 7678fa2f92 feat(storage-users): assimilate clean command into sessions
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-16 11:28:08 +02:00
Benedikt Kulmann caecf781e3 Automated changelog update [skip ci] 2024-07-17 09:51:32 +00:00
Benedikt Kulmann 66c1249921 Merge pull request #9629 from owncloud/release-5.0.6
[full-ci] version bump for release 5.0.6
2024-07-17 11:50:56 +02:00
Benedikt Kulmann a701bbc8db chore: version bumpf for release 5.0.6 2024-07-17 10:07:35 +02:00
Martin c262be77ec Merge pull request #9599 from owncloud/5.0_render_template_fix_for_deprecations
[docs-only] [5.0] Docs adoc template: make a space between deprecations and standard
2024-07-12 18:02:54 +02:00
MartinandPhil Davis 79f929236c Update docs/templates/ADOC.tmpl
Co-authored-by: Phil Davis <phil@jankaritech.com>
2024-07-12 16:18:19 +02:00
mmattel 105df0c8e4 [docs-only] [5.0] Docs adoc template: make a space between deprecations and standard 2024-07-12 16:13:05 +02:00
Viktor Scharf b4f5957e71 Merge pull request #9579 from owncloud/fixtestinbucketDocs
[docs-only] change Setup Inbucket testing docs
2024-07-11 05:41:13 +02:00
Viktor Scharf 263921591b Update testing.md 2024-07-10 12:43:36 +02:00
Viktor Scharf 5d1059e4ff change Setup Inbucket docs 2024-07-10 12:39:27 +02:00
Roman Perekhod 0497062d0d Automated changelog update [skip ci] 2024-07-10 09:37:40 +00:00
Roman Perekhod 23329bc86a Merge pull request #9514 from 2403905/issue-9402-5.0-bakport
fixed the notification service error when the user's display name con…
2024-07-10 11:37:07 +02:00
Martin 6496fec15b Merge pull request #9577 from owncloud/banned_pwd_text_for_stable_5
[docs-only] [5.0] Make the envvar text for the banned pwd list more precise
2024-07-10 11:31:25 +02:00
MartinandChristian Richter 69bdc34b6e Apply suggestions from code review
Co-authored-by: Christian Richter <1058116+dragonchaser@users.noreply.github.com>
2024-07-10 10:58:50 +02:00
mmattel 7d8fe2c44d [docs-only] [5.0] Make the envvar text for the banned pwd list more precise 2024-07-10 10:46:11 +02:00
Roman Perekhod 93b14bc454 fixed the notification service error when the user's display name contained special characters 2024-07-10 09:49:32 +02:00
Christian Richter 0f89f2b7fd Automated changelog update [skip ci] 2024-07-09 13:58:54 +00:00
Christian Richter 0c97d3edd0 Merge pull request #9562 from dragonchaser/backport-purge-revision-to-5.0.5
Backport purge revision to 5.0.5
2024-07-09 13:57:47 +00:00
Christian Richter 9355cc5912 remove not backported readme references
Signed-off-by: Christian Richter <crichter@owncloud.com>
2024-07-09 14:47:36 +02:00
Christian Richter 53553a9bfd disable vuln-check temporarily
Signed-off-by: Christian Richter <crichter@owncloud.com>
2024-07-09 14:45:36 +02:00
kobergjandMartin 315f52328d feat(docu): improve docu
Co-authored-by: Martin <github@diemattels.at>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-09 09:06:26 +02:00
jkoberg f8e5175df5 docu(ocis): document the new commands
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-09 09:06:18 +02:00
jkoberg 077e56e2c7 feat(ocis): make purge-revision work per resource
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-09 09:06:08 +02:00
jkoberg 624f681ce6 feat(ocis): add purge-revision cli
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-09 09:06:00 +02:00
Jannik Stehle 214491134f Automated changelog update [skip ci] 2024-07-02 10:58:14 +00:00
Jannik Stehle 4a57e98780 Merge pull request #9510 from owncloud/bump-web-8.0.4
[full-ci] chore: bump ownCloud Web to v8.0.4
2024-07-02 12:56:21 +02:00
Jannik Stehle c443dc68a0 chore: bump ownCloud Web to v8.0.4 2024-07-02 11:38:40 +02:00
Michael Barz f47c387133 Automated changelog update [skip ci] 2024-07-02 08:49:32 +00:00
Michael Barz 4e1e529ef0 Merge pull request #9506 from kobergj/BackportPostprocessingRestart
[Backport] Repair Postprocessing Bulk Restart
2024-07-02 10:47:46 +02:00
jkoberg 4decd85767 build(deps): bump golang.org/x/image from 0.16.0 to 0.18.0
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-01 16:36:39 +02:00
jkoberg 4722b63514 fix(postprocessing): fix multi-restart
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-07-01 16:35:44 +02:00
Martin c74c8d31f3 Merge pull request #9469 from owncloud/fix_ocis_wopi_env_settings
Fix ocis wopi env settings
2024-07-01 14:46:07 +02:00
Michael BarzandMartin 6c246fb56d Update deployments/examples/ocis_wopi/.env
Co-authored-by: Martin <github@diemattels.at>
2024-07-01 13:37:03 +02:00
Michael Barz d661296c04 Fix monitoring compose 2024-06-30 20:58:55 +02:00
mmattel a10cfe188d fix backticks 2024-06-25 18:01:49 +02:00
mmattel 5f89a7de98 [docs-only] [5.0] Small fixes for the ocis_wopi .env file 2024-06-25 17:52:40 +02:00
Michael Barz b77ef1a4b2 Automated changelog update [skip ci] 2024-06-21 12:32:58 +00:00
Michael Barz 8b846ca1c8 Merge pull request #9429 from owncloud/bump-web-8.0.3
[full-ci] chore: bump ownCloud Web to v8.0.3
2024-06-21 14:32:07 +02:00
Jannik Stehle 63121b7f37 chore: bump ownCloud Web to v8.0.3 2024-06-21 09:17:19 +02:00
Michael Barz f6bd1ad16e Merge pull request #9425 from phil-davis/refactor_ocis_wopi_deployment-2
[docs-only] [5.0] Adjust some text in ocis_wopi example
2024-06-20 19:12:02 +02:00
Phil Davis 10c189d86c [docs-only] [5.0] Adjust some text in ocis_wopi example 2024-06-20 21:31:21 +05:45
Michael Barz 87c3384ab1 Merge pull request #9412 from owncloud/refactor_ocis_wopi_deployment
[docs-only] [5.0] Refactor the 'ocis_wopi' deployment example
2024-06-20 17:00:33 +02:00
Michael Barz 4ab23b0df5 feat: make ocis selectable 2024-06-20 13:58:19 +02:00
Michael Barz 6446f513bb fix: simplify one more time 2024-06-20 12:17:21 +02:00
mmattel 14db9274c8 update traefik to 3.0.3 2024-06-19 16:43:01 +02:00
mmattel 58c3caae07 [5.0] Refactor the 'ocis_wopi' deployment example 2024-06-19 12:01:16 +02:00
Martin c6aab01486 Merge pull request #9387 from owncloud/fix_typo_in_5.0
[docs-only] [5.0] Fix typo and rerun make docs-generate
2024-06-14 13:51:14 +02:00
MartinandPhil Davis dc5b59688d Apply suggestions from code review
Co-authored-by: Phil Davis <phil@jankaritech.com>
2024-06-14 11:59:40 +02:00
mmattel f2f558bfa7 [docs-only] [5.0] Fix typo and rerun make docs-generate 2024-06-14 11:10:40 +02:00
Michael Barz 380435aab4 Merge pull request #9353 from owncloud/backport-wopi-example-2
[docs-only] Backport wopi example 2
2024-06-12 08:48:45 +02:00
Michael Barz 482591ecd1 chore: backport some missing docs 2024-06-11 20:16:07 +02:00
Thomas Müller 48ab941943 Automated changelog update [skip ci] 2024-05-24 12:46:14 +00:00
Thomas Müller 4537755ca0 feat: limit concurrent processing of thumbnail requests (#9252) 2024-05-24 14:45:39 +02:00
Benedikt Kulmann 47a593766b Automated changelog update [skip ci] 2024-05-22 14:25:18 +00:00
Benedikt Kulmann f06d683b70 Merge pull request #9237 from owncloud/release-5.0.5
[full-ci] chore: version bump for release 5.0.5
2024-05-22 16:24:45 +02:00
Benedikt Kulmann 887f41cc3b chore: version bump for release 5.0.5 2024-05-22 15:40:04 +02:00
Benedikt Kulmann 3812f50eba Automated changelog update [skip ci] 2024-05-22 07:41:03 +00:00
Benedikt Kulmann 959695e8fe Merge pull request #9145 from owncloud/release-5.0.4
[full-ci] chore: prepare changelog, bump version
2024-05-22 09:40:27 +02:00
Martin b35314fb0a Merge pull request #9226 from owncloud/mmattel-patch-2
[docs-only] Backport: Typo fix in ocis_wopi
2024-05-21 16:19:41 +02:00
Martin 9b90219a2d [docs-only] Backport: Typo fix in ocis_wopi
Backport of #9225 ([docs-only] Typo fix in ocis_wopi)
2024-05-21 15:52:50 +02:00
Martin 7756ab9a66 Merge pull request #9222 from owncloud/backport_9182
Backport to stable 5: Update wopi tag to 10.4.0
2024-05-21 15:10:40 +02:00
mmattel 2a6b1de60f Backport: Update wopi tag to 10.4.0 2024-05-21 12:25:57 +02:00
Viktor Scharf 3a1988c351 delete UItest from ocis CI (#9209) (#9211) 2024-05-20 09:59:53 +05:45
Martin 472650d41d Merge pull request #9186 from owncloud/backport_9172
[docs-only] Backport of #9172 (add staging for letsencrypt in ocis_wopi)
2024-05-16 11:37:07 +02:00
mmattel 5a86cf03b2 [docs-only] Backport of #9172 (add staging for letsencrypt in ocis_wopi) 2024-05-16 10:56:29 +02:00
Prarup Gurung a9bce7c4e3 Merge pull request #9175 from owncloud/bump-web-stable-commid-id
[tests-only][full-ci]Bump latest commit from web stable-8.0
2024-05-16 10:32:57 +05:45
Prajwol Amatya 3de2be5caa bump latest web stable commit id 2024-05-16 09:52:18 +05:45
Phil Davis 447967b985 Merge pull request #9164 from owncloud/report-to-builds-channel-5.0
[stable-5.0] Report to builds channel 5.0
2024-05-15 15:22:47 +05:45
Phil Davis 67f86499ef chore: report all drone CI results to builds channel 2024-05-14 17:33:12 +05:45
8b9dcc6a84 [tests-only][full-ci] backport e2e runner implementation (#8934)
* [full-ci]chore: bump web to v9.0.0-alpha.3 (#8736)

* chore: bump web to v9.0.0-alpha.3

* ci(e2e): use e2e runner to run the tests

* ci(e2e): fix e2e run command

* ci(e2e): fix e2e run command

* chore: adjust changelog item for Web 9.0.0

* Update .drone.env

---------

Co-authored-by: Saw-jan <saw.jan.grg3e@gmail.com>
Co-authored-by: Jannik Stehle <jannik.stehle@gmail.com>

* ci: increase e2e pipeline by 1 (#8739)

* bump latest web commit id

---------

Co-authored-by: Viktor Scharf <scharf.vi@gmail.com>
Co-authored-by: Saw-jan <saw.jan.grg3e@gmail.com>
Co-authored-by: Jannik Stehle <jannik.stehle@gmail.com>
2024-05-14 16:13:17 +05:45
Michael Barz 9d02a5a291 Automated changelog update [skip ci] 2024-05-14 09:38:34 +00:00
Michael Barz e97b4592aa Merge pull request #9153 from owncloud/bump-web-8.0.2
[full-ci] chore: bump ownCloud Web to v8.0.2
2024-05-14 11:37:26 +02:00
Saw-jan ed4c69fabd test: update expected-failure list 2024-05-14 14:22:53 +05:45
Benedikt Kulmann b2a4e806c5 chore: bump ownCloud Web to v8.0.2 2024-05-14 09:35:34 +02:00
Michael Barz a85e174c35 chore: prepare changelog, bump version 2024-05-13 15:10:46 +02:00
Michael Barz 31e1d03a38 Automated changelog update [skip ci] 2024-05-13 12:51:06 +00:00
Michael Barz e10d5822bb Merge pull request #9141 from owncloud/bump-reva-upload-fix
[full-ci] chore: bump reva to latest stable version 2.19.7
2024-05-13 14:50:33 +02:00
Michael Barz b95f4a05cf chore: bump reva to latest stable version 2.19.7 2024-05-13 12:54:38 +02:00
Michael Barz 1128490ba0 Automated changelog update [skip ci] 2024-05-13 10:50:31 +00:00
Michael Barz 698f9ba93d Merge pull request #9139 from rhafer/backport/5.0/8783
[stable-5.0] Fix nats reconnects
2024-05-13 12:49:55 +02:00
kobergj 81bac5e97f fix(changelog): improve wording
Co-authored-by: Ralf Haferkamp <ralf@h4kamp.de>
Signed-off-by: jkoberg <jkoberg@owncloud.com>
(cherry picked from commit 7db63005c4)
2024-05-13 12:16:30 +02:00
jkoberg dfb53fc52b fix(natsjsregistry): fix reconnects
Signed-off-by: jkoberg <jkoberg@owncloud.com>
(cherry picked from commit eb5035cc19)
2024-05-13 12:13:33 +02:00
Michael Barz a2d4db4ae0 Automated changelog update [skip ci] 2024-05-10 13:20:23 +00:00
Michael Barz bc5ab41402 Merge pull request #9131 from owncloud/backport-wopi-example
Backport wopi example
2024-05-10 15:19:44 +02:00
Michael Barz a4eb34628f fix: companion config 2024-05-10 15:05:12 +02:00
Michael Barz 328579186a fix: service startup appprovider onlyoffice 2024-05-10 15:02:41 +02:00
Thomas Müller 819cf505f8 fix: use docker healthcheck 2024-05-10 14:59:47 +02:00
Michael Barz 86ec03dac5 Automated changelog update [skip ci] 2024-05-03 12:36:03 +00:00
Michael Barz 0eeee16b1d docs: fix reva version 2024-05-03 14:35:25 +02:00
254 changed files with 31716 additions and 18425 deletions

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
# The test runner source for UI tests
WEB_COMMITID=97a5cf669626ed83acaeb2f7e8aaf542d42100c2
WEB_COMMITID=2095462acf3163569802daef1eba0bc9b17710f4
WEB_BRANCH=stable-8.0
+134 -238
View File
@@ -18,7 +18,6 @@ OC_CI_PHP = "owncloudci/php:%s"
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
OC_CS3_API_VALIDATOR = "owncloud/cs3api-validator:0.2.1"
OC_LITMUS = "owncloudci/litmus:latest"
OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.8.8"
OC_UBUNTU = "owncloud/ubuntu:20.04"
PLUGINS_CODACY = "plugins/codacy:1"
PLUGINS_DOCKER = "plugins/docker:latest"
@@ -30,8 +29,7 @@ PLUGINS_S3 = "plugins/s3:latest"
PLUGINS_S3_CACHE = "plugins/s3-cache:1"
PLUGINS_SLACK = "plugins/slack:1"
REDIS = "redis:6-alpine"
SELENIUM_STANDALONE_CHROME = "selenium/standalone-chrome:104.0-20220812"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5.0"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:11.0"
DEFAULT_PHP_VERSION = "8.2"
DEFAULT_NODEJS_VERSION = "18"
@@ -134,16 +132,20 @@ config = {
"skip": False,
"skipExceptParts": [],
},
"uiTests": {
"filterTags": "@ocisSmokeTest",
"skip": False,
"skipExceptParts": [],
},
"e2eTests": {
"skip": False,
"basic": {
"skip": False,
"totalParts": 4, # divide and run all suites in parts (divide pipelines)
"xsuites": ["search", "app-provider"], # suites to skip
},
"search": {
"skip": False,
"suites": ["search"], # suites to run
"tikaNeeded": True,
},
},
"rocketchat": {
"channel": "infinitescale",
"channel": "builds",
"channel_cron": "builds",
"from_secret": "rocketchat_talk_webhook",
},
@@ -319,11 +321,19 @@ def buildWebCache(ctx):
def testOcisAndUploadResults(ctx):
pipeline = testOcis(ctx)
######################################################################
# The triggers have been disabled for now, since the govulncheck can #
# not silence single, acceptable vulnerabilities. #
# See https://github.com/owncloud/ocis/issues/9527 for more details. #
# FIXME: RE-ENABLE THIS ASAP!!! #
######################################################################
scan_result_upload = uploadScanResults(ctx)
scan_result_upload["depends_on"] = getPipelineNames([pipeline])
security_scan = scanOcis(ctx)
return [security_scan, pipeline, scan_result_upload]
#security_scan = scanOcis(ctx)
#return [security_scan, pipeline, scan_result_upload]
return [pipeline, scan_result_upload]
def testPipelines(ctx):
pipelines = []
@@ -341,11 +351,7 @@ def testPipelines(ctx):
if "skip" not in config["apiTests"] or not config["apiTests"]["skip"]:
pipelines += apiTests(ctx)
if "skip" not in config["uiTests"] or not config["uiTests"]["skip"]:
pipelines += uiTests(ctx)
if "skip" not in config["e2eTests"] or not config["e2eTests"]["skip"]:
pipelines += e2eTests(ctx)
pipelines += e2eTestPipeline(ctx)
return pipelines
@@ -767,7 +773,6 @@ def codestyle(ctx):
"ref": [
"refs/heads/stable-*",
"refs/pull/**",
"refs/tags/**",
],
},
}
@@ -948,7 +953,7 @@ def wopiValidatorTests(ctx, storage, accounts_hash_difficulty = 4):
[
{
"name": "wopiserver",
"image": "cs3org/wopiserver:v10.3.0",
"image": "cs3org/wopiserver:v10.4.0",
"detach": True,
"commands": [
"cp %s/tests/config/drone/wopiserver.conf /etc/wopi/wopiserver.conf" % (dirs["base"]),
@@ -1051,134 +1056,13 @@ def apiTests(ctx):
return pipelines
def uiTests(ctx):
default = {
"filterTags": "",
def e2eTestPipeline(ctx):
defaults = {
"skip": False,
# only used if 'full-ci' is in build title or if run by cron
"numberOfParts": 20,
"skipExceptParts": [],
}
params = {}
pipelines = []
for item in default:
params[item] = config["uiTests"][item] if item in config["uiTests"] else default[item]
filterTags = params["filterTags"]
if ("full-ci" in ctx.build.title.lower() or ctx.build.event == "cron"):
numberOfParts = params["numberOfParts"]
skipExceptParts = params["skipExceptParts"]
debugPartsEnabled = (len(skipExceptParts) != 0)
for runPart in range(1, numberOfParts + 1):
if (not debugPartsEnabled or (debugPartsEnabled and runPart in skipExceptParts)):
pipelines.append(uiTestPipeline(ctx, "", runPart, numberOfParts))
# For ordinary PRs, always run the "minimal" UI test pipeline
# That has its own expected-failures file, and we always want to know that it is correct,
if (ctx.build.event != "tag" and ctx.build.event != "cron" and "full-ci" not in ctx.build.title.lower()):
pipelines.append(uiTestPipeline(ctx, filterTags, 1, 2, "ocis", "smoke"))
pipelines.append(uiTestPipeline(ctx, filterTags, 2, 2, "ocis", "smoke"))
return pipelines
def uiTestPipeline(ctx, filterTags, runPart = 1, numberOfParts = 1, storage = "ocis", uniqueName = "", accounts_hash_difficulty = 4):
standardFilterTags = "not @skipOnOCIS and not @skip and not @notToImplementOnOCIS and not @federated-server-needed"
if filterTags == "":
finalFilterTags = standardFilterTags
expectedFailuresFileFilterTags = ""
else:
finalFilterTags = filterTags + " and " + standardFilterTags
expectedFailuresFileFilterTags = "-" + filterTags.lstrip("@")
if uniqueName == "":
uniqueNameString = ""
else:
finalFilterTags = filterTags + " and " + standardFilterTags
uniqueNameString = "-" + uniqueName
if numberOfParts == 1:
pipelineName = "Web-Tests-ocis%s-%s-storage" % (uniqueNameString, storage)
else:
pipelineName = "Web-Tests-ocis%s-%s-storage-%s" % (uniqueNameString, storage, runPart)
extra_server_environment = {
"OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD": False,
"OCIS_PASSWORD_POLICY_MIN_CHARACTERS": 1,
"OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS": 0,
"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS": 0,
"OCIS_PASSWORD_POLICY_MIN_DIGITS": 0,
"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS": 0,
}
return {
"kind": "pipeline",
"type": "docker",
"name": pipelineName,
"platform": {
"os": "linux",
"arch": "amd64",
},
"steps": skipIfUnchanged(ctx, "acceptance-tests") +
restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin") +
restoreWebCache() +
restoreWebPnpmCache() +
ocisServer(storage, accounts_hash_difficulty, extra_server_environment = extra_server_environment) +
waitForSeleniumService() +
waitForMiddlewareService() +
[
{
"name": "webUITests",
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
"environment": {
"SERVER_HOST": "https://ocis-server:9200",
"BACKEND_HOST": "https://ocis-server:9200",
"OCIS_REVA_DATA_ROOT": "%s" % dirs["ocisRevaDataRoot"],
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
"TEST_TAGS": finalFilterTags,
"LOCAL_UPLOAD_DIR": "/uploads",
"NODE_TLS_REJECT_UNAUTHORIZED": 0,
"RUN_PART": runPart,
"DIVIDE_INTO_NUM_PARTS": numberOfParts,
"EXPECTED_FAILURES_FILE": "/%s/tests/acceptance/expected-failures-webUI-on-%s-storage%s.md" % (dirs["base"], storage.upper(), expectedFailuresFileFilterTags),
"MIDDLEWARE_HOST": "http://middleware:3000",
},
"commands": [
"cd %s/tests/acceptance" % dirs["web"],
"./run.sh",
],
},
],
"services": selenium() + middlewareService(),
"volumes": [{
"name": "uploads",
"temp": {},
}],
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
"trigger": {
"ref": [
"refs/heads/stable-*",
"refs/pull/**",
],
},
}
def e2eTests(ctx):
test_suites = {
"suite1": {
"path": "tests/e2e/cucumber/features/{smoke,journeys}/*.feature",
"tikaNeeded": False,
},
"suite2": {
"path": "tests/e2e/cucumber/features/smoke/{spaces,admin-settings}/*.feature",
"tikaNeeded": False,
},
"suite3": {
"path": "tests/e2e/cucumber/features/smoke/{search,shares}/*.feature",
"tikaNeeded": True,
},
"suites": [],
"xsuites": [],
"totalParts": 0,
"tikaNeeded": False,
}
extra_server_environment = {
@@ -1207,40 +1091,80 @@ def e2eTests(ctx):
pipelines = []
if ("skip-e2e" in ctx.build.title.lower()):
return []
return pipelines
for name, suite in test_suites.items():
steps = \
if (ctx.build.event == "tag"):
return pipelines
for name, suite in config["e2eTests"].items():
if "skip" in suite and suite["skip"]:
return pipelines
params = {}
for item in defaults:
params[item] = suite[item] if item in suite else defaults[item]
e2e_args = ""
if params["totalParts"] > 0:
e2e_args = "--total-parts %d" % params["totalParts"]
elif params["suites"]:
e2e_args = "--suites %s" % ",".join(params["suites"])
# suites to skip
if params["xsuites"]:
e2e_args += " --xsuites %s" % ",".join(params["xsuites"])
steps_before = \
skipIfUnchanged(ctx, "e2e-tests") + \
restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \
restoreWebCache() + \
restoreWebPnpmCache() + \
(tikaService() if suite["tikaNeeded"] else []) + \
ocisServer("ocis", 4, [], extra_server_environment = extra_server_environment, tika_enabled = suite["tikaNeeded"]) + \
[{
"name": "e2e-tests",
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
"environment": {
"BASE_URL_OCIS": "ocis-server:9200",
"HEADLESS": "true",
"RETRY": "1",
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
"LOCAL_UPLOAD_DIR": "/uploads",
},
"commands": [
"cd %s" % dirs["web"],
"pnpm test:e2e:cucumber %s" % suite["path"],
],
}] + \
uploadTracingResult(ctx) + \
logTracingResults()
(tikaService() if params["tikaNeeded"] else []) + \
ocisServer("ocis", 4, [], extra_server_environment = extra_server_environment, tika_enabled = params["tikaNeeded"])
if (ctx.build.event != "tag"):
step_e2e = {
"name": "e2e-tests",
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
"environment": {
"BASE_URL_OCIS": "ocis-server:9200",
"HEADLESS": "true",
"RETRY": "1",
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
"LOCAL_UPLOAD_DIR": "/uploads",
},
"commands": [
"cd %s/tests/e2e" % dirs["web"],
],
}
steps_after = uploadTracingResult(ctx) + \
logTracingResults()
if params["totalParts"]:
for index in range(params["totalParts"]):
run_part = index + 1
run_e2e = {}
run_e2e.update(step_e2e)
run_e2e["commands"] = [
"cd %s/tests/e2e" % dirs["web"],
"bash run-e2e.sh %s --run-part %d" % (e2e_args, run_part),
]
pipelines.append({
"kind": "pipeline",
"type": "docker",
"name": "e2e-tests-%s-%s" % (name, run_part),
"steps": steps_before + [run_e2e] + steps_after,
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
"trigger": e2e_trigger,
"volumes": e2e_volumes,
})
else:
step_e2e["commands"].append("bash run-e2e.sh %s" % e2e_args)
pipelines.append({
"kind": "pipeline",
"type": "docker",
"name": "e2e-tests-%s" % name,
"steps": steps,
"steps": steps_before + [step_e2e] + steps_after,
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
"trigger": e2e_trigger,
"volumes": e2e_volumes,
@@ -1309,7 +1233,7 @@ def dockerReleases(ctx):
for arch in config["dockerReleases"]["architectures"]:
pipelines.append(dockerRelease(ctx, arch))
manifest = releaseDockerManifest()
manifest = releaseDockerManifest(ctx)
manifest["depends_on"] = getPipelineNames(pipelines)
pipelines.append(manifest)
@@ -1322,7 +1246,7 @@ def dockerReleases(ctx):
def dockerRelease(ctx, arch):
build_args = [
"REVISION=%s" % (ctx.build.commit),
"VERSION=%s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"),
"VERSION=%s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "stable"),
]
depends_on = getPipelineNames(testOcisAndUploadResults(ctx) + testPipelines(ctx))
@@ -1665,18 +1589,28 @@ def licenseCheck(ctx):
"volumes": [pipelineVolumeGo],
}]
def releaseDockerManifest():
return {
"kind": "pipeline",
"type": "docker",
"name": "manifest",
"platform": {
"os": "linux",
"arch": "amd64",
def releaseDockerManifest(ctx):
steps = [{
"name": "execute",
"image": PLUGINS_MANIFEST,
"settings": {
"username": {
"from_secret": "docker_username",
},
"password": {
"from_secret": "docker_password",
},
"spec": "ocis/docker/manifest.tmpl",
"auto_tag": True,
"ignore_missing": True,
},
"steps": [
}]
# only create latest tag for stable releases
if len(ctx.build.ref.split("-")) == 1:
steps.append(
{
"name": "execute",
"name": "execute-latest",
"image": PLUGINS_MANIFEST,
"settings": {
"username": {
@@ -1685,12 +1619,27 @@ def releaseDockerManifest():
"password": {
"from_secret": "docker_password",
},
"spec": "ocis/docker/manifest.tmpl",
"spec": "ocis/docker/manifest-latest.tmpl",
"auto_tag": True,
"ignore_missing": True,
},
"when": {
"ref": [
"refs/tags/v*",
],
},
},
],
)
return {
"kind": "pipeline",
"type": "docker",
"name": "manifest",
"platform": {
"os": "linux",
"arch": "amd64",
},
"steps": steps,
"trigger": {
"ref": [
"refs/tags/v*",
@@ -1788,7 +1737,7 @@ def releaseDockerReadme(ctx):
"from_secret": "docker_password",
},
"PUSHRM_TARGET": "owncloud/${DRONE_REPO_NAME}",
"PUSHRM_SHORT": "Docker images for %s" % (ctx.repo.name),
"PUSHRM_SHORT": "Docker images for Infinite Scale stable releases",
"PUSHRM_FILE": "README.md",
},
},
@@ -2034,38 +1983,6 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
wait_for_ocis,
]
def middlewareService():
return [{
"name": "middleware",
"image": OC_OC_TEST_MIDDLEWARE,
"environment": {
"BACKEND_HOST": "https://ocis-server:9200",
"OCIS_REVA_DATA_ROOT": "%s/storage/owncloud/" % dirs["ocis"],
"RUN_ON_OCIS": "true",
"HOST": "middleware",
"REMOTE_UPLOAD_DIR": "/uploads",
"NODE_TLS_REJECT_UNAUTHORIZED": "0",
"MIDDLEWARE_HOST": "middleware",
"TEST_WITH_GRAPH_API": "true",
},
"volumes": [{
"name": "uploads",
"path": "/uploads",
}, {
"name": "gopath",
"path": "/srv/app",
}],
}]
def waitForMiddlewareService():
return [{
"name": "wait-for-middleware-service",
"image": OC_CI_WAIT_FOR,
"commands": [
"wait-for -it middleware:3000 -t 300",
],
}]
def redis():
return [
{
@@ -2080,27 +1997,6 @@ def redisForOCStorage(storage = "ocis"):
else:
return
def selenium():
return [
{
"name": "selenium",
"image": SELENIUM_STANDALONE_CHROME,
"volumes": [{
"name": "uploads",
"path": "/uploads",
}],
},
]
def waitForSeleniumService():
return [{
"name": "wait-for-selenium-service",
"image": OC_CI_WAIT_FOR,
"commands": [
"wait-for -it selenium:4444 -t 300",
],
}]
def build():
return [
{
+281 -24
View File
@@ -1,5 +1,11 @@
# Table of Contents
* [Changelog for 5.0.9](#changelog-for-509-2024-11-14)
* [Changelog for 5.0.8](#changelog-for-508-2024-09-30)
* [Changelog for 5.0.7](#changelog-for-507-2024-09-04)
* [Changelog for 5.0.6](#changelog-for-506-2024-07-17)
* [Changelog for 5.0.5](#changelog-for-505-2024-05-22)
* [Changelog for 5.0.4](#changelog-for-504-2024-05-13)
* [Changelog for 5.0.3](#changelog-for-503-2024-05-02)
* [Changelog for 5.0.2](#changelog-for-502-2024-04-17)
* [Changelog for 5.0.1](#changelog-for-501-2024-04-10)
@@ -14,8 +20,8 @@
* [Changelog for 3.0.0](#changelog-for-300-2023-06-06)
* [Changelog for 2.0.0](#changelog-for-200-2022-11-30)
* [Changelog for 1.20.0](#changelog-for-1200-2022-04-13)
* [Changelog for 1.19.0](#changelog-for-1190-2022-03-29)
* [Changelog for 1.19.1](#changelog-for-1191-2022-03-29)
* [Changelog for 1.19.0](#changelog-for-1190-2022-03-29)
* [Changelog for 1.18.0](#changelog-for-1180-2022-03-03)
* [Changelog for 1.17.0](#changelog-for-1170-2022-02-16)
* [Changelog for 1.16.0](#changelog-for-1160-2021-12-10)
@@ -36,6 +42,257 @@
* [Changelog for 1.1.0](#changelog-for-110-2021-01-22)
* [Changelog for 1.0.0](#changelog-for-100-2020-12-17)
# Changelog for [5.0.9] (2024-11-14)
The following sections list the changes for 5.0.9.
[5.0.9]: https://github.com/owncloud/ocis/compare/v5.0.8...v5.0.9
## Summary
* Bugfix - Thumbnail request limit: [#10280](https://github.com/owncloud/ocis/pull/10280)
* Bugfix - Restart Postprocessing properly: [#10439](https://github.com/owncloud/ocis/pull/10439)
* Change - Define maximum input image dimensions and size when generating previews: [#10270](https://github.com/owncloud/ocis/pull/10270)
## Details
* Bugfix - Thumbnail request limit: [#10280](https://github.com/owncloud/ocis/pull/10280)
The `THUMBNAILS_MAX_CONCURRENT_REQUESTS` setting was not working correctly.
Previously it was just limiting the number of concurrent thumbnail downloads.
Now the limit is applied to the number thumbnail generations requests.
Additionally the webdav service is now returning a "Retry-After" header when it
is hitting the ratelimit of the thumbnail service.
https://github.com/owncloud/ocis/pull/10280
https://github.com/owncloud/ocis/pull/10270
https://github.com/owncloud/ocis/pull/10225
* Bugfix - Restart Postprocessing properly: [#10439](https://github.com/owncloud/ocis/pull/10439)
Properly differentiate between resume and restart postprocessing.
https://github.com/owncloud/ocis/pull/10439
* Change - Define maximum input image dimensions and size when generating previews: [#10270](https://github.com/owncloud/ocis/pull/10270)
This is a general hardening change to limit processing time and resources of the
thumbnailer.
https://github.com/owncloud/ocis/pull/10270
https://github.com/owncloud/ocis/pull/9360
https://github.com/owncloud/ocis/pull/9035
https://github.com/owncloud/ocis/pull/9069
# Changelog for [5.0.8] (2024-09-30)
The following sections list the changes for 5.0.8.
[5.0.8]: https://github.com/owncloud/ocis/compare/v5.0.7...v5.0.8
## Summary
* Bugfix - Update reva to v2.19.8: [#10138](https://github.com/owncloud/ocis/pull/10138)
## Details
* Bugfix - Update reva to v2.19.8: [#10138](https://github.com/owncloud/ocis/pull/10138)
We updated reva to v2.19.8
* Fix [cs3org/reva#4761](https://github.com/cs3org/reva/pull/4761): Quotes in dav Content-Disposition header
* Fix [cs3org/reva#4853](https://github.com/cs3org/reva/pull/4853): Write upload session info atomically
* Enh [cs3org/reva#4701](https://github.com/cs3org/reva/pull/4701): Extend service account permissions
https://github.com/owncloud/ocis/pull/10138
https://github.com/owncloud/ocis/pull/10103
# Changelog for [5.0.7] (2024-09-04)
The following sections list the changes for 5.0.7.
[5.0.7]: https://github.com/owncloud/ocis/compare/v5.0.6...v5.0.7
## Summary
* Enhancement - Add virus filter to sessions command: [#9041](https://github.com/owncloud/ocis/pull/9041)
* Enhancement - Assimilate `clean` into `sessions` command: [#9828](https://github.com/owncloud/ocis/pull/9828)
* Enhancement - Update web to v8.0.5: [#9958](https://github.com/owncloud/ocis/pull/9958)
## Details
* Enhancement - Add virus filter to sessions command: [#9041](https://github.com/owncloud/ocis/pull/9041)
Allow filtering upload session by virus status (has-virus=true/false)
https://github.com/owncloud/ocis/pull/9041
* Enhancement - Assimilate `clean` into `sessions` command: [#9828](https://github.com/owncloud/ocis/pull/9828)
We deprecated `ocis storage-user uploads clean` and added the same logic to
`ocis storage-users uploads session --clean`
https://github.com/owncloud/ocis/pull/9828
* Enhancement - Update web to v8.0.5: [#9958](https://github.com/owncloud/ocis/pull/9958)
Tags: web
We updated ownCloud Web to v8.0.5. Please refer to the changelog (linked) for
details on the web release.
- Bugfix [owncloud/web#11395](https://github.com/owncloud/web/pull/11395):
Missing space members for group memberships - Bugfix
[owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Show more
toggle in space members view not reactive - Bugfix
[owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Space show
links from other spaces - Bugfix
[owncloud/web#11303](https://github.com/owncloud/web/pull/11303): Uploading
nested folders
https://github.com/owncloud/ocis/pull/9958
https://github.com/owncloud/web/releases/tag/v8.0.5
# Changelog for [5.0.6] (2024-07-17)
The following sections list the changes for 5.0.6.
[5.0.6]: https://github.com/owncloud/ocis/compare/v5.0.5...v5.0.6
## Summary
* Bugfix - Allow all uploads to restart: [#9506](https://github.com/owncloud/ocis/pull/9506)
* Bugfix - Fix the email notification service: [#9514](https://github.com/owncloud/ocis/pull/9514)
* Enhancement - Limit concurrent thumbnail requests: [#9199](https://github.com/owncloud/ocis/pull/9199)
* Enhancement - Update web to v8.0.4: [#9429](https://github.com/owncloud/ocis/pull/9429)
* Enhancement - Add cli to purge revisions: [#9497](https://github.com/owncloud/ocis/pull/9497)
## Details
* Bugfix - Allow all uploads to restart: [#9506](https://github.com/owncloud/ocis/pull/9506)
On postprocessing-restart, allow all uploads to restart even if one fails.
https://github.com/owncloud/ocis/pull/9506
* Bugfix - Fix the email notification service: [#9514](https://github.com/owncloud/ocis/pull/9514)
We fixed an error in the notification service that caused the email notification
to fail when the user's display name contained special characters.
https://github.com/owncloud/ocis/issues/9402
https://github.com/owncloud/ocis/pull/9514
* Enhancement - Limit concurrent thumbnail requests: [#9199](https://github.com/owncloud/ocis/pull/9199)
The number of concurrent requests to the thumbnail service can be limited now to
have more control over the consumed system resources.
https://github.com/owncloud/ocis/pull/9199
* Enhancement - Update web to v8.0.4: [#9429](https://github.com/owncloud/ocis/pull/9429)
Tags: web
We updated ownCloud Web to v8.0.4. Please refer to the changelog (linked) for
details on the web release.
- Bugfix [owncloud/web#10814](https://github.com/owncloud/web/issues/10814):
Vertical scroll for OcModal on small screens - Bugfix
[owncloud/web#10918](https://github.com/owncloud/web/issues/10918): Resource
deselection on right-click - Bugfix
[owncloud/web#10920](https://github.com/owncloud/web/pull/10920): Resources with
name consist of number won't show up in trash bin - Bugfix
[owncloud/web#10941](https://github.com/owncloud/web/issues/10941): Space not
updating on navigation - Bugfix
[owncloud/web#11063](https://github.com/owncloud/web/issues/11063): Enforce
shortcut URL protocol - Bugfix
[owncloud/web#11092](https://github.com/owncloud/web/issues/11092): Browser
confirmation dialog after closing editor - Bugfix
[owncloud/web#11091](https://github.com/owncloud/web/issues/11091): Button focus
when closing editor - Bugfix
[owncloud/web#10942](https://github.com/owncloud/web/issues/10942): Keyboard
navigation breaking - Bugfix
[owncloud/web#11086](https://github.com/owncloud/web/pull/11086): Opening public
links with an expired token
https://github.com/owncloud/ocis/pull/9429
https://github.com/owncloud/ocis/pull/9510
https://github.com/owncloud/web/releases/tag/v8.0.3
https://github.com/owncloud/web/releases/tag/v8.0.4
* Enhancement - Add cli to purge revisions: [#9497](https://github.com/owncloud/ocis/pull/9497)
Adds a cli that allows removing all revisions for a storage-provider.
https://github.com/owncloud/ocis/pull/9497
# Changelog for [5.0.5] (2024-05-22)
The following sections list the changes for 5.0.5.
[5.0.5]: https://github.com/owncloud/ocis/compare/v5.0.4...v5.0.5
## Summary
* Enhancement - Update web to v8.0.2: [#9153](https://github.com/owncloud/ocis/pull/9153)
## Details
* Enhancement - Update web to v8.0.2: [#9153](https://github.com/owncloud/ocis/pull/9153)
Tags: web
We updated ownCloud Web to v8.0.2. Please refer to the changelog (linked) for
details on the web release.
* Bugfix [owncloud/web#10515](https://github.com/owncloud/web/issues/10515): Folder replace
* Bugfix [owncloud/web#10598](https://github.com/owncloud/web/issues/10598): Hidden right sidebar on small screens
* Bugfix [owncloud/web#10634](https://github.com/owncloud/web/issues/10634): Scope loss when showing search results
* Bugfix [owncloud/web#10657](https://github.com/owncloud/web/issues/10657): Theme loading without matching theme
* Bugfix [owncloud/web#10763](https://github.com/owncloud/web/pull/10763): Flickering loading indicator
* Bugfix [owncloud/web#10810](https://github.com/owncloud/web/issues/10810): Download files with special chars in name
* Bugfix [owncloud/web#10881](https://github.com/owncloud/web/pull/10881): IDP logout issues
https://github.com/owncloud/ocis/pull/9153
https://github.com/owncloud/web/releases/tag/v8.0.2
# Changelog for [5.0.4] (2024-05-13)
The following sections list the changes for 5.0.4.
[5.0.4]: https://github.com/owncloud/ocis/compare/v5.0.3...v5.0.4
## Summary
* Bugfix - Update reva to v2.19.7: [#9011](https://github.com/owncloud/ocis/pull/9011)
* Bugfix - Service startup of WOPI example: [#9127](https://github.com/owncloud/ocis/pull/9127)
* Bugfix - Nats reconnects: [#9139](https://github.com/owncloud/ocis/pull/9139)
## Details
* Bugfix - Update reva to v2.19.7: [#9011](https://github.com/owncloud/ocis/pull/9011)
We updated reva to v2.19.7
* Enhancement [cs3org/reva#4673](https://github.com/cs3org/reva/pull/4673): Add virus filter to list uploads sessions
https://github.com/owncloud/ocis/pull/9011
* Bugfix - Service startup of WOPI example: [#9127](https://github.com/owncloud/ocis/pull/9127)
We fixed a bug in the service startup of the appprovider-onlyoffice in the
ocis_wopi deployment example.
https://github.com/owncloud/ocis/pull/9127
* Bugfix - Nats reconnects: [#9139](https://github.com/owncloud/ocis/pull/9139)
We fixed the reconnect handling of the natjs kv registry.
https://github.com/owncloud/ocis/pull/9139
https://github.com/owncloud/ocis/pull/8880
# Changelog for [5.0.3] (2024-05-02)
The following sections list the changes for 5.0.3.
@@ -46,7 +303,7 @@ The following sections list the changes for 5.0.3.
* Bugfix - Update the admin user role assignment to enforce the config: [#8918](https://github.com/owncloud/ocis/pull/8918)
* Bugfix - Crash when processing crafted TIFF files: [#8981](https://github.com/owncloud/ocis/pull/8981)
* Bugfix - Update reva to v2.19.5: [#9011](https://github.com/owncloud/ocis/pull/9011)
* Bugfix - Update reva to v2.19.6: [#9011](https://github.com/owncloud/ocis/pull/9011)
* Bugfix - Fix infected file handling: [#9011](https://github.com/owncloud/ocis/pull/9011)
## Details
@@ -69,9 +326,9 @@ The following sections list the changes for 5.0.3.
https://github.com/owncloud/ocis/pull/8981
https://github.com/advisories/GHSA-q7pp-wcgr-pffx
* Bugfix - Update reva to v2.19.5: [#9011](https://github.com/owncloud/ocis/pull/9011)
* Bugfix - Update reva to v2.19.6: [#9011](https://github.com/owncloud/ocis/pull/9011)
We updated reva to v2.19.5
We updated reva to v2.19.6
* Bugfix [cs3org/reva#4654](https://github.com/cs3org/reva/pull/4654): Write blob based on session id
* Bugfix [cs3org/reva#4666](https://github.com/cs3org/reva/pull/4666): Fix uploading via a public link
@@ -7383,7 +7640,7 @@ The following sections list the changes for 2.0.0.
The following sections list the changes for 1.20.0.
[1.20.0]: https://github.com/owncloud/ocis/compare/v1.19.0...v1.20.0
[1.20.0]: https://github.com/owncloud/ocis/compare/v1.19.1...v1.20.0
## Summary
@@ -7557,11 +7814,29 @@ The following sections list the changes for 1.20.0.
https://github.com/owncloud/ocis/pull/3509
https://github.com/owncloud/web/releases/tag/v5.4.0
# Changelog for [1.19.1] (2022-03-29)
The following sections list the changes for 1.19.1.
[1.19.1]: https://github.com/owncloud/ocis/compare/v1.19.0...v1.19.1
## Summary
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
## Details
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
URLs for Special items (space image, readme) were broken.
https://github.com/owncloud/ocis/pull/3419
# Changelog for [1.19.0] (2022-03-29)
The following sections list the changes for 1.19.0.
[1.19.0]: https://github.com/owncloud/ocis/compare/v1.19.1...v1.19.0
[1.19.0]: https://github.com/owncloud/ocis/compare/v1.18.0...v1.19.0
## Summary
@@ -7735,24 +8010,6 @@ The following sections list the changes for 1.19.0.
https://github.com/owncloud/ocis/pull/3375
https://github.com/owncloud/web/releases/tag/v5.3.0
# Changelog for [1.19.1] (2022-03-29)
The following sections list the changes for 1.19.1.
[1.19.1]: https://github.com/owncloud/ocis/compare/v1.18.0...v1.19.1
## Summary
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
## Details
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
URLs for Special items (space image, readme) were broken.
https://github.com/owncloud/ocis/pull/3419
# Changelog for [1.18.0] (2022-03-03)
The following sections list the changes for 1.18.0.
+2 -2
View File
@@ -1,6 +1,6 @@
Bugfix: Update reva to v2.19.5
Bugfix: Update reva to v2.19.6
We updated reva to v2.19.5
We updated reva to v2.19.6
* Bugfix [cs3org/reva#4654](https://github.com/cs3org/reva/pull/4654): Write blob based on session id
* Bugfix [cs3org/reva#4666](https://github.com/cs3org/reva/pull/4666): Fix uploading via a public link
+7
View File
@@ -0,0 +1,7 @@
Bugfix: Update reva to v2.19.7
We updated reva to v2.19.7
* Enhancement [cs3org/reva#4673](https://github.com/cs3org/reva/pull/4673): Add virus filter to list uploads sessions
https://github.com/owncloud/ocis/pull/9011
@@ -0,0 +1,5 @@
Bugfix: Service startup of WOPI example
We fixed a bug in the service startup of the appprovider-onlyoffice in the ocis_wopi deployment example.
https://github.com/owncloud/ocis/pull/9127
@@ -0,0 +1,6 @@
Bugfix: Nats reconnects
We fixed the reconnect handling of the natjs kv registry.
https://github.com/owncloud/ocis/pull/9139
https://github.com/owncloud/ocis/pull/8880
@@ -0,0 +1,16 @@
Enhancement: Update web to v8.0.2
Tags: web
We updated ownCloud Web to v8.0.2. Please refer to the changelog (linked) for details on the web release.
* Bugfix [owncloud/web#10515](https://github.com/owncloud/web/issues/10515): Folder replace
* Bugfix [owncloud/web#10598](https://github.com/owncloud/web/issues/10598): Hidden right sidebar on small screens
* Bugfix [owncloud/web#10634](https://github.com/owncloud/web/issues/10634): Scope loss when showing search results
* Bugfix [owncloud/web#10657](https://github.com/owncloud/web/issues/10657): Theme loading without matching theme
* Bugfix [owncloud/web#10763](https://github.com/owncloud/web/pull/10763): Flickering loading indicator
* Bugfix [owncloud/web#10810](https://github.com/owncloud/web/issues/10810): Download files with special chars in name
* Bugfix [owncloud/web#10881](https://github.com/owncloud/web/pull/10881): IDP logout issues
https://github.com/owncloud/ocis/pull/9153
https://github.com/owncloud/web/releases/tag/v8.0.2
@@ -0,0 +1,7 @@
Bugfix: Fix the email notification service
We fixed an error in the notification service that caused the email notification to fail when the user's display name contained special characters.
https://github.com/owncloud/ocis/pull/9514
https://github.com/owncloud/ocis/issues/9402
@@ -0,0 +1,5 @@
Bugfix: Allow all uploads to restart
On postprocessing-restart, allow all uploads to restart even if one fails.
https://github.com/owncloud/ocis/pull/9506
@@ -0,0 +1,5 @@
Enhancement: Add cli to purge revisions
Adds a cli that allows removing all revisions for a storage-provider.
https://github.com/owncloud/ocis/pull/9497
@@ -0,0 +1,6 @@
Enhancement: Limit concurrent thumbnail requests
The number of concurrent requests to the thumbnail service can be limited now
to have more control over the consumed system resources.
https://github.com/owncloud/ocis/pull/9199
@@ -0,0 +1,20 @@
Enhancement: Update web to v8.0.4
Tags: web
We updated ownCloud Web to v8.0.4. Please refer to the changelog (linked) for details on the web release.
- Bugfix [owncloud/web#10814](https://github.com/owncloud/web/issues/10814): Vertical scroll for OcModal on small screens
- Bugfix [owncloud/web#10918](https://github.com/owncloud/web/issues/10918): Resource deselection on right-click
- Bugfix [owncloud/web#10920](https://github.com/owncloud/web/pull/10920): Resources with name consist of number won't show up in trash bin
- Bugfix [owncloud/web#10941](https://github.com/owncloud/web/issues/10941): Space not updating on navigation
- Bugfix [owncloud/web#11063](https://github.com/owncloud/web/issues/11063): Enforce shortcut URL protocol
- Bugfix [owncloud/web#11092](https://github.com/owncloud/web/issues/11092): Browser confirmation dialog after closing editor
- Bugfix [owncloud/web#11091](https://github.com/owncloud/web/issues/11091): Button focus when closing editor
- Bugfix [owncloud/web#10942](https://github.com/owncloud/web/issues/10942): Keyboard navigation breaking
- Bugfix [owncloud/web#11086](https://github.com/owncloud/web/pull/11086): Opening public links with an expired token
https://github.com/owncloud/ocis/pull/9429
https://github.com/owncloud/ocis/pull/9510
https://github.com/owncloud/web/releases/tag/v8.0.3
https://github.com/owncloud/web/releases/tag/v8.0.4
@@ -0,0 +1,5 @@
Enhancement: Add virus filter to sessions command
Allow filtering upload session by virus status (has-virus=true/false)
https://github.com/owncloud/ocis/pull/9041
@@ -0,0 +1,5 @@
Enhancement: Assimilate `clean` into `sessions` command
We deprecated `ocis storage-user uploads clean` and added the same logic to `ocis storage-users uploads session --clean`
https://github.com/owncloud/ocis/pull/9828
@@ -0,0 +1,13 @@
Enhancement: Update web to v8.0.5
Tags: web
We updated ownCloud Web to v8.0.5. Please refer to the changelog (linked) for details on the web release.
- Bugfix [owncloud/web#11395](https://github.com/owncloud/web/pull/11395): Missing space members for group memberships
- Bugfix [owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Show more toggle in space members view not reactive
- Bugfix [owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Space show links from other spaces
- Bugfix [owncloud/web#11303](https://github.com/owncloud/web/pull/11303): Uploading nested folders
https://github.com/owncloud/ocis/pull/9958
https://github.com/owncloud/web/releases/tag/v8.0.5
+10
View File
@@ -0,0 +1,10 @@
Bugfix: Update reva to v2.19.8
We updated reva to v2.19.8
* Fix [cs3org/reva#4761](https://github.com/cs3org/reva/pull/4761): Quotes in dav Content-Disposition header
* Fix [cs3org/reva#4853](https://github.com/cs3org/reva/pull/4853): Write upload session info atomically
* Enh [cs3org/reva#4701](https://github.com/cs3org/reva/pull/4701): Extend service account permissions
https://github.com/owncloud/ocis/pull/10138
https://github.com/owncloud/ocis/pull/10103
@@ -0,0 +1,11 @@
Bugfix: Thumbnail request limit
The `THUMBNAILS_MAX_CONCURRENT_REQUESTS` setting was not working correctly.
Previously it was just limiting the number of concurrent thumbnail downloads.
Now the limit is applied to the number thumbnail generations requests.
Additionally the webdav service is now returning a "Retry-After" header when
it is hitting the ratelimit of the thumbnail service.
https://github.com/owncloud/ocis/pull/10280
https://github.com/owncloud/ocis/pull/10270
https://github.com/owncloud/ocis/pull/10225
@@ -0,0 +1,8 @@
Change: Define maximum input image dimensions and size when generating previews
This is a general hardening change to limit processing time and resources of the thumbnailer.
https://github.com/owncloud/ocis/pull/10270
https://github.com/owncloud/ocis/pull/9360
https://github.com/owncloud/ocis/pull/9035
https://github.com/owncloud/ocis/pull/9069
@@ -0,0 +1,5 @@
Bugfix: Restart Postprocessing properly
Properly differentiate between resume and restart postprocessing.
https://github.com/owncloud/ocis/pull/10439
@@ -32,7 +32,7 @@
env:
INSECURE: "false"
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
OCIS_DOCKER_TAG: 5.0.3
OCIS_DOCKER_TAG: 5.0.8
OCIS_DOMAIN: ocis.ocis-keycloak.released.owncloud.works
KEYCLOAK_DOMAIN: keycloak.ocis-keycloak.released.owncloud.works
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
@@ -32,7 +32,7 @@
env:
INSECURE: "false"
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
OCIS_DOCKER_TAG: 5.0.3
OCIS_DOCKER_TAG: 5.0.8
OCIS_DOMAIN: ocis.ocis-ldap.released.owncloud.works
LDAP_MANAGER_DOMAIN: ldap.ocis-ldap.released.owncloud.works
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
@@ -32,7 +32,7 @@
env:
INSECURE: "false"
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
OCIS_DOCKER_TAG: 5.0.3
OCIS_DOCKER_TAG: 5.0.8
OCIS_DOMAIN: ocis.ocis-traefik.released.owncloud.works
DEMO_USERS: "true"
INBUCKET_DOMAIN: mail.ocis-traefik.released.owncloud.works
@@ -32,7 +32,7 @@
env:
INSECURE: "false"
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
OCIS_DOCKER_TAG: 5.0.3
OCIS_DOCKER_TAG: 5.0.8
OCIS_DOMAIN: ocis.ocis-wopi.released.owncloud.works
COMPANION_DOMAIN: companion.ocis-wopi.released.owncloud.works
COMPANION_IMAGE: owncloud/uppy-companion:3.12.13-owncloud
+188 -40
View File
@@ -1,66 +1,214 @@
# If you're on a internet facing server please comment out following line.
# It skips certificate validation for various parts of oCIS and is needed if you use self signed certificates.
# Define the docker compose log driver used.
# Defaults to local
LOG_DRIVER=
# If you're on an internet facing server. comment out following line.
# It skips certificate validation for various parts of Infinite Scale and is
# needed when self signed certificates are used.
INSECURE=true
### Traefik settings ###
# Serve Traefik dashboard. Defaults to "false".
### Traefik Settings ###
# Serve Traefik dashboard.
# Defaults to "false".
TRAEFIK_DASHBOARD=
# Domain of Traefik, where you can find the dashboard. Defaults to "traefik.owncloud.test"
# Domain of Traefik, where you can find the dashboard.
# Defaults to "traefik.owncloud.test"
TRAEFIK_DOMAIN=
# Basic authentication for the dashboard. Defaults to user "admin" and password "admin" (written as: "admin:admin").
# Basic authentication for the traefik dashboard.
# Defaults to user "admin" and password "admin" (written as: "admin:admin").
TRAEFIK_BASIC_AUTH_USERS=
# Email address for obtaining LetsEncrypt certificates, needs only be changed if this is a public facing server
# Email address for obtaining LetsEncrypt certificates.
# Needs only be changed if this is a public facing server.
TRAEFIK_ACME_MAIL=
### oCIS settings ###
# oCIS version. Defaults to "latest"
# Set to the following for testing to check the certificate process:
# "https://acme-staging-v02.api.letsencrypt.org/directory"
# With staging configured, there will be an SSL error in the browser.
# When certificates are displayed and are emitted by # "Fake LE Intermediate X1",
# the process went well and the envvar can be reset to empty to get valid certificates.
TRAEFIK_ACME_CASERVER=
### Infinite Scale Settings ###
# Beside Traefik, this service must stay enabled.
# Disable only for testing purposes.
OCIS=:ocis.yml
# The oCIS container image.
# Defaults to "owncloud/ocis" which contains the production releases.
OCIS_DOCKER_IMAGE=
# The oCIS container version.
# Defaults to "latest". This will point to the latest production tag.
OCIS_DOCKER_TAG=
# Domain of oCIS, where you can find the frontend. Defaults to "ocis.owncloud.test"
# Domain of oCIS, where you can find the frontend.
# Defaults to "ocis.owncloud.test"
OCIS_DOMAIN=
# oCIS admin user password. Defaults to "admin".
ADMIN_PASSWORD=
# The demo users should not be created on a production instance
# Demo users should not be created on a production instance,
# because their passwords are public. Defaults to "false".
# Also see: https://doc.owncloud.com/ocis/latest/deployment/general/general-info.html#demo-users-and-groups
DEMO_USERS=
### Wopi server settings ###
# cs3org wopi server version. Defaults to "v8.3.3"
WOPISERVER_DOCKER_TAG=
# cs3org wopi server domain. Defaults to "wopiserver.owncloud.test"
WOPISERVER_DOMAIN=
# JWT secret which is used for the documents to be request by the Wopi client from the cs3org Wopi server. Must be change in order to have a secure Wopi server. Defaults to "LoremIpsum567"
WOPI_JWT_SECRET=
# Define the loglevel used.
# For more details see:
# https://doc.owncloud.com/ocis/latest/deployment/services/env-vars-special-scope.html
LOG_LEVEL=
### Collabora settings ###
# Domain of Collabora, where you can find the frontend. Defaults to "collabora.owncloud.test"
COLLABORA_DOMAIN=
# Admin user for Collabora. Defaults to blank, provide one to enable access. Collabora Admin Panel URL: https://{COLLABORA_DOMAIN}/browser/dist/admin/admin.html
COLLABORA_ADMIN_USER=
# Admin password for Collabora. Defaults to blank, provide one to enable access
COLLABORA_ADMIN_PASSWORD=
# Define the oCIS storage location. Set the paths for config and data to a local path.
# Note that especially the data directory can grow big.
# Leaving it default stores data in docker internal volumes.
# For more details see:
# https://doc.owncloud.com/ocis/next/deployment/general/general-info.html#default-paths
# OCIS_CONFIG_DIR=/your/local/ocis/config
# OCIS_DATA_DIR=/your/local/ocis/data
### OnlyOffice settings ###
# Domain of OnlyOffice, where you can find the frontend. Defaults to "onlyoffice.owncloud.test"
ONLYOFFICE_DOMAIN=
# Define SMPT settings if you would like to send Infinite Scale email notifications.
# For more details see:
# https://doc.owncloud.com/ocis/latest/deployment/services/s-list/notifications.html
### Email / Inbucket settings ###
# Inbucket / Mail domain. Defaults to "mail.owncloud.test"
INBUCKET_DOMAIN=
# SMTP host to connect to.
SMTP_HOST=
### Apache Tika Content analysis toolkit ###
# Set the desired docker image tag or digest, defaults to "latest"
# Port of the SMTP host to connect to.
SMTP_PORT=
# An eMail address that is used for sending Infinite Scale notification eMails
# like "ocis notifications <noreply@yourdomain.com>".
SMTP_SENDER=
# Username for the SMTP host to connect to.
SMTP_USERNAME=
# Password for the SMTP host to connect to.
SMTP_PASSWORD=
# Authentication method for the SMTP communication.
SMTP_AUTHENTICATION=
# Allow insecure connections to the SMTP server. Defaults to false.
SMTP_INSECURE=
## Default Enabled Services ##
### Apache Tika Content Analysis Toolkit ###
# Tika (search) is enabled by default, comment if not required.
# the leading colon is required to enable the service
TIKA=:tika.yml
# Set the desired docker image tag or digest.
# Defaults to "latest"
TIKA_IMAGE=
# If you want to use debugging and tracing with this stack,
# you need uncomment following line. Please see documentation at
# https://owncloud.dev/ocis/deployment/monitoring-tracing/
#COMPOSE_FILE=docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
### Uppy Companion settings ###
# Domain of Uppy Companion. Defaults to "companion.owncloud.test"
### Wopi Server Settings ###
# Wopi Server is enabled by default, comment if not required.
# Note that without the wopiserver, office apps will fail to start.
# the leading colon is required to enable the service
WOPISERVER=:wopiserver.yml
# cs3org WOPI Server Version.
# Defaults to "v10.5.0"
WOPISERVER_DOCKER_TAG=
# cs3org WOPI Server Domain. Defaults to "wopiserver.owncloud.test"
WOPISERVER_DOMAIN=
# JWT secret which is used for the documents to be requested by the WOPI client
# from the cs3org WOPI server. Must be changed in order to have a secure WOPI server.
# Defaults to "LoremIpsum567"
WOPI_JWT_SECRET=
### Collabora Settings ###
# Collabora web office is default enabled, comment if not required.
# the leading colon is required to enable the service
COLLABORA=:collabora.yml
# Domain of Collabora, where you can find the frontend.
# Defaults to "collabora.owncloud.test"
COLLABORA_DOMAIN=
# Admin user for Collabora.
# Defaults to blank. Provide one to enable access.
# Collabora Admin Panel URL:
# https://{COLLABORA_DOMAIN}/browser/dist/admin/admin.html
COLLABORA_ADMIN_USER=
# Admin password for Collabora.
# Defaults to blank, provide one to enable access
COLLABORA_ADMIN_PASSWORD=
### Supplemental Configurations ###
# If you want to use supplemental configurations,
# you need to uncomment lines containing :path/file.yml
# and configure the service if required.
## Debugging - Monitoring ##
# Please see documentation at: https://owncloud.dev/ocis/deployment/monitoring-tracing/
# Only enable if you have Collabora AND OnlyOffice enabled
#MONITORING=:monitoring_tracing/docker-compose-additions.yml
## Uppy Companion Settings ##
# the leading colon is required to enable the service
#COMPANION=:companion.yml
COMPANION_IMAGE=
# Domain of Uppy Companion. Defaults to "companion.owncloud.test"
COMPANION_DOMAIN=
COMPANION_WEB_CONFIG_FILE_NAME=
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. Empty by default, which disables providers.
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference.
# Empty by default, which disables providers.
COMPANION_ONEDRIVE_KEY=
COMPANION_ONEDRIVE_SECRET=
## OnlyOffice Settings ##
# the leading colon is required to enable the service
#ONLYOFFICE=:onlyoffice.yml
# Domain for OnlyOffice. Defaults to "onlyoffice.owncloud.test"
ONLYOFFICE_DOMAIN=
## Inbucket Settings ##
#INBUCKET=:inbucket.yml
# email server (in this case inbucket acts as mail catcher)
# Domain for Inbucket. Defaults to "mail.owncloud.test"
INBUCKET_DOMAIN=
# Mutually exclusive with ocis settings, only uncomment when the ocis settings are NOT set
#SMTP_HOST=inbucket
#SMTP_PORT=2500
#SMTP_SENDER="oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>"
#SMTP_USERNAME="notifications@${OCIS_DOMAIN:-ocis.owncloud.test}"
# the mail catcher uses self signed certificates
#SMTP_INSECURE: "true"
### IMPORTANT ###
# This MUST be the last line as it assembles the supplemental compose files to be used.
# ALL supplemental configs must be added here, whether commented or not.
# Each var must either be empty or contain :path/file.yml
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${WOPISERVER:-}${COLLABORA:-}${MONITORING:-}${COMPANION:-}${ONLYOFFICE:-}${INBUCKET:-}
+3 -5
View File
@@ -1,6 +1,4 @@
---
document this deployment example in: docs/ocis/deployment/ocis_wopi.md
---
Please refer to our [admin documentation](https://doc.owncloud.com/ocis/latest/depl-examples/ubuntu-compose/ubuntu-compose-prod.html) for instructions on how to deploy this scenario.
Note: This deployment setup is highly configurable. At minimum, it starts `traefik`, `ocis`, `tika`, the `wopiserver` and `collabora`. Additional services can be started by removing the respective comment in the `.env` file. Depending on the service added, related variables need to be configured.
Please refer to [our documentation](https://owncloud.dev/ocis/deployment/ocis_wopi/)
for instructions on how to deploy this scenario.
@@ -0,0 +1,68 @@
---
services:
traefik:
networks:
ocis-net:
aliases:
- ${COLLABORA_DOMAIN:-collabora.owncloud.test}
collabora:
# collabora can currently NOT be updated to: 24.x due to a bug in collabora
# this is the latest tested and functional collabora version
image: collabora/code:23.05.10.1.1
networks:
- ocis-net
environment:
aliasgroup1: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}:443
DONT_GEN_SSL_CERT: "YES"
extra_params: --o:ssl.enable=false --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=${OCIS_DOMAIN:-ocis.owncloud.test}
username: ${COLLABORA_ADMIN_USER}
password: ${COLLABORA_ADMIN_PASSWORD}
cap_add:
- MKNOD
labels:
- "traefik.enable=true"
- "traefik.http.routers.collabora.entrypoints=https"
- "traefik.http.routers.collabora.rule=Host(`${COLLABORA_DOMAIN:-collabora.owncloud.test}`)"
- "traefik.http.routers.collabora.tls.certresolver=http"
- "traefik.http.routers.collabora.service=collabora"
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9980/hosting/discovery"]
ocis-appprovider-collabora:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
command: app-provider server
environment:
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
# use the internal service name of the gateway
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
# configure the service name to avoid collision with other apps like onlyoffice
APP_PROVIDER_SERVICE_NAME: app-provider-collabora
# use the internal service name
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-collabora
APP_PROVIDER_DRIVER: wopi
APP_PROVIDER_WOPI_APP_NAME: Collabora
APP_PROVIDER_WOPI_APP_ICON_URI: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}/favicon.ico
APP_PROVIDER_WOPI_APP_URL: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
# share the registry with the ocis container
MICRO_REGISTRY_ADDRESS: ocis:9233
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
logging:
driver: ${LOG_DRIVER:-local}
restart: always
depends_on:
ocis:
condition: service_started
collabora:
condition: service_healthy
@@ -0,0 +1,38 @@
---
services:
traefik:
networks:
ocis-net:
aliases:
- ${COMPANION_DOMAIN:-companion.owncloud.test}
companion:
# companion could be updated to: 4.14.0 <-- needs checking
image: ${COMPANION_IMAGE:-transloadit/companion:4.5.1}
networks:
- ocis-net
environment:
NODE_ENV: production
NODE_TLS_REJECT_UNAUTHORIZED: 0
COMPANION_DATADIR: /tmp/companion/
COMPANION_DOMAIN: ${COMPANION_DOMAIN:-companion.owncloud.test}
COMPANION_PROTOCOL: https
COMPANION_UPLOAD_URLS: "^https://${OCIS_DOMAIN:-ocis.owncloud.test}/"
COMPANION_ONEDRIVE_KEY: "${COMPANION_ONEDRIVE_KEY}"
COMPANION_ONEDRIVE_SECRET: "${COMPANION_ONEDRIVE_SECRET}"
volumes:
- companion-data:/tmp/companion/
labels:
- "traefik.enable=true"
- "traefik.http.routers.companion.entrypoints=https"
- "traefik.http.routers.companion.rule=Host(`${COMPANION_DOMAIN:-companion.owncloud.test}`)"
- "traefik.http.routers.companion.tls.certresolver=http"
- "traefik.http.routers.companion.service=companion"
- "traefik.http.services.companion.loadbalancer.server.port=3020"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
companion-data:
@@ -1,19 +0,0 @@
#!/bin/sh
set -e
apk add curl
#TODO: app driver itself should try again until OnlyOffice is up...
retries=10
while [[ $retries -gt 0 ]]; do
if curl --silent --show-error --fail http://onlyoffice/hosting/discovery > /dev/null; then
ocis app-provider server
else
echo "OnlyOffice is not yet available, trying again in 10 seconds"
sleep 10
retries=$((retries - 1))
fi
done
echo 'OnlyOffice was not available after 100 seconds'
exit 1
@@ -1,18 +0,0 @@
web:
config:
external_apps:
- id: preview
path: web-app-preview
config:
mimeTypes:
- image/tiff
- image/bmp
- image/x-ms-bmp
- id: importer
path: web-app-importer
config:
companionUrl: https://companion.ocis-wopi.latest.owncloud.works
supportedClouds:
- WebdavPublicLink
#- OneDrive # needs a client id and secret
#- GoogleDrive # needs a client id and secret and an addition to the DNS zone
@@ -1,18 +0,0 @@
web:
config:
external_apps:
- id: preview
path: web-app-preview
config:
mimeTypes:
- image/tiff
- image/bmp
- image/x-ms-bmp
- id: importer
path: web-app-importer
config:
companionUrl: https://companion.ocis-wopi.released.owncloud.works
supportedClouds:
- WebdavPublicLink
#- OneDrive # needs a client id and secret
#- GoogleDrive # needs a client id and secret and an addition to the DNS zone
@@ -11,7 +11,7 @@ web:
- id: importer
path: web-app-importer
config:
companionUrl: https://companion.ocis-wopi.daily.owncloud.works
companionUrl: https://${COMPANION_DOMAIN|companion.owncloud.test}
supportedClouds:
- WebdavPublicLink
#- OneDrive # needs a client id and secret
@@ -1,23 +1,16 @@
---
version: "3.7"
services:
traefik:
image: traefik:v2.9.1
image: traefik:v3.0.3
networks:
ocis-net:
aliases:
- ${OCIS_DOMAIN:-ocis.owncloud.test}
- ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
- ${COLLABORA_DOMAIN:-collabora.owncloud.test}
- ${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
- ${COMPANION_DOMAIN:-companion.owncloud.test}
- ocis-net
command:
- "--log.level=${TRAEFIK_LOG_LEVEL:-ERROR}"
# letsencrypt configuration
- "--certificatesResolvers.http.acme.email=${TRAEFIK_ACME_MAIL:-example@example.org}"
- "--certificatesResolvers.http.acme.storage=/certs/acme.json"
- "--certificatesResolvers.http.acme.httpChallenge.entryPoint=http"
- "--certificatesresolvers.http.acme.caserver=${TRAEFIK_ACME_CASERVER:-https://acme-v02.api.letsencrypt.org/directory}"
# enable dashboard
- "--api.dashboard=true"
# define entrypoints
@@ -36,272 +29,24 @@ services:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock:ro"
- "certs:/certs"
labels:
- "traefik.enable=${TRAEFIK_DASHBOARD:-false}"
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_BASIC_AUTH_USERS:-admin:$$apr1$$4vqie50r$$YQAmQdtmz5n9rEALhxJ4l.}" # defaults to admin:admin
# basic authentication for the traefik dashboard, defaults to admin:admin
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_BASIC_AUTH_USERS:-admin:$$apr1$$4vqie50r$$YQAmQdtmz5n9rEALhxJ4l.}"
- "traefik.http.routers.traefik.entrypoints=https"
- "traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DOMAIN:-traefik.owncloud.test}`)"
- "traefik.http.routers.traefik.middlewares=traefik-auth"
- "traefik.http.routers.traefik.tls.certresolver=http"
- "traefik.http.routers.traefik.service=api@internal"
logging:
driver: "local"
restart: always
ocis:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
entrypoint:
- /bin/sh
# run ocis init to initialize a configuration file with random secrets
# it will fail on subsequent runs, because the config file already exists
# therefore we ignore the error and then start the ocis server
command: ["-c", "ocis init || true; ocis server"]
environment:
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
OCIS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
PROXY_TLS: "false" # do not use SSL between Traefik and oCIS
GATEWAY_GRPC_ADDR: 0.0.0.0:9142 # make the REVA gateway accessible to the app drivers
# INSECURE: needed if oCIS / Traefik is using self generated certificates
OCIS_INSECURE: "${INSECURE:-false}"
# basic auth (not recommended, but needed for eg. WebDav clients that do not support OpenID Connect)
PROXY_ENABLE_BASIC_AUTH: "${PROXY_ENABLE_BASIC_AUTH:-false}"
# admin user password
IDM_ADMIN_PASSWORD: "${ADMIN_PASSWORD:-admin}" # this overrides the admin password from the configuration file
# demo users
IDM_CREATE_DEMO_USERS: "${DEMO_USERS:-false}"
# fulltext search
SEARCH_EXTRACTOR_TYPE: tika
SEARCH_EXTRACTOR_TIKA_TIKA_URL: http://tika:9998
FRONTEND_FULL_TEXT_SEARCH_ENABLED: "true"
# email server (in this case inbucket acts as mail catcher)
NOTIFICATIONS_SMTP_HOST: inbucket
NOTIFICATIONS_SMTP_PORT: 2500
NOTIFICATIONS_SMTP_SENDER: oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>
NOTIFICATIONS_SMTP_USERNAME: notifications@${OCIS_DOMAIN:-ocis.owncloud.test}
NOTIFICATIONS_SMTP_INSECURE: "true" # the mail catcher uses self signed certificates
# make the registry available to the app provider containers
MICRO_REGISTRY_ADDRESS: 127.0.0.1:9233
NATS_NATS_HOST: 0.0.0.0
NATS_NATS_PORT: 9233
volumes:
- ./config/ocis/app-registry.yaml:/etc/ocis/app-registry.yaml
- ./config/ocis/${COMPANION_WEB_CONFIG_FILE_NAME:-web.yaml}:/etc/ocis/web.yaml
- ocis-config:/etc/ocis
- ocis-data:/var/lib/ocis
labels:
- "traefik.enable=true"
- "traefik.http.routers.ocis.entrypoints=https"
- "traefik.http.routers.ocis.rule=Host(`${OCIS_DOMAIN:-ocis.owncloud.test}`)"
- "traefik.http.routers.ocis.tls.certresolver=http"
- "traefik.http.routers.ocis.service=ocis"
- "traefik.http.services.ocis.loadbalancer.server.port=9200"
logging:
driver: "local"
restart: always
ocis-appprovider-collabora:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
command: app-provider server
environment:
# use the internal service name of the gateway
REVA_GATEWAY: ${REVA_GATEWAY:-com.owncloud.api.gateway}
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
# configure the service name to avoid collision with onlyoffice
APP_PROVIDER_SERVICE_NAME: app-provider-collabora
# use the internal service name
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-collabora
APP_PROVIDER_DRIVER: wopi
APP_PROVIDER_WOPI_APP_NAME: Collabora
APP_PROVIDER_WOPI_APP_ICON_URI: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}/favicon.ico
APP_PROVIDER_WOPI_APP_URL: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
# share the registry with the ocis container
MICRO_REGISTRY_ADDRESS: ocis:9233
volumes:
- ocis-config:/etc/ocis
logging:
driver: "local"
restart: always
ocis-appprovider-onlyoffice:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
user: "0" # needed for apk add in entrypoint script
entrypoint:
- /bin/sh
- /entrypoint-override.sh
#command: app-provider server
environment:
# use the internal service name of the gateway
REVA_GATEWAY: ${REVA_GATEWAY:-com.owncloud.api.gateway}
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
# configure the service name to avoid collision with collabora
APP_PROVIDER_SERVICE_NAME: app-provider-onlyoffice
# use the internal service name
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-onlyoffice
APP_PROVIDER_DRIVER: wopi
APP_PROVIDER_WOPI_APP_NAME: OnlyOffice
APP_PROVIDER_WOPI_APP_ICON_URI: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}/web-apps/apps/documenteditor/main/resources/img/favicon.ico
APP_PROVIDER_WOPI_APP_URL: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
# share the registry with the ocis container
MICRO_REGISTRY_ADDRESS: ocis:9233
volumes:
- ./config/ocis-appprovider-onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
- ocis-config:/etc/ocis
logging:
driver: "local"
restart: always
wopiserver:
image: cs3org/wopiserver:${WOPISERVER_DOCKER_TAG:-v10.3.0}
networks:
ocis-net:
entrypoint:
- /bin/sh
- /entrypoint-override.sh
environment:
WOPISERVER_INSECURE: "${INSECURE:-false}"
WOPISECRET: ${WOPI_JWT_SECRET:-LoremIpsum567}
WOPISERVER_DOMAIN: ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
volumes:
- ./config/wopiserver/entrypoint-override.sh:/entrypoint-override.sh
- ./config/wopiserver/wopiserver.conf.dist:/etc/wopi/wopiserver.conf.dist
- wopi-recovery:/var/spool/wopirecovery
labels:
- "traefik.enable=true"
- "traefik.http.routers.wopiserver.entrypoints=https"
- "traefik.http.routers.wopiserver.rule=Host(`${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}`)"
- "traefik.http.routers.wopiserver.tls.certresolver=http"
- "traefik.http.routers.wopiserver.service=wopiserver"
- "traefik.http.services.wopiserver.loadbalancer.server.port=8880"
logging:
driver: "local"
restart: always
collabora:
image: collabora/code:23.05.5.2.1
networks:
ocis-net:
environment:
aliasgroup1: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}:443
DONT_GEN_SSL_CERT: "YES"
extra_params: --o:ssl.enable=false --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=${OCIS_DOMAIN:-ocis.owncloud.test}
username: ${COLLABORA_ADMIN_USER}
password: ${COLLABORA_ADMIN_PASSWORD}
cap_add:
- MKNOD
labels:
- "traefik.enable=true"
- "traefik.http.routers.collabora.entrypoints=https"
- "traefik.http.routers.collabora.rule=Host(`${COLLABORA_DOMAIN:-collabora.owncloud.test}`)"
- "traefik.http.routers.collabora.tls.certresolver=http"
- "traefik.http.routers.collabora.service=collabora"
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
logging:
driver: "local"
restart: always
onlyoffice:
image: onlyoffice/documentserver:7.5.0
networks:
ocis-net:
entrypoint:
- /bin/sh
- /entrypoint-override.sh
environment:
WOPI_ENABLED: "true"
USE_UNAUTHORIZED_STORAGE: "${INSECURE:-false}" # self signed certificates
volumes:
- ./config/onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
- ./config/onlyoffice/local.json:/etc/onlyoffice/documentserver/local.dist.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.onlyoffice.entrypoints=https"
- "traefik.http.routers.onlyoffice.rule=Host(`${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}`)"
- "traefik.http.routers.onlyoffice.tls.certresolver=http"
- "traefik.http.routers.onlyoffice.service=onlyoffice"
- "traefik.http.services.onlyoffice.loadbalancer.server.port=80"
# websockets can't be opened when this is ommitted
- "traefik.http.middlewares.onlyoffice.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.routers.onlyoffice.middlewares=onlyoffice"
logging:
driver: "local"
restart: always
tika:
image: ${TIKA_IMAGE:-apache/tika:latest-full}
networks:
ocis-net:
restart: always
companion:
image: ${COMPANION_IMAGE:-transloadit/companion:4.5.1}
networks:
ocis-net:
environment:
NODE_ENV: production
NODE_TLS_REJECT_UNAUTHORIZED: 0
COMPANION_DATADIR: /tmp/companion/
COMPANION_DOMAIN: ${COMPANION_DOMAIN:-companion.owncloud.test}
COMPANION_PROTOCOL: https
COMPANION_UPLOAD_URLS: "^https://${OCIS_DOMAIN:-ocis.owncloud.test}/"
COMPANION_ONEDRIVE_KEY: "${COMPANION_ONEDRIVE_KEY}"
COMPANION_ONEDRIVE_SECRET: "${COMPANION_ONEDRIVE_SECRET}"
volumes:
- companion-data:/tmp/companion/
labels:
- "traefik.enable=true"
- "traefik.http.routers.companion.entrypoints=https"
- "traefik.http.routers.companion.rule=Host(`${COMPANION_DOMAIN:-companion.owncloud.test}`)"
- "traefik.http.routers.companion.tls.certresolver=http"
- "traefik.http.routers.companion.service=companion"
- "traefik.http.services.companion.loadbalancer.server.port=3020"
logging:
driver: "local"
restart: always
inbucket:
image: inbucket/inbucket
networks:
ocis-net:
entrypoint:
- /bin/sh
command: [ "-c", "apk add openssl; openssl req -subj '/CN=inbucket.test' -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/server.key -out /tmp/server.crt; /start-inbucket.sh" ]
environment:
INBUCKET_SMTP_TLSENABLED: "true"
INBUCKET_SMTP_TLSPRIVKEY: /tmp/server.key
INBUCKET_SMTP_TLSCERT: /tmp/server.crt
INBUCKET_STORAGE_MAILBOXMSGCAP: 1000
labels:
- "traefik.enable=true"
- "traefik.http.routers.inbucket.entrypoints=https"
- "traefik.http.routers.inbucket.rule=Host(`${INBUCKET_DOMAIN:-mail.owncloud.test}`)"
- "traefik.http.routers.inbucket.tls.certresolver=http"
- "traefik.http.routers.inbucket.service=inbucket"
- "traefik.http.services.inbucket.loadbalancer.server.port=9000"
logging:
driver: "local"
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
certs:
ocis-config:
ocis-data:
wopi-recovery:
companion-data:
networks:
ocis-net:
@@ -0,0 +1,32 @@
---
services:
ocis:
environment:
NOTIFICATIONS_SMTP_HOST: inbucket
NOTIFICATIONS_SMTP_PORT: 2500
NOTIFICATIONS_SMTP_SENDER: oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>
NOTIFICATIONS_SMTP_USERNAME: notifications@${OCIS_DOMAIN:-ocis.owncloud.test}
NOTIFICATIONS_SMTP_INSECURE: "true" # the mail catcher uses self signed certificates
inbucket:
image: inbucket/inbucket
networks:
- ocis-net
entrypoint:
- /bin/sh
command: [ "-c", "apk add openssl; openssl req -subj '/CN=inbucket.test' -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/server.key -out /tmp/server.crt; /start-inbucket.sh" ]
environment:
INBUCKET_SMTP_TLSENABLED: "true"
INBUCKET_SMTP_TLSPRIVKEY: /tmp/server.key
INBUCKET_SMTP_TLSCERT: /tmp/server.crt
INBUCKET_STORAGE_MAILBOXMSGCAP: 1000
labels:
- "traefik.enable=true"
- "traefik.http.routers.inbucket.entrypoints=https"
- "traefik.http.routers.inbucket.rule=Host(`${INBUCKET_DOMAIN:-mail.owncloud.test}`)"
- "traefik.http.routers.inbucket.tls.certresolver=http"
- "traefik.http.routers.inbucket.service=inbucket"
- "traefik.http.services.inbucket.loadbalancer.server.port=9000"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
@@ -1,6 +1,4 @@
---
version: "3.7"
services:
ocis:
environment:
@@ -22,15 +20,6 @@ services:
# metrics
APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165
ocis-appprovider-onlyoffice:
environment:
# tracing
OCIS_TRACING_ENABLED: "true"
OCIS_TRACING_TYPE: "jaeger"
OCIS_TRACING_ENDPOINT: jaeger-agent:6831
# metrics
APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165
networks:
ocis-net:
external: true
+67
View File
@@ -0,0 +1,67 @@
---
services:
traefik:
networks:
ocis-net:
aliases:
- ${OCIS_DOMAIN:-ocis.owncloud.test}
ocis:
image: ${OCIS_DOCKER_IMAGE:-owncloud/ocis}:${OCIS_DOCKER_TAG:-latest}
networks:
- ocis-net
entrypoint:
- /bin/sh
# run ocis init to initialize a configuration file with random secrets
# it will fail on subsequent runs, because the config file already exists
# therefore we ignore the error and then start the ocis server
command: ["-c", "ocis init || true; ocis server"]
environment:
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
OCIS_LOG_LEVEL: ${LOG_LEVEL:-info}
# do not use SSL between Traefik and oCIS
PROXY_TLS: "false"
# make the REVA gateway accessible to the app drivers
GATEWAY_GRPC_ADDR: 0.0.0.0:9142
# INSECURE: needed if oCIS / Traefik is using self generated certificates
OCIS_INSECURE: "${INSECURE:-false}"
# admin user password
# use the admin password from the configuration file if defined
IDM_ADMIN_PASSWORD: "${ADMIN_PASSWORD:-admin}"
# demo users
IDM_CREATE_DEMO_USERS: "${DEMO_USERS:-false}"
# email server (if configured)
NOTIFICATIONS_SMTP_HOST: "${SMTP_HOST}"
NOTIFICATIONS_SMTP_PORT: "${SMTP_PORT}"
NOTIFICATIONS_SMTP_SENDER: "${SMTP_SENDER}"
NOTIFICATIONS_SMTP_USERNAME: "${SMTP_USERNAME}"
NOTIFICATIONS_SMTP_INSECURE: "${SMTP_INSECURE}"
# other required configurations
MICRO_REGISTRY_ADDRESS: 127.0.0.1:9233
NATS_NATS_HOST: 0.0.0.0
NATS_NATS_PORT: 9233
# enable to allow using the banned passwords list
#OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST: banned-password-list.txt
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-ocis-data}:/var/lib/ocis
# paths are relative to the main compose file
- ./config/ocis/app-registry.yaml:/etc/ocis/app-registry.yaml
- ./config/ocis/web.yaml:/etc/ocis/web.yaml
- ./config/ocis/banned-password-list.txt:/etc/ocis/banned-password-list.txt
labels:
- "traefik.enable=true"
- "traefik.http.routers.ocis.entrypoints=https"
- "traefik.http.routers.ocis.rule=Host(`${OCIS_DOMAIN:-ocis.owncloud.test}`)"
- "traefik.http.routers.ocis.tls.certresolver=http"
- "traefik.http.routers.ocis.service=ocis"
- "traefik.http.services.ocis.loadbalancer.server.port=9200"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
ocis-config:
ocis-data:
@@ -0,0 +1,74 @@
---
services:
traefik:
networks:
ocis-net:
aliases:
- ${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
onlyoffice:
# onlyoffice could be updated to: 8.0.1 <-- needs checking
# the image used is the community edition, the EE has not been tested.
image: onlyoffice/documentserver:7.5.0
networks:
ocis-net:
entrypoint:
- /bin/sh
- /entrypoint-override.sh
environment:
WOPI_ENABLED: "true"
# self-signed certificates
USE_UNAUTHORIZED_STORAGE: "${INSECURE:-false}"
volumes:
# paths are relative to the main compose file
- ./config/onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
- ./config/onlyoffice/local.json:/etc/onlyoffice/documentserver/local.dist.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.onlyoffice.entrypoints=https"
- "traefik.http.routers.onlyoffice.rule=Host(`${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}`)"
- "traefik.http.routers.onlyoffice.tls.certresolver=http"
- "traefik.http.routers.onlyoffice.service=onlyoffice"
- "traefik.http.services.onlyoffice.loadbalancer.server.port=80"
# websockets can't be opened when this is omitted
- "traefik.http.middlewares.onlyoffice.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.routers.onlyoffice.middlewares=onlyoffice"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/hosting/discovery"]
ocis-appprovider-onlyoffice:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
command: app-provider server
environment:
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
# use the internal service name of the gateway
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
# configure the service name to avoid collision with other apps like collabora
APP_PROVIDER_SERVICE_NAME: app-provider-onlyoffice
# use the internal service name
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-onlyoffice
APP_PROVIDER_DRIVER: wopi
APP_PROVIDER_WOPI_APP_NAME: OnlyOffice
APP_PROVIDER_WOPI_APP_ICON_URI: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}/web-apps/apps/documenteditor/main/resources/img/favicon.ico
APP_PROVIDER_WOPI_APP_URL: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
# share the registry with the ocis container
MICRO_REGISTRY_ADDRESS: ocis:9233
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
logging:
driver: ${LOG_DRIVER:-local}
restart: always
depends_on:
ocis:
condition: service_started
onlyoffice:
condition: service_healthy
+14
View File
@@ -0,0 +1,14 @@
---
services:
tika:
image: ${TIKA_IMAGE:-apache/tika:latest-full}
networks:
ocis-net:
restart: always
ocis:
environment:
# fulltext search
SEARCH_EXTRACTOR_TYPE: tika
SEARCH_EXTRACTOR_TIKA_TIKA_URL: http://tika:9998
FRONTEND_FULL_TEXT_SEARCH_ENABLED: "true"
@@ -0,0 +1,38 @@
---
services:
traefik:
networks:
ocis-net:
aliases:
- ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
wopiserver:
image: cs3org/wopiserver:${WOPISERVER_DOCKER_TAG:-v10.5.0}
networks:
- ocis-net
entrypoint:
- /bin/sh
- /entrypoint-override.sh
environment:
WOPISERVER_INSECURE: "${INSECURE:-false}"
WOPISECRET: ${WOPI_JWT_SECRET:-LoremIpsum567}
WOPISERVER_DOMAIN: ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
volumes:
# paths are relative to the main compose file
- ./config/wopiserver/entrypoint-override.sh:/entrypoint-override.sh
- ./config/wopiserver/wopiserver.conf.dist:/etc/wopi/wopiserver.conf.dist
- wopi-recovery:/var/spool/wopirecovery
labels:
- "traefik.enable=true"
- "traefik.http.routers.wopiserver.entrypoints=https"
- "traefik.http.routers.wopiserver.rule=Host(`${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}`)"
- "traefik.http.routers.wopiserver.tls.certresolver=http"
#- "traefik.http.routers.wopiserver.service=wopiserver"
- "traefik.http.services.wopiserver.loadbalancer.server.port=8880"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
wopi-recovery:
+5 -5
View File
@@ -1,6 +1,6 @@
variables:
- rawname: CS3_GATEWAY
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:76
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:77
foundincode: true
name: CS3_GATEWAY
type: ""
@@ -8,7 +8,7 @@ variables:
description: ""
do_ignore: true
- rawname: CS3_MACHINE_AUTH_API_KEY
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:77
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:78
foundincode: true
name: CS3_MACHINE_AUTH_API_KEY
type: ""
@@ -44,7 +44,7 @@ variables:
on supervision of ownCloud Support.'
do_ignore: false
- rawname: _registryAddressEnv
path: ocis-pkg/natsjsregistry/registry.go:145
path: ocis-pkg/natsjsregistry/registry.go:165
foundincode: true
name: MICRO_REGISTRY_ADDRESS
type: string
@@ -61,7 +61,7 @@ variables:
description: ""
do_ignore: true
- rawname: _registryPasswordEnv
path: ocis-pkg/natsjsregistry/registry.go:163
path: ocis-pkg/natsjsregistry/registry.go:193
foundincode: true
name: MICRO_REGISTRY_AUTH_PASSWORD
type: string
@@ -69,7 +69,7 @@ variables:
description: Optional when using nats to authenticate with the nats cluster.
do_ignore: false
- rawname: _registryUsernameEnv
path: ocis-pkg/natsjsregistry/registry.go:163
path: ocis-pkg/natsjsregistry/registry.go:193
foundincode: true
name: MICRO_REGISTRY_AUTH_USERNAME
type: string
+28 -2
View File
@@ -41,6 +41,7 @@ The last four containers are the WOPI server, Collabora and OnlyOffice.
* onlyoffice.* for serving OnlyOffice
* wopiserver.* for serving the WOPI server
* traefik.* for serving the Traefik dashboard
* companion.* for serving the uppy companion app
See also [example server setup]({{< ref "preparing_server" >}})
@@ -68,7 +69,7 @@ See also [example server setup]({{< ref "preparing_server" >}})
TRAEFIK_DASHBOARD=
# Domain of Traefik, where you can find the dashboard. Defaults to "traefik.owncloud.test"
TRAEFIK_DOMAIN=
# Basic authentication for the dashboard. Defaults to user "admin" and password "admin"
# Basic authentication for the dashboard. Defaults to user "admin" and password "admin" (written as: "admin:admin").
TRAEFIK_BASIC_AUTH_USERS=
# Email address for obtaining LetsEncrypt certificates, needs only be changed if this is a public facing server
TRAEFIK_ACME_MAIL=
@@ -83,6 +84,8 @@ See also [example server setup]({{< ref "preparing_server" >}})
# The demo users should not be created on a production instance
# because their passwords are public. Defaults to "false".
DEMO_USERS=
# Log level for oCIS. Defaults to "info".
OCIS_LOG_LEVEL=
### Wopi server settings ###
# cs3org wopi server version. Defaults to "v8.3.3"
@@ -95,7 +98,7 @@ See also [example server setup]({{< ref "preparing_server" >}})
### Collabora settings ###
# Domain of Collabora, where you can find the frontend. Defaults to "collabora.owncloud.test"
COLLABORA_DOMAIN=
# Admin user for Collabora. Defaults to blank, provide one to enable access
# Admin user for Collabora. Defaults to blank, provide one to enable access. Collabora Admin Panel URL: https://{COLLABORA_DOMAIN}/browser/dist/admin/admin.html
COLLABORA_ADMIN_USER=
# Admin password for Collabora. Defaults to blank, provide one to enable access
COLLABORA_ADMIN_PASSWORD=
@@ -103,6 +106,27 @@ See also [example server setup]({{< ref "preparing_server" >}})
### OnlyOffice settings ###
# Domain of OnlyOffice, where you can find the frontend. Defaults to "onlyoffice.owncloud.test"
ONLYOFFICE_DOMAIN=
### Email / Inbucket settings ###
# Inbucket / Mail domain. Defaults to "mail.owncloud.test"
INBUCKET_DOMAIN=
### Apache Tika Content analysis toolkit ###
# Set the desired docker image tag or digest, defaults to "latest"
TIKA_IMAGE=
# If you want to use debugging and tracing with this stack,
# you need uncomment following line. Please see documentation at
# https://owncloud.dev/ocis/deployment/monitoring-tracing/
#COMPOSE_FILE=docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
### Uppy Companion settings ###
# Domain of Uppy Companion. Defaults to "companion.owncloud.test"
COMPANION_IMAGE=
COMPANION_DOMAIN=
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. Empty by default, which disables providers.
COMPANION_ONEDRIVE_KEY=
COMPANION_ONEDRIVE_SECRET=
```
You are installing oCIS on a server and Traefik will obtain valid certificates for you so please remove `INSECURE=true` or set it to `false`.
@@ -152,6 +176,8 @@ On Linux and macOS you can add them to your `/etc/hosts` file and on Windows to
127.0.0.1 collabora.owncloud.test
127.0.0.1 onlyoffice.owncloud.test
127.0.0.1 wopiserver.owncloud.test
127.0.0.1 mail.owncloud.test
127.0.0.1 companion.owncloud.test
```
After that you're ready to start the application stack:
+1
View File
@@ -362,6 +362,7 @@ PROXY_ENABLE_BASIC_AUTH=true \
NOTIFICATIONS_SMTP_HOST=localhost \
NOTIFICATIONS_SMTP_PORT=2500 \
NOTIFICATIONS_SMTP_INSECURE=true \
NOTIFICATIONS_SMTP_SENDER="owncloud <noreply@example.com>" \
ocis/bin/ocis server
```
+4
View File
@@ -1,4 +1,6 @@
// set the attribute to true or leave empty, true without any quotes.
// if the generated adoc file is used outside tabs, it renders correctly depending on the attribute set.
// if inside, you need to also use the xxx_deprecation.adoc file. attributes can't be defined inside tabs.
:show-deprecation: {{ .HasDeprecations }}
@@ -23,6 +25,8 @@ ifeval::[{show-deprecation} == true]
{{- end }}
|===
{empty} +
endif::[]
[caption=]
+11 -10
View File
@@ -13,7 +13,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.9.0
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781
github.com/cs3org/reva/v2 v2.19.6
github.com/cs3org/reva/v2 v2.19.8
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1
@@ -81,6 +81,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/test-go/testify v1.1.4
github.com/thejerf/suture/v4 v4.0.2
github.com/tidwall/gjson v1.17.1
github.com/tus/tusd v1.13.0
@@ -95,13 +96,13 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
golang.org/x/crypto v0.21.0
golang.org/x/image v0.15.0
golang.org/x/net v0.23.0
golang.org/x/crypto v0.23.0
golang.org/x/image v0.18.0
golang.org/x/net v0.25.0
golang.org/x/oauth2 v0.17.0
golang.org/x/sync v0.6.0
golang.org/x/term v0.18.0
golang.org/x/text v0.14.0
golang.org/x/sync v0.7.0
golang.org/x/term v0.20.0
golang.org/x/text v0.16.0
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.33.0
@@ -334,10 +335,10 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect
+20 -20
View File
@@ -1019,8 +1019,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY=
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.19.6 h1:n7fsTwdIN20vmQFkfOiJUbF2D7JFMLLMgOnEBRM5OTU=
github.com/cs3org/reva/v2 v2.19.6/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E=
github.com/cs3org/reva/v2 v2.19.8 h1:MXmE2W3gh1UK1Dwj/jwQDEcSeYJBZOyDF2/D3BAcvDw=
github.com/cs3org/reva/v2 v2.19.8/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
@@ -2167,8 +2167,8 @@ golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIi
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -2199,8 +2199,8 @@ golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeap
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -2231,8 +2231,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -2312,8 +2312,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -2366,8 +2366,8 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -2494,8 +2494,8 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -2512,8 +2512,8 @@ golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -2534,8 +2534,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -2622,8 +2622,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+19
View File
@@ -0,0 +1,19 @@
package middleware
import (
"net/http"
"github.com/go-chi/chi/v5/middleware"
)
// Throttle limits the number of concurrent requests.
func Throttle(limit int) func(http.Handler) http.Handler {
if limit > 0 {
return middleware.Throttle(limit)
}
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r)
})
}
}
+34 -4
View File
@@ -5,8 +5,10 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"strings"
"sync"
"time"
natsjskv "github.com/go-micro/plugins/v4/store/nats-js-kv"
@@ -36,12 +38,13 @@ func NewRegistry(opts ...registry.Option) registry.Registry {
o(&options)
}
exp, _ := options.Context.Value(expiryKey{}).(time.Duration)
return &storeregistry{
n := &storeregistry{
opts: options,
store: natsjskv.NewStore(storeOptions(options)...),
typ: _registryName,
expiry: exp,
}
n.store = natsjskv.NewStore(n.storeOptions(options)...)
return n
}
type storeregistry struct {
@@ -49,14 +52,19 @@ type storeregistry struct {
store store.Store
typ string
expiry time.Duration
lock sync.RWMutex
}
// Init inits the registry
func (n *storeregistry) Init(opts ...registry.Option) error {
n.lock.Lock()
defer n.lock.Unlock()
for _, o := range opts {
o(&n.opts)
}
return n.store.Init(storeOptions(n.opts)...)
n.store = natsjskv.NewStore(n.storeOptions(n.opts)...)
return n.store.Init(n.storeOptions(n.opts)...)
}
// Options returns the configured options
@@ -66,6 +74,9 @@ func (n *storeregistry) Options() registry.Options {
// Register adds a service to the registry
func (n *storeregistry) Register(s *registry.Service, _ ...registry.RegisterOption) error {
n.lock.RLock()
defer n.lock.RUnlock()
if s == nil {
return errors.New("wont store nil service")
}
@@ -82,11 +93,17 @@ func (n *storeregistry) Register(s *registry.Service, _ ...registry.RegisterOpti
// Deregister removes a service from the registry
func (n *storeregistry) Deregister(s *registry.Service, _ ...registry.DeregisterOption) error {
n.lock.RLock()
defer n.lock.RUnlock()
return n.store.Delete(s.Name)
}
// GetService gets a specific service from the registry
func (n *storeregistry) GetService(s string, _ ...registry.GetOption) ([]*registry.Service, error) {
n.lock.RLock()
defer n.lock.RUnlock()
recs, err := n.store.Read(s)
if err != nil {
return nil, err
@@ -104,6 +121,9 @@ func (n *storeregistry) GetService(s string, _ ...registry.GetOption) ([]*regist
// ListServices lists all registered services
func (n *storeregistry) ListServices(...registry.ListOption) ([]*registry.Service, error) {
n.lock.RLock()
defer n.lock.RUnlock()
keys, err := n.store.List()
if err != nil {
return nil, err
@@ -132,7 +152,7 @@ func (n *storeregistry) String() string {
return n.typ
}
func storeOptions(opts registry.Options) []store.Option {
func (n *storeregistry) storeOptions(opts registry.Options) []store.Option {
storeoptions := []store.Option{
store.Database("service-registry"),
store.Table("service-registry"),
@@ -150,6 +170,16 @@ func storeOptions(opts registry.Options) []store.Option {
natsOptions := nats.GetDefaultOptions()
natsOptions.Name = "nats-js-kv-registry"
natsOptions.User, natsOptions.Password = getAuth()
natsOptions.ReconnectedCB = func(_ *nats.Conn) {
if err := n.Init(); err != nil {
fmt.Println("cannot reconnect to nats")
os.Exit(1)
}
}
natsOptions.ClosedCB = func(_ *nats.Conn) {
fmt.Println("nats connection closed")
os.Exit(1)
}
storeoptions = append(storeoptions, natsjskv.NatsOptions(natsOptions))
if so, ok := opts.Context.Value(storeOptionsKey{}).([]store.Option); ok {
@@ -0,0 +1,39 @@
package ratelimiter
import (
"context"
"go-micro.dev/v4/errors"
"go-micro.dev/v4/server"
)
// NewHandlerWrapper creates a blocking server side rate limiter.
func NewHandlerWrapper(limit int) server.HandlerWrapper {
if limit <= 0 {
return func(h server.HandlerFunc) server.HandlerFunc {
return h
}
}
token := make(chan struct{}, limit)
for i := 0; i < limit; i++ {
token <- struct{}{}
}
return func(h server.HandlerFunc) server.HandlerFunc {
return func(ctx context.Context, req server.Request, rsp interface{}) error {
select {
case <-ctx.Done():
return ctx.Err()
case t := <-token:
defer func() {
token <- t
}()
return h(ctx, req, rsp)
default:
return errors.New("go.micro.server", "Rate limit exceeded", 429)
}
}
}
}
+18 -10
View File
@@ -4,6 +4,7 @@ import (
"context"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"go-micro.dev/v4/server"
"go.opentelemetry.io/otel/trace"
)
@@ -12,16 +13,17 @@ type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Namespace string
Name string
Version string
Address string
TLSEnabled bool
TLSCert string
TLSKey string
Context context.Context
TraceProvider trace.TracerProvider
Logger log.Logger
Namespace string
Name string
Version string
Address string
TLSEnabled bool
TLSCert string
TLSKey string
Context context.Context
TraceProvider trace.TracerProvider
HandlerWrappers []server.HandlerWrapper
}
// newOptions initializes the available default options.
@@ -100,3 +102,9 @@ func TraceProvider(tp trace.TracerProvider) Option {
o.TraceProvider = tp
}
}
func HandlerWrappers(w ...server.HandlerWrapper) Option {
return func(o *Options) {
o.HandlerWrappers = w
}
}
+1
View File
@@ -68,6 +68,7 @@ func NewServiceWithClient(client client.Client, opts ...Option) (Service, error)
micro.WrapHandler(mtracer.NewHandlerWrapper(
mtracer.WithTraceProvider(sopts.TraceProvider),
)),
micro.WrapHandler(sopts.HandlerWrappers...),
micro.WrapSubscriber(mtracer.NewSubscriberWrapper(
mtracer.WithTraceProvider(sopts.TraceProvider),
)),
+1 -1
View File
@@ -16,7 +16,7 @@ var (
// LatestTag is the latest released version plus the dev meta version.
// Will be overwritten by the release pipeline
// Needs a manual change for every tagged release
LatestTag = "5.0.3+dev"
LatestTag = "5.0.9+dev"
// Date indicates the build date.
// This has been removed, it looks like you can only replace static strings with recent go versions
+37 -1
View File
@@ -23,4 +23,40 @@ To authenticate the connection to the etcd registry, you have to set `ETCD_USERN
## Memory limits
oCIS will automatically set the go native `GOMEMLIMIT` to `0.9`. To disable the limit set `AUTOMEMEMLIMIT=off`. For more information take a look at the official [Guide to the Go Garbage Collector](https://go.dev/doc/gc-guide).
oCIS will automatically set the go native `GOMEMLIMIT` to `0.9`. To disable the limit set `AUTOMEMEMLIMIT=off`. For more information take a look at the official [Guide to the Go Garbage Collector](https://go.dev/doc/gc-guide).
## CLI Commands
The ocis package offers a variety of cli commands to monitor or repair ocis installations. All these commands have a common mandatory parameter: `--basePath` (or `-p`) which needs to point to a storage provider. Example paths are:
```bash
.ocis/storage/users # bare metal installation
/var/tmp/ocis/storage/users # docker installation
...
```
These paths can vary depending on your ocis installation.
### Revisions CLI
The revisions command allows removing the revisions of files in the storage.
```bash
ocis revisions purge -p /base/path/storage/users
```
It takes the `--resource-id` (or `--r`) parameter which specify the scope of the command:
* An empty string (default) removes all revisions from all spaces.
* A spaceID (like `d419032c-65b9-4f4e-b1e4-0c69a946181d\$44b5a63b-540c-4002-a674-0e9c833bbe49`) removes all revisions in that space.
* A resourceID (e.g. `d419032c-65b9-4f4e-b1e4-0c69a946181d\$44b5a63b-540c-4002-a674-0e9c833bbe49\!e8a73d49-2e00-4322-9f34-9d7f178577b2`) removes all revisions from that specific file.
This command provides additional options:
* `--dry-run` (default: `true`)\
Do not remove any revisions but print the revisions that would be removed.
* `-b` / `--blobstore`\
Allows specifying the blobstore to use. Defaults to `ocis`. Can be switched to `s3ng` but needs addtional envvar configuration (see the `storage-users` service for more details).
* `-v` / `--verbose`\
Prints additional information about the revisions that are removed.
+11
View File
@@ -0,0 +1,11 @@
image: owncloud/ocis:latest
manifests:
- image: owncloud/ocis:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: owncloud/ocis:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
variant: v8
os: linux
+152
View File
@@ -0,0 +1,152 @@
package command
import (
"errors"
"fmt"
"path/filepath"
ocisbs "github.com/cs3org/reva/v2/pkg/storage/fs/ocis/blobstore"
"github.com/cs3org/reva/v2/pkg/storage/fs/posix/lookup"
s3bs "github.com/cs3org/reva/v2/pkg/storage/fs/s3ng/blobstore"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/owncloud/ocis/v2/ocis/pkg/revisions"
"github.com/urfave/cli/v2"
)
var (
// _nodesGlobPattern is the glob pattern to find all nodes
_nodesGlobPattern = "spaces/*/*/*/*/*/*/*/*"
)
// RevisionsCommand is the entrypoint for the revisions command.
func RevisionsCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "revisions",
Usage: "ocis revisions functionality",
Subcommands: []*cli.Command{
PurgeRevisionsCommand(cfg),
},
Before: func(c *cli.Context) error {
return configlog.ReturnError(parser.ParseConfig(cfg, true))
},
Action: func(_ *cli.Context) error {
fmt.Println("Read the docs")
return nil
},
}
}
// PurgeRevisionsCommand allows removing all revisions from a storage provider.
func PurgeRevisionsCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "purge",
Usage: "purge revisions",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "basepath",
Aliases: []string{"p"},
Usage: "the basepath of the decomposedfs (e.g. /var/tmp/ocis/storage/metadata)",
Required: true,
},
&cli.StringFlag{
Name: "blobstore",
Aliases: []string{"b"},
Usage: "the blobstore type. Can be (none, ocis, s3ng). Default ocis. Note: When using s3ng this needs same configuration as the storage-users service",
Value: "ocis",
},
&cli.BoolFlag{
Name: "dry-run",
Usage: "do not delete anything, just print what would be deleted",
Value: true,
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "print verbose output",
Value: false,
},
&cli.StringFlag{
Name: "resource-id",
Aliases: []string{"r"},
Usage: "purge all revisions of this file/space. If not set, all revisions will be purged",
},
},
Action: func(c *cli.Context) error {
basePath := c.String("basepath")
if basePath == "" {
fmt.Println("basepath is required")
return cli.ShowCommandHelp(c, "revisions")
}
var (
bs revisions.DelBlobstore
err error
)
switch c.String("blobstore") {
case "s3ng":
bs, err = s3bs.New(
cfg.StorageUsers.Drivers.S3NG.Endpoint,
cfg.StorageUsers.Drivers.S3NG.Region,
cfg.StorageUsers.Drivers.S3NG.Bucket,
cfg.StorageUsers.Drivers.S3NG.AccessKey,
cfg.StorageUsers.Drivers.S3NG.SecretKey,
s3bs.Options{},
)
case "ocis":
bs, err = ocisbs.New(basePath)
case "none":
bs = nil
default:
err = errors.New("blobstore type not supported")
}
if err != nil {
fmt.Println(err)
return err
}
p, err := generatePath(basePath, c.String("resource-id"))
if err != nil {
fmt.Printf("❌ Error parsing resourceID: %s", err)
return err
}
if err := revisions.PurgeRevisions(p, bs, c.Bool("dry-run"), c.Bool("verbose")); err != nil {
fmt.Printf("❌ Error purging revisions: %s", err)
return err
}
return nil
},
}
}
func generatePath(basePath string, resourceID string) (string, error) {
if resourceID == "" {
return filepath.Join(basePath, _nodesGlobPattern), nil
}
rid, err := storagespace.ParseID(resourceID)
if err != nil {
return "", err
}
sid := lookup.Pathify(rid.GetSpaceId(), 1, 2)
if sid == "" {
sid = "*/*"
}
nid := lookup.Pathify(rid.GetOpaqueId(), 4, 2)
if nid == "" {
nid = "*/*/*/*/"
}
return filepath.Join(basePath, "spaces", sid, "nodes", nid+"*"), nil
}
func init() {
register.AddCommand(RevisionsCommand)
}
+157
View File
@@ -0,0 +1,157 @@
// Package revisions allows manipulating revisions in a storage provider.
package revisions
import (
"errors"
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/shamaton/msgpack/v2"
)
var (
// regex to determine if a node versioned. Examples:
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z.mpk
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z.mlock
_versionRegex = regexp.MustCompile(`\.REV\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+Z*`)
)
// DelBlobstore is the interface for a blobstore that can delete blobs.
type DelBlobstore interface {
Delete(node *node.Node) error
}
// PurgeRevisions removes all revisions from a storage provider.
func PurgeRevisions(pattern string, bs DelBlobstore, dryRun bool, verbose bool) error {
if verbose {
fmt.Println("Looking for nodes in", pattern)
}
nodes, err := filepath.Glob(pattern)
if err != nil {
return err
}
if len(nodes) == 0 {
return errors.New("no nodes found, double check storage path")
}
countFiles := 0
countBlobs := 0
countRevisions := 0
for _, d := range nodes {
if !_versionRegex.MatchString(d) {
continue
}
var blobID string
e := filepath.Ext(d)
switch e {
case ".mpk":
blobID, err = getBlobID(d)
if err != nil {
fmt.Printf("error getting blobID from %s: %v\n", d, err)
continue
}
countBlobs++
case ".mlock":
// no extra action on .mlock files
default:
countRevisions++
}
if !dryRun {
if blobID != "" {
// TODO: needs spaceID for s3ng
if err := bs.Delete(&node.Node{BlobID: blobID}); err != nil {
fmt.Printf("error deleting blob %s: %v\n", blobID, err)
continue
}
}
if err := os.Remove(d); err != nil {
fmt.Printf("error removing %s: %v\n", d, err)
continue
}
}
countFiles++
if verbose {
spaceID, nodeID := getIDsFromPath(d)
if dryRun {
fmt.Println("Would delete")
fmt.Println("\tResourceID:", spaceID+"!"+nodeID)
fmt.Println("\tSpaceID:", spaceID)
fmt.Println("\tPath:", d)
if blobID != "" {
fmt.Println("\tBlob:", blobID)
}
} else {
fmt.Println("Deleted")
fmt.Println("\tResourceID:", spaceID+"!"+nodeID)
fmt.Println("\tSpaceID:", spaceID)
fmt.Println("\tPath:", d)
if blobID != "" {
fmt.Println("\tBlob:", blobID)
}
}
}
}
switch {
case countFiles == 0 && countRevisions == 0 && countBlobs == 0:
fmt.Println("❎ No revisions found. Storage provider is clean.")
case !dryRun:
fmt.Printf("✅ Deleted %d revisions (%d files / %d blobs)\n", countRevisions, countFiles, countBlobs)
default:
fmt.Printf("👉 Would delete %d revisions (%d files / %d blobs)\n", countRevisions, countFiles, countBlobs)
}
return nil
}
func getBlobID(path string) (string, error) {
b, err := os.ReadFile(path)
if err != nil {
return "", err
}
m := map[string][]byte{}
if err := msgpack.Unmarshal(b, &m); err != nil {
return "", err
}
if bid := m["user.ocis.blobid"]; string(bid) != "" {
return string(bid), nil
}
return "", nil
}
func getIDsFromPath(path string) (string, string) {
rawIDs := strings.Split(path, "/nodes/")
if len(rawIDs) != 2 {
return "", ""
}
s := strings.Split(rawIDs[0], "/spaces/")
if len(s) != 2 {
return "", ""
}
n := strings.Split(rawIDs[1], ".REV.")
if len(n) != 2 {
return "", ""
}
spaceID := strings.Replace(s[1], "/", "", -1)
nodeID := strings.Replace(n[0], "/", "", -1)
return spaceID, filepath.Base(nodeID)
}
+1 -1
View File
@@ -191,5 +191,5 @@ type PasswordPolicy struct {
MinUpperCaseCharacters int `yaml:"min_uppercase_characters" env:"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS" desc:"Define the minimum number of lowercase letters. Defaults to 1 if not set." introductionVersion:"5.0"`
MinDigits int `yaml:"min_digits" env:"OCIS_PASSWORD_POLICY_MIN_DIGITS;FRONTEND_PASSWORD_POLICY_MIN_DIGITS" desc:"Define the minimum number of digits. Defaults to 1 if not set." introductionVersion:"5.0"`
MinSpecialCharacters int `yaml:"min_special_characters" env:"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS" desc:"Define the minimum number of characters from the special characters list to be present. Defaults to 1 if not set." introductionVersion:"5.0"`
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;FRONTEND_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. See the documentation for more details." introductionVersion:"5.0"`
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;FRONTEND_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. This only impacts public link password validation. See the documentation for more details." introductionVersion:"5.0"`
}
+2 -2
View File
@@ -89,7 +89,7 @@ type Cache struct {
ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
@@ -97,7 +97,7 @@ type Cache struct {
CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+1 -1
View File
@@ -9,7 +9,7 @@ type Cache struct {
Database string `yaml:"database" env:"GRAPH_CACHE_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"GRAPH_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;GRAPH_CACHE_TTL" desc:"Time to live for cache records in the graph. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+26 -11
View File
@@ -4,7 +4,7 @@ package channels
import (
"context"
"crypto/tls"
"fmt"
stdmail "net/mail"
"strings"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
@@ -31,16 +31,24 @@ type Message struct {
// NewMailChannel instantiates a new mail communication channel.
func NewMailChannel(cfg config.Config, logger log.Logger) (Channel, error) {
var err error
var a *stdmail.Address
a, err = stdmail.ParseAddress(cfg.Notifications.SMTP.Sender)
if err != nil {
logger.Err(err).Msg("parsing error, the 'smtp_sender' must be a valid single RFC 5322 address.")
}
return Mail{
conf: cfg,
logger: logger,
conf: cfg,
smtpAddress: a,
logger: logger,
}, nil
}
// Mail is the communication channel for email.
type Mail struct {
conf config.Config
logger log.Logger
conf config.Config
smtpAddress *stdmail.Address
logger log.Logger
}
func (m Mail) getMailClient() (*mail.SMTPClient, error) {
@@ -102,8 +110,12 @@ func (m Mail) getMailClient() (*mail.SMTPClient, error) {
// SendMessage sends a message to all given users.
func (m Mail) SendMessage(ctx context.Context, message *Message) error {
if m.smtpAddress == nil {
m.logger.Error().Str("mail", "SendMessage").Msg("failed to send a message. SMTP address is not set")
return nil
}
if m.conf.Notifications.SMTP.Host == "" {
m.logger.Info().Str("mail", "SendMessage").Msg("failed to send a message. SMTP host is not set")
m.logger.Info().Str("mail", "SendMessage").Msg("failed to send a message. SMTP host is not set")
return nil
}
@@ -113,11 +125,7 @@ func (m Mail) SendMessage(ctx context.Context, message *Message) error {
}
email := mail.NewMSG()
if message.Sender != "" {
email.SetFrom(fmt.Sprintf("%s via %s", message.Sender, m.conf.Notifications.SMTP.Sender)).AddTo(message.Recipient...)
} else {
email.SetFrom(m.conf.Notifications.SMTP.Sender).AddTo(message.Recipient...)
}
email.SetFrom(appendSender(message.Sender, *m.smtpAddress)).AddTo(message.Recipient...)
email.SetSubject(message.Subject)
email.SetBody(mail.TextPlain, message.TextBody)
if message.HTMLBody != "" {
@@ -129,3 +137,10 @@ func (m Mail) SendMessage(ctx context.Context, message *Message) error {
return email.Send(smtpClient)
}
func appendSender(sender string, a stdmail.Address) string {
if strings.TrimSpace(sender) != "" {
a.Name = strings.TrimSpace(sender + " via " + a.Name)
}
return a.String()
}
@@ -0,0 +1,64 @@
package channels
import (
"net/mail"
"testing"
)
func Test_appendSender(t *testing.T) {
type args struct {
sender string
a mail.Address
}
a1, err := mail.ParseAddress("ownCloud <noreply@example.com>")
if err != nil {
t.Error(err)
}
a2, err := mail.ParseAddress("noreply@example.com")
if err != nil {
t.Error(err)
}
tests := []struct {
name string
sender string
want1 string
want2 string
}{
{
name: "empty sender",
sender: "",
want1: `"ownCloud" <noreply@example.com>`,
want2: `<noreply@example.com>`,
},
{
name: "not empty sender",
sender: `Joe Q. Public`,
want1: `"Joe Q. Public via ownCloud" <noreply@example.com>`,
want2: `"Joe Q. Public via" <noreply@example.com>`,
},
{
name: "sender whit comma and semicolon",
sender: `Joe, Q; Public:`,
want1: `"Joe, Q; Public: via ownCloud" <noreply@example.com>`,
want2: `"Joe, Q; Public: via" <noreply@example.com>`,
},
{
name: "sender with quotes",
sender: `Joe Q. "Public"`,
want1: `"Joe Q. \"Public\" via ownCloud" <noreply@example.com>`,
want2: `"Joe Q. \"Public\" via" <noreply@example.com>`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := appendSender(tt.sender, *a1); got != tt.want1 {
t.Errorf("appendSender() = %v, want %v", got, tt.want1)
}
if got := appendSender(tt.sender, *a2); got != tt.want2 {
t.Errorf("appendSender() = %v, want %v", got, tt.want2)
}
})
}
}
@@ -3,6 +3,8 @@ package parser
import (
"errors"
"fmt"
"net/mail"
"strings"
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
@@ -54,6 +56,14 @@ func Validate(cfg *config.Config) error {
}
}
if strings.TrimSpace(cfg.Notifications.SMTP.Sender) != "" {
if s, err := mail.ParseAddress(cfg.Notifications.SMTP.Sender); err == nil {
cfg.Notifications.SMTP.Sender = s.String()
} else {
return fmt.Errorf("the 'smtp_sender' must be a valid single RFC 5322 address. parsing error %w", err)
}
}
if cfg.ServiceAccount.ServiceAccountID == "" {
return shared.MissingServiceAccountID(cfg.Service.Name)
}
+2
View File
@@ -103,3 +103,5 @@ ocis postprocessing restart # Restarts all uploads where postprocessing is finis
ocis postprocessing restart -s "finished" # Equivalent to the above
ocis postprocessing restart -s "virusscan" # Restart all uploads currently in virusscan step
```
Note: All above commands containing the word `restart` can also be replaced by `resume`. This changes behaviour slightly. When `restarting` an upload, the whole postprocessing will be (re)done. If `resuming` an upload, it will only continue from the last step that was completed.
@@ -15,19 +15,25 @@ import (
// RestartPostprocessing cli command to restart postprocessing
func RestartPostprocessing(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "restart",
Usage: "restart postprocessing for an uploadID",
Name: "resume",
Aliases: []string{"restart"},
Usage: "resume postprocessing for an uploadID",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "upload-id",
Aliases: []string{"u"},
Usage: "the uploadid to restart. Ignored if unset.",
Usage: "the uploadid to resume. Ignored if unset.",
},
&cli.StringFlag{
Name: "step",
Aliases: []string{"s"},
Usage: "restarts all uploads in the given postprocessing step. Ignored if upload-id is set.",
Value: "finished", // Calling `ocis postprocessing restart` without any arguments will restart all uploads that are finished but failed to move the uploed from the upload area to the blobstore.
Usage: "resume all uploads in the given postprocessing step. Ignored if upload-id is set.",
Value: "finished",
},
&cli.BoolFlag{
Name: "restart",
Aliases: []string{"r"},
Usage: "restart postprocessing for the given uploadID. Ignores the step flag.",
},
},
Before: func(c *cli.Context) error {
@@ -44,10 +50,19 @@ func RestartPostprocessing(cfg *config.Config) *cli.Command {
step = c.String("step")
}
ev := events.ResumePostprocessing{
UploadID: uid,
Step: events.Postprocessingstep(step),
Timestamp: utils.TSNow(),
var ev events.Unmarshaller
switch {
case c.Bool("retrigger"):
ev = events.RestartPostprocessing{
UploadID: uid,
Timestamp: utils.TSNow(),
}
default:
ev = events.ResumePostprocessing{
UploadID: uid,
Step: events.Postprocessingstep(step),
Timestamp: utils.TSNow(),
}
}
return events.Publish(context.Background(), stream, ev)
+1 -1
View File
@@ -60,7 +60,7 @@ type Store struct {
Database string `yaml:"database" env:"POSTPROCESSING_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"POSTPROCESSING_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;POSTPROCESSING_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;POSTPROCESSING_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;POSTPROCESSING_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;POSTPROCESSING_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;POSTPROCESSING_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
}
@@ -241,7 +241,6 @@ func (pps *PostprocessingService) handleResumePPEvent(ctx context.Context, ev ev
for _, id := range ids {
if err := pps.resumePP(ctx, id); err != nil {
pps.log.Error().Str("uploadID", id).Err(err).Msg("cannot resume upload")
return fmt.Errorf("cannot resume upload: %w", err)
}
}
return nil
+1 -1
View File
@@ -128,7 +128,7 @@ type Cache struct {
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"PROXY_OIDC_USERINFO_CACHE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_OIDC_USERINFO_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_OIDC_USERINFO_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+1 -1
View File
@@ -63,7 +63,7 @@ type Cache struct {
FileTable string `yaml:"files_table" env:"SETTINGS_FILE_CACHE_TABLE" desc:"The database table the store should use for the file cache." introductionVersion:"pre5.0"`
DirectoryTable string `yaml:"directories_table" env:"SETTINGS_DIRECTORY_CACHE_TABLE" desc:"The database table the store should use for the directory cache." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;SETTINGS_CACHE_TTL" desc:"Default time to live for entries in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;SETTINGS_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;SETTINGS_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;SETTINGS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;SETTINGS_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;SETTINGS_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+1 -1
View File
@@ -167,5 +167,5 @@ type PasswordPolicy struct {
MinUpperCaseCharacters int `yaml:"min_uppercase_characters" env:"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS" desc:"Define the minimum number of lowercase letters. Defaults to 1 if not set." introductionVersion:"5.0"`
MinDigits int `yaml:"min_digits" env:"OCIS_PASSWORD_POLICY_MIN_DIGITS;SHARING_PASSWORD_POLICY_MIN_DIGITS" desc:"Define the minimum number of digits. Defaults to 1 if not set." introductionVersion:"5.0"`
MinSpecialCharacters int `yaml:"min_special_characters" env:"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS" desc:"Define the minimum number of characters from the special characters list to be present. Defaults to 1 if not set." introductionVersion:"5.0"`
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;SHARING_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. See the documentation for more details." introductionVersion:"5.0"`
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;SHARING_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. This only impacts public link password validation. See the documentation for more details." introductionVersion:"5.0"`
}
+1 -1
View File
@@ -91,7 +91,7 @@ type Cache struct {
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_SYSTEM_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_SYSTEM_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_SYSTEM_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_SYSTEM_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_SYSTEM_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+55 -23
View File
@@ -51,58 +51,90 @@ ocis storage-users uploads <command>
```plaintext
COMMANDS:
sessions Print a list of upload sessions
clean Clean up leftovers from expired uploads
clean Clean up leftovers from expired uploads (deprecated)
list Print a list of all incomplete uploads (deprecated)
```
#### Sessions command
The `sessions` command is the entry point for listing, restarting and cleaning unfinished uploads.
```bash
ocis storage-users uploads sessions <command>
```
```
NAME:
ocis storage-users uploads sessions - Print a list of upload sessions
USAGE:
ocis storage-users uploads sessions [command options]
OPTIONS:
--id value filter sessions by upload session id (default: unset)
--processing filter sessions by processing status (default: unset)
--expired filter sessions by expired status (default: unset)
--has-virus filter sessions by virus scan result (default: unset)
--json output as json (default: false)
--restart send restart event for all listed sessions (default: false)
--clean remove uploads (default: false)
--help, -h show help
```
This will always output a list of uploads that match the criteria. See Command Examples section.
Some additional information on returned information:
- `Offset` is the amount of bytes the server has already received. If `Offset` == `Size` the server has reveived all bytes of the upload.
- `Processing` indicates if the uploaded file is currently going through postprocessing.
- `Scan Date` and `Scan Result` indicate the scanning status. If `Scan Date` is set and `Scan Result` is empty the file is not virus infected.
#### Command Examples
Command to list ongoing upload sessions
```bash
ocis storage-users sessions --expired=false
ocis storage-users uploads sessions --expired=false --processing=false
```
```plaintext
Not expired sessions:
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
| Space | Upload Id | Name | Offset | Size | Executant | Owner | Expires | Processing |
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 5e387954-7313-4223-a904-bf996da6ec0b | foo.txt | 0 | 1234 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:04:31+01:00 | false |
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f066244d-97b2-48e7-a30d-b40fcb60cec6 | bar.txt | 0 | 4321 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:18:47+01:00 | false |
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
| Space | Upload Id | Name | Offset | Size | Executant | Owner | Expires | Processing | Scan Date | Scan Result |
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 5e387954-7313-4223-a904-bf996da6ec0b | foo.txt | 0 | 1234 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:04:31+01:00 | false | 2024-04-24T11:24:14+02:00 | infected: virus A |
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f066244d-97b2-48e7-a30d-b40fcb60cec6 | bar.txt | 0 | 4321 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:18:47+01:00 | false | 2024-04-24T14:38:29+02:00 | |
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
```
The sessions command can also output json
```bash
ocis storage-users sessions --expired=false --json
ocis storage-users uploads sessions --expired=false --processing=false --json
```
```json
{"id":"5e387954-7313-4223-a904-bf996da6ec0b","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"foo.txt","offset":0,"size":1234,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:04:31+01:00","processing":false}
{"id":"f066244d-97b2-48e7-a30d-b40fcb60cec6","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"bar.txt","offset":0,"size":4321,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:18:47+01:00","processing":false}
{"id":"5e387954-7313-4223-a904-bf996da6ec0b","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"foo.txt","offset":0,"size":1234,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:04:31+01:00","processing":false, "scanDate": "2024-04-24T11:24:14+02:00", "scanResult": "infected: virus A"}
{"id":"f066244d-97b2-48e7-a30d-b40fcb60cec6","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"bar.txt","offset":0,"size":4321,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:18:47+01:00","processing":false, "scanDate": "2024-04-24T14:38:29+02:00", "scanResult": ""}
```
Command to clear expired uploads
The sessions command can also clear and restart uploads. The output is the same as if run without `--clean` or `--restart` flag.
Note: It is recommended to run to command first without the `--clean` (`--processing`) flag to double check which uploads get cleaned (restarted).
```bash
ocis storage-users uploads clean
# cleans all expired uploads regardless of processing and virus state.
ocis storage-users uploads sessions --expired=true --clean
# restarts all uploads that are processing and are not virus infected
ocis storage-users uploads sessions --processing=false --has-virus=false --restart
```
```plaintext
Cleaned uploads:
- 455bd640-cd08-46e8-a5a0-9304908bd40a (Filename: file_example_PPT_1MB.ppt, Size: 1028608, Expires: 2022-08-17T12:35:34+02:00)
```
Deprecated list command to identify unfinished uploads
IMPOTANT: `list` and `clean` commands are deprecated. Do not use them.
```bash
# deprecated
ocis storage-users uploads list
```
```plaintext
Incomplete uploads:
- 455bd640-cd08-46e8-a5a0-9304908bd40a (file_example_PPT_1MB.ppt, Size: 1028608, Expires: 2022-08-17T12:35:34+02:00)
# deprecated
ocis storage-users uploads clean
```
### Purge Expired Space Trash-Bins Items
+198 -116
View File
@@ -25,6 +25,22 @@ import (
"github.com/owncloud/ocis/v2/services/storage-users/pkg/revaconfig"
)
// Session contains the information of an upload session
type Session struct {
ID string `json:"id"`
Space string `json:"space"`
Filename string `json:"filename"`
Offset int64 `json:"offset"`
Size int64 `json:"size"`
Executant userpb.UserId `json:"executant"`
SpaceOwner *userpb.UserId `json:"spaceowner,omitempty"`
Expires time.Time `json:"expires"`
Processing bool `json:"processing"`
ScanDate time.Time `json:"virus_scan_date"`
ScanResult string `json:"virus_scan_result"`
}
// Uploads is the entry point for the uploads command
func Uploads(cfg *config.Config) *cli.Command {
return &cli.Command{
@@ -47,6 +63,8 @@ func ListUploads(cfg *config.Config) *cli.Command {
return configlog.ReturnFatal(parser.ParseConfig(cfg))
},
Action: func(c *cli.Context) error {
fmt.Println("Warning: This command is deprecated, use 'uploads sessions' instead")
f, ok := registry.NewFuncs[cfg.Driver]
if !ok {
fmt.Fprintf(os.Stderr, "Unknown filesystem driver '%s'\n", cfg.Driver)
@@ -101,13 +119,26 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
DefaultText: "unset",
Usage: "filter sessions by expired status",
},
&cli.BoolFlag{
Name: "has-virus",
DefaultText: "unset",
Usage: "filter sessions by virus scan result",
},
&cli.BoolFlag{
Name: "json",
Usage: "output as json",
},
&cli.BoolFlag{
Name: "restart",
Usage: "send restart event for all listed sessions",
Usage: "send restart event for all listed sessions. Only one of resume/restart/clean can be set.",
},
&cli.BoolFlag{
Name: "resume",
Usage: "send resume event for all listed sessions. Only one of resume/restart/clean can be set.",
},
&cli.BoolFlag{
Name: "clean",
Usage: "remove uploads for all listed sessions. Only one of resume/restart/clean can be set.",
},
},
Before: func(c *cli.Context) error {
@@ -141,138 +172,101 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
}
}
var b strings.Builder
filter := storage.UploadSessionFilter{}
if c.IsSet("processing") {
processingValue := c.Bool("processing")
filter.Processing = &processingValue
if !processingValue {
b.WriteString("Not ")
}
if b.Len() == 0 {
b.WriteString("Processing ")
} else {
b.WriteString("processing ")
}
}
if c.IsSet("expired") {
expiredValue := c.Bool("expired")
filter.Expired = &expiredValue
if !expiredValue {
if b.Len() == 0 {
b.WriteString("Not ")
} else {
b.WriteString(", not ")
}
}
if b.Len() == 0 {
b.WriteString("Expired ")
} else {
b.WriteString("expired ")
}
}
if b.Len() == 0 {
b.WriteString("Sessions")
} else {
b.WriteString("sessions")
}
if c.IsSet("id") {
idValue := c.String("id")
filter.ID = &idValue
b.WriteString(" with id '" + idValue + "'")
}
b.WriteString(":")
filter := buildFilter(c)
uploads, err := managingFS.ListUploadSessions(c.Context, filter)
if err != nil {
return err
}
var table *tw.Table
if c.Bool("json") {
for _, u := range uploads {
ref := u.Reference()
sr, sd := u.ScanData()
s := struct {
ID string `json:"id"`
Space string `json:"space"`
Filename string `json:"filename"`
Offset int64 `json:"offset"`
Size int64 `json:"size"`
Executant userpb.UserId `json:"executant"`
SpaceOwner *userpb.UserId `json:"spaceowner,omitempty"`
Expires time.Time `json:"expires"`
Processing bool `json:"processing"`
ScanDate time.Time `json:"virus_scan_date"`
ScanResult string `json:"virus_scan_result"`
}{
Space: ref.GetResourceId().GetSpaceId(),
ID: u.ID(),
Filename: u.Filename(),
Offset: u.Offset(),
Size: u.Size(),
Executant: u.Executant(),
SpaceOwner: u.SpaceOwner(),
Expires: u.Expires(),
Processing: u.IsProcessing(),
ScanDate: sd,
ScanResult: sr,
}
j, err := json.Marshal(s)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(j))
var (
table *tw.Table
raw []Session
)
if c.Bool("restart") {
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
UploadID: u.ID(),
Timestamp: utils.TSNow(),
}); err != nil {
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
// if publishing fails there is no need to try publishing other events - they will fail too.
os.Exit(1)
}
}
}
} else {
if !c.Bool("json") {
fmt.Println(buildInfo(filter))
// Print what the user requested
fmt.Println(b.String())
// start a table
table = tw.NewWriter(os.Stdout)
table.SetHeader([]string{"Space", "Upload Id", "Name", "Offset", "Size", "Executant", "Owner", "Expires", "Processing", "Scan Date", "Scan Result"})
table.SetAutoFormatHeaders(false)
}
for _, u := range uploads {
sr, sd := u.ScanData()
for _, u := range uploads {
ref := u.Reference()
sr, sd := u.ScanData()
session := Session{
Space: ref.GetResourceId().GetSpaceId(),
ID: u.ID(),
Filename: u.Filename(),
Offset: u.Offset(),
Size: u.Size(),
Executant: u.Executant(),
SpaceOwner: u.SpaceOwner(),
Expires: u.Expires(),
Processing: u.IsProcessing(),
ScanDate: sd,
ScanResult: sr,
}
if c.Bool("json") {
raw = append(raw, session)
} else {
table.Append([]string{
u.Reference().ResourceId.GetSpaceId(),
u.ID(),
u.Filename(),
strconv.FormatInt(u.Offset(), 10),
strconv.FormatInt(u.Size(), 10),
u.Executant().OpaqueId,
u.SpaceOwner().GetOpaqueId(),
u.Expires().Format(time.RFC3339),
strconv.FormatBool(u.IsProcessing()),
sd.Format(time.RFC3339),
sr,
session.Space,
session.ID,
session.Filename,
strconv.FormatInt(session.Offset, 10),
strconv.FormatInt(session.Size, 10),
session.Executant.OpaqueId,
session.SpaceOwner.GetOpaqueId(),
session.Expires.Format(time.RFC3339),
strconv.FormatBool(session.Processing),
session.ScanDate.Format(time.RFC3339),
session.ScanResult,
})
}
if c.Bool("restart") {
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
UploadID: u.ID(),
Timestamp: utils.TSNow(),
}); err != nil {
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
// if publishing fails there is no need to try publishing other events - they will fail too.
os.Exit(1)
}
switch {
case c.Bool("restart"):
if err := events.Publish(context.Background(), stream, events.RestartPostprocessing{
UploadID: u.ID(),
Timestamp: utils.TSNow(),
}); err != nil {
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
// if publishing fails there is no need to try publishing other events - they will fail too.
os.Exit(1)
}
case c.Bool("resume"):
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
UploadID: u.ID(),
Timestamp: utils.TSNow(),
}); err != nil {
fmt.Fprintf(os.Stderr, "Failed to send resume event for upload session '%s'\n", u.ID())
// if publishing fails there is no need to try publishing other events - they will fail too.
os.Exit(1)
}
case c.Bool("clean"):
if err := u.Purge(c.Context); err != nil {
fmt.Fprintf(os.Stderr, "Failed to clean upload session '%s'\n", u.ID())
}
}
table.Render()
}
if !c.Bool("json") {
table.Render()
return nil
}
j, err := json.Marshal(raw)
if err != nil {
fmt.Println(err)
return err
}
fmt.Println(string(j))
return nil
},
}
@@ -287,6 +281,7 @@ func PurgeExpiredUploads(cfg *config.Config) *cli.Command {
return configlog.ReturnFatal(parser.ParseConfig(cfg))
},
Action: func(c *cli.Context) error {
fmt.Println("Warning: This command is deprecated, use 'uploads sessions --clean' instead")
f, ok := registry.NewFuncs[cfg.Driver]
if !ok {
fmt.Fprintf(os.Stderr, "Unknown filesystem driver '%s'\n", cfg.Driver)
@@ -333,3 +328,90 @@ func PurgeExpiredUploads(cfg *config.Config) *cli.Command {
},
}
}
func buildFilter(c *cli.Context) storage.UploadSessionFilter {
filter := storage.UploadSessionFilter{}
if c.IsSet("processing") {
processingValue := c.Bool("processing")
filter.Processing = &processingValue
}
if c.IsSet("expired") {
expiredValue := c.Bool("expired")
filter.Expired = &expiredValue
}
if c.IsSet("has-virus") {
infectedValue := c.Bool("has-virus")
filter.HasVirus = &infectedValue
}
if c.IsSet("id") {
idValue := c.String("id")
filter.ID = &idValue
}
return filter
}
func buildInfo(filter storage.UploadSessionFilter) string {
var b strings.Builder
if filter.Processing != nil {
if !*filter.Processing {
b.WriteString("Not ")
}
if b.Len() == 0 {
b.WriteString("Processing")
} else {
b.WriteString("processing")
}
}
if filter.Expired != nil {
if b.Len() != 0 {
b.WriteString(", ")
}
if !*filter.Expired {
if b.Len() == 0 {
b.WriteString("Not ")
} else {
b.WriteString("not ")
}
}
if b.Len() == 0 {
b.WriteString("Expired")
} else {
b.WriteString("expired")
}
}
if filter.HasVirus != nil {
if b.Len() != 0 {
b.WriteString(", ")
}
if !*filter.HasVirus {
if b.Len() == 0 {
b.WriteString("Not ")
} else {
b.WriteString("not ")
}
}
if b.Len() == 0 {
b.WriteString("Virusinfected")
} else {
b.WriteString("virusinfected")
}
}
if b.Len() == 0 {
b.WriteString("Session")
} else {
b.WriteString(" session")
}
if filter.ID != nil {
b.WriteString(" with id '" + *filter.ID + "'")
} else {
// to make `session` plural
b.WriteString("s")
}
b.WriteString(":")
return b.String()
}
@@ -0,0 +1,85 @@
package command
import (
"testing"
"github.com/cs3org/reva/v2/pkg/storage"
"github.com/test-go/testify/require"
)
func TestBuildInfo(t *testing.T) {
testCases := []struct {
alias string
filter storage.UploadSessionFilter
expectedInfo string
}{
{
alias: "empty filter",
filter: storage.UploadSessionFilter{},
expectedInfo: "Sessions:",
},
{
alias: "processing",
filter: storage.UploadSessionFilter{Processing: boolPtr(true)},
expectedInfo: "Processing sessions:",
},
{
alias: "processing and not expired",
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false)},
expectedInfo: "Processing, not expired sessions:",
},
{
alias: "processing and expired",
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(true)},
expectedInfo: "Processing, expired sessions:",
},
{
alias: "with id",
filter: storage.UploadSessionFilter{ID: strPtr("123")},
expectedInfo: "Session with id '123':",
},
{
alias: "processing, not expired and not virus infected",
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false), HasVirus: boolPtr(false)},
expectedInfo: "Processing, not expired, not virusinfected sessions:",
},
{
alias: "not virusinfected",
filter: storage.UploadSessionFilter{HasVirus: boolPtr(false)},
expectedInfo: "Not virusinfected sessions:",
},
{
alias: "expired and virusinfected",
filter: storage.UploadSessionFilter{Expired: boolPtr(true), HasVirus: boolPtr(true)},
expectedInfo: "Expired, virusinfected sessions:",
},
{
alias: "expired and not virus infected",
filter: storage.UploadSessionFilter{Expired: boolPtr(true), HasVirus: boolPtr(false)},
expectedInfo: "Expired, not virusinfected sessions:",
},
{
alias: "processing, not expired, virus infected and with id (note: this makes no sense)",
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false), HasVirus: boolPtr(true), ID: strPtr("123")},
expectedInfo: "Processing, not expired, virusinfected session with id '123':",
},
}
for _, tc := range testCases {
alias := tc.alias
filter := tc.filter
expectedInfo := tc.expectedInfo
t.Run(alias, func(t *testing.T) {
require.Equal(t, expectedInfo, buildInfo(filter))
})
}
}
func boolPtr(b bool) *bool {
return &b
}
func strPtr(s string) *string {
return &s
}
+2 -2
View File
@@ -204,7 +204,7 @@ type FilemetadataCache struct {
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_FILEMETADATA_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_FILEMETADATA_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_FILEMETADATA_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_FILEMETADATA_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_FILEMETADATA_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
@@ -216,7 +216,7 @@ type IDCache struct {
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_ID_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens have no expiration. Defaults to 300s which is derived from the underlaying package though not explicitly set as default. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_ID_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_ID_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
+11 -10
View File
@@ -41,19 +41,19 @@ Thumbnails can either be generated as `png`, `jpg` or `gif` files. These types a
## Thumbnail Query String Parameters
Clients can request thumbnail previews for files by adding `?preview=1` to the file URL. Requests for files with thumbnail availabe respond with HTTP status `404`.
Clients can request thumbnail previews for files by adding `?preview=1` to the file URL. Requests for files with thumbnail available respond with HTTP status `404`.
The following query parameters are supported:
| Parameter | Required | Default Value | Description |
| --------- | -------- | ---------------------------------------------------- | ------------------------------------------------------------------------------- |
|-----------|----------|------------------------------------------------------|---------------------------------------------------------------------------------|
| preview | YES | 1 | generates preview |
| x | YES | first x-value configured in `THUMBNAILS_RESOLUTIONS` | horizontal target size |
| y | YES | first y-value configured in `THUMBNAILS_RESOLUTIONS` | vertical target size |
| scalingup | NO | 0 | prevents upscaling of small images |
| scalingup | NO | 0 | prevents up-scaling of small images |
| a | NO | 1 | aspect ratio |
| c | NO | Caching string | Clients should send the etag, so they get a fresh thumbnail after a file change |
| processor | NO | `resize` for gif's and `thumbnail` for all others | preferred thumbnail processor |
| processor | NO | `resize` for gifs and `thumbnail` for all others | preferred thumbnail processor |
## Thumbnail Resolution
@@ -61,21 +61,21 @@ Various resolutions can be defined via `THUMBNAILS_RESOLUTIONS`. A requestor can
Example:
Requested: 18x12
Available: 30x20, 15x10, 9x6
Returned: 15x10
Requested: 18x12
Available: 30x20, 15x10, 9x6
Returned: 15x10
## Thumbnail Processors
Normally, an image might get cropped when creating a preview, depending on the aspect ratio of the original image. This can have negative
Normally, an image might get cropped when creating a preview, depending on the aspect ratio of the original image. This can have negative
impacts on previews as only a part of the image will be shown. When using an _optional_ processor in the request, cropping can be avoided by defining on how the preview image generation will be done. The following processors are available:
* `resize` resizes the image to the specified width and height and returns the transformed image. If one of width or height is 0, the image aspect ratio is preserved.
* `fit` scales down the image to fit the specified maximum width and height and returns the transformed image.
* `fill`: creates an image with the specified dimensions and fills it with the scaled source image. To achieve the correct aspect ratio without stretching, the source image will be cropped.
* `thumbnail` scales the image up or down, crops it to the specified width and hight and returns the transformed image.
* `thumbnail` scales the image up or down, crops it to the specified width and height and returns the transformed image.
To apply one of those, a query parameter has to be added to the request, like `?processor=fit`. If no query parameter or processor is added, the default behaviour applies which is `resize` for gif's and `thumbnail` for all others.
To apply one of those, a query parameter has to be added to the request, like `?processor=fit`. If no query parameter or processor is added, the default behaviour applies which is `resize` for gifs and `thumbnail` for all others.
## Deleting Thumbnails
@@ -84,3 +84,4 @@ As of now, there is no automated thumbnail deletion. This is especially true whe
## Memory Considerations
Since source files need to be loaded into memory when generating thumbnails, large source files could potentially crash this service if there is insufficient memory available. For bigger instances when using container orchestration deployment methods, this service can be dedicated to its own server(s) with more memory.
To have more control over memory (and CPU) consumption the maximum number of concurrent requests can be limited by setting the environment variable `THUMBNAILS_MAX_CONCURRENT_REQUESTS`. The default value is 0 which does not apply any restrictions to the number of concurrent requests. As soon as the number of concurrent requests is reached any further request will be responded with `429/Too Many Requests` and the client can retry at a later point in time.
+7 -6
View File
@@ -26,10 +26,10 @@ func Server(cfg *config.Config) *cli.Command {
Name: "server",
Usage: fmt.Sprintf("start the %s service without runtime (unsupervised mode)", cfg.Service.Name),
Category: "server",
Before: func(c *cli.Context) error {
Before: func(_ *cli.Context) error {
return configlog.ReturnFatal(parser.ParseConfig(cfg))
},
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
@@ -49,12 +49,12 @@ func Server(cfg *config.Config) *cli.Command {
}
return context.WithCancel(cfg.Context)
}()
metrics = metrics.New()
m = metrics.New()
)
defer cancel()
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
service := grpc.NewService(
grpc.Logger(logger),
@@ -63,8 +63,9 @@ func Server(cfg *config.Config) *cli.Command {
grpc.Name(cfg.Service.Name),
grpc.Namespace(cfg.GRPC.Namespace),
grpc.Address(cfg.GRPC.Addr),
grpc.Metrics(metrics),
grpc.Metrics(m),
grpc.TraceProvider(traceProvider),
grpc.MaxConcurrentRequests(cfg.GRPC.MaxConcurrentRequests),
)
gr.Add(service.Run, func(_ error) {
@@ -95,7 +96,7 @@ func Server(cfg *config.Config) *cli.Command {
http.Logger(logger),
http.Context(ctx),
http.Config(cfg),
http.Metrics(metrics),
http.Metrics(m),
http.Namespace(cfg.HTTP.Namespace),
http.TraceProvider(traceProvider),
)
+1 -1
View File
@@ -18,7 +18,7 @@ func Version(cfg *config.Config) *cli.Command {
Name: "version",
Usage: "print the version of this binary and the running service instances",
Category: "info",
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
fmt.Println("Version: " + version.GetString())
fmt.Printf("Compiled: %s\n", version.Compiled())
fmt.Println("")
+11 -8
View File
@@ -36,12 +36,15 @@ type FileSystemStorage struct {
// Thumbnail defines the available thumbnail related configuration.
type Thumbnail struct {
Resolutions []string `yaml:"resolutions" env:"THUMBNAILS_RESOLUTIONS" desc:"The supported list of target resolutions in the format WidthxHeight like 32x32. You can define any resolution as required. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
FileSystemStorage FileSystemStorage `yaml:"filesystem_storage"`
WebdavAllowInsecure bool `yaml:"webdav_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the webdav source." introductionVersion:"pre5.0"`
CS3AllowInsecure bool `yaml:"cs3_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the CS3 source." introductionVersion:"pre5.0"`
RevaGateway string `yaml:"reva_gateway" env:"OCIS_REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata" introductionVersion:"pre5.0"`
FontMapFile string `yaml:"font_map_file" env:"THUMBNAILS_TXT_FONTMAP_FILE" desc:"The path to a font file for txt thumbnails." introductionVersion:"pre5.0"`
TransferSecret string `yaml:"transfer_secret" env:"THUMBNAILS_TRANSFER_TOKEN" desc:"The secret to sign JWT to download the actual thumbnail file." introductionVersion:"pre5.0"`
DataEndpoint string `yaml:"data_endpoint" env:"THUMBNAILS_DATA_ENDPOINT" desc:"The HTTP endpoint where the actual thumbnail file can be downloaded." introductionVersion:"pre5.0"`
Resolutions []string `yaml:"resolutions" env:"THUMBNAILS_RESOLUTIONS" desc:"The supported list of target resolutions in the format WidthxHeight like 32x32. You can define any resolution as required. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
FileSystemStorage FileSystemStorage `yaml:"filesystem_storage"`
WebdavAllowInsecure bool `yaml:"webdav_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the webdav source." introductionVersion:"pre5.0"`
CS3AllowInsecure bool `yaml:"cs3_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the CS3 source." introductionVersion:"pre5.0"`
RevaGateway string `yaml:"reva_gateway" env:"OCIS_REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata" introductionVersion:"pre5.0"`
FontMapFile string `yaml:"font_map_file" env:"THUMBNAILS_TXT_FONTMAP_FILE" desc:"The path to a font file for txt thumbnails." introductionVersion:"pre5.0"`
TransferSecret string `yaml:"transfer_secret" env:"THUMBNAILS_TRANSFER_TOKEN" desc:"The secret to sign JWT to download the actual thumbnail file." introductionVersion:"pre5.0"`
DataEndpoint string `yaml:"data_endpoint" env:"THUMBNAILS_DATA_ENDPOINT" desc:"The HTTP endpoint where the actual thumbnail file can be downloaded." introductionVersion:"pre5.0"`
MaxInputWidth int `yaml:"max_input_width" env:"THUMBNAILS_MAX_INPUT_WIDTH" desc:"The maximum width of an input image which is being processed." introductionVersion:"6.0"`
MaxInputHeight int `yaml:"max_input_height" env:"THUMBNAILS_MAX_INPUT_HEIGHT" desc:"The maximum height of an input image which is being processed." introductionVersion:"6.0"`
MaxInputImageFileSize string `yaml:"max_input_image_file_size" env:"THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE" desc:"The maximum file size of an input image which is being processed. Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB." introductionVersion:"6.0"`
}
@@ -28,8 +28,9 @@ func DefaultConfig() *config.Config {
Zpages: false,
},
GRPC: config.GRPCConfig{
Addr: "127.0.0.1:9185",
Namespace: "com.owncloud.api",
Addr: "127.0.0.1:9185",
Namespace: "com.owncloud.api",
MaxConcurrentRequests: 0,
},
HTTP: config.HTTP{
Addr: "127.0.0.1:9186",
@@ -44,10 +45,13 @@ func DefaultConfig() *config.Config {
FileSystemStorage: config.FileSystemStorage{
RootDirectory: path.Join(defaults.BaseDataPath(), "thumbnails"),
},
WebdavAllowInsecure: false,
RevaGateway: shared.DefaultRevaConfig().Address,
CS3AllowInsecure: false,
DataEndpoint: "http://127.0.0.1:9186/thumbnails/data",
WebdavAllowInsecure: false,
RevaGateway: shared.DefaultRevaConfig().Address,
CS3AllowInsecure: false,
DataEndpoint: "http://127.0.0.1:9186/thumbnails/data",
MaxInputWidth: 7680,
MaxInputHeight: 7680,
MaxInputImageFileSize: "50MB",
},
}
}
+4 -3
View File
@@ -4,7 +4,8 @@ import "github.com/owncloud/ocis/v2/ocis-pkg/shared"
// GRPCConfig defines the available grpc configuration.
type GRPCConfig struct {
Addr string `yaml:"addr" env:"THUMBNAILS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
Namespace string `yaml:"-"`
TLS *shared.GRPCServiceTLS `yaml:"tls"`
Addr string `yaml:"addr" env:"THUMBNAILS_GRPC_ADDR" desc:"The bind address of the GRPC service." introductionVersion:"pre5.0"`
Namespace string `yaml:"-"`
TLS *shared.GRPCServiceTLS `yaml:"tls"`
MaxConcurrentRequests int `yaml:"max_concurrent_requests" env:"THUMBNAILS_MAX_CONCURRENT_REQUESTS" desc:"Number of maximum concurrent thumbnail requests. Default is 0 which is unlimited." introductionVersion:"6.0.0"`
}
@@ -33,6 +33,7 @@ func ParseConfig(cfg *config.Config) error {
return Validate(cfg)
}
func Validate(cfg *config.Config) error {
// Validate can validate the configuration
func Validate(_ *config.Config) error {
return nil
}
+18
View File
@@ -0,0 +1,18 @@
package errors
import "errors"
var (
// ErrImageTooLarge defines an error when an input image is too large
ErrImageTooLarge = errors.New("thumbnails: image is too large")
// ErrInvalidType represents the error when a type can't be encoded.
ErrInvalidType = errors.New("thumbnails: can't encode this type")
// ErrNoEncoderForType represents the error when an encoder couldn't be found for a type.
ErrNoEncoderForType = errors.New("thumbnails: no encoder for this type found")
// ErrNoImageFromAudioFile defines an error when an image cannot be extracted from an audio file
ErrNoImageFromAudioFile = errors.New("thumbnails: could not extract image from audio file")
// ErrNoConverterForExtractedImageFromAudioFile defines an error when the extracted image from an audio file could not be converted
ErrNoConverterForExtractedImageFromAudioFile = errors.New("thumbnails: could not find converter for image extracted from audio file")
// ErrCS3AuthorizationMissing defines an error when the CS3 authorization is missing
ErrCS3AuthorizationMissing = errors.New("thumbnails: cs3source - authorization missing")
)
@@ -25,28 +25,28 @@ type FontMap struct {
DefaultFont string `json:"defaultFont"`
}
// It contains the location of the loaded file (in FLoc) and the FontMap loaded
// FontMapData contains the location of the loaded file (in FLoc) and the FontMap loaded
// from the file
type FontMapData struct {
FMap *FontMap
FLoc string
}
// It contains the location of the font used, and the loaded face (font.Face)
// LoadedFace contains the location of the font used, and the loaded face (font.Face)
// ready to be used
type LoadedFace struct {
FontFile string
Face font.Face
}
// Represents a FontLoader. Use the "NewFontLoader" to get a instance
// FontLoader represents a FontLoader. Use the "NewFontLoader" to get a instance
type FontLoader struct {
faceCache sync.Cache
fontMapData *FontMapData
faceOpts *opentype.FaceOptions
}
// Create a new FontLoader based on the fontMapFile. The FaceOptions will
// NewFontLoader creates a new FontLoader based on the fontMapFile. The FaceOptions will
// be the same for all the font loaded by this instance.
// Note that only the fonts described in the fontMapFile will be used.
//
@@ -92,7 +92,7 @@ func NewFontLoader(fontMapFile string, faceOpts *opentype.FaceOptions) (*FontLoa
}, nil
}
// Load and return the font face to be used for that script according to the
// LoadFaceForScript loads and returns the font face to be used for that script according to the
// FontMap set when the FontLoader was created. If the script doesn't have
// an associated font, a default font will be used. Note that the default font
// might not be able to handle properly the script
@@ -146,14 +146,17 @@ func (fl *FontLoader) LoadFaceForScript(script string) (*LoadedFace, error) {
return loadedFace, nil
}
// GetFaceOptSize returns face opt size
func (fl *FontLoader) GetFaceOptSize() float64 {
return fl.faceOpts.Size
}
// GetFaceOptDPI returns face opt DPI
func (fl *FontLoader) GetFaceOptDPI() float64 {
return fl.faceOpts.DPI
}
// GetScriptList returns script list
func (fl *FontLoader) GetScriptList() []string {
fontMap := fl.fontMapData.FMap.FontMap
@@ -19,6 +19,7 @@ import (
"golang.org/x/image/math/fixed"
"github.com/dhowden/tag"
thumbnailerErrors "github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
)
// FileConverter is the interface for the file converter
@@ -98,12 +99,12 @@ func (i AudioDecoder) Convert(r io.Reader) (interface{}, error) {
picture := m.Picture()
if picture == nil {
return nil, errors.New(`could not extract image from audio file`)
return nil, thumbnailerErrors.ErrNoImageFromAudioFile
}
converter := ForType(picture.MIMEType, nil)
if converter == nil {
return nil, errors.New(`could not find converter for image extraced from audio file`)
return nil, thumbnailerErrors.ErrNoConverterForExtractedImageFromAudioFile
}
return converter.Convert(bytes.NewReader(picture.Data))
@@ -259,7 +260,7 @@ func ForType(mimeType string, opts map[string]interface{}) FileConverter {
fontLoader, err := NewFontLoader(fontFileMap, fontFaceOpts)
if err != nil {
// if couldn't create the FontLoader with the specified fontFileMap,
// if it couldn't create the FontLoader with the specified fontFileMap,
// try to use the default font
fontLoader, _ = NewFontLoader("", fontFaceOpts)
}
@@ -27,8 +27,8 @@ func Server(opts ...Option) (*http.Server, error) {
}
// health implements the health check.
func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
func health(_ *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
@@ -43,8 +43,8 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
}
// ready implements the ready check.
func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
func ready(_ *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
+16 -8
View File
@@ -14,14 +14,15 @@ type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Name string
Address string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Namespace string
TraceProvider trace.TracerProvider
Name string
Address string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Namespace string
TraceProvider trace.TracerProvider
MaxConcurrentRequests int
}
// newOptions initializes the available default options.
@@ -90,3 +91,10 @@ func TraceProvider(val trace.TracerProvider) Option {
o.TraceProvider = val
}
}
// MaxConcurrentRequests provides a function to set the MaxConcurrentRequests option.
func MaxConcurrentRequests(val int) Option {
return func(o *Options) {
o.MaxConcurrentRequests = val
}
}
+11 -2
View File
@@ -1,9 +1,11 @@
package grpc
import (
"github.com/cs3org/reva/v2/pkg/bytesize"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc/handler/ratelimiter"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
thumbnailssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0"
svc "github.com/owncloud/ocis/v2/services/thumbnails/pkg/service/grpc/v0"
@@ -31,6 +33,7 @@ func NewService(opts ...Option) grpc.Service {
grpc.Context(options.Context),
grpc.Version(version.GetString()),
grpc.TraceProvider(options.TraceProvider),
grpc.HandlerWrappers(ratelimiter.NewHandlerWrapper(options.MaxConcurrentRequests)),
)
if err != nil {
options.Logger.Fatal().Err(err).Msg("Error creating thumbnail service")
@@ -54,19 +57,25 @@ func NewService(opts ...Option) grpc.Service {
options.Logger.Error().Err(err).Msg("could not get gateway selector")
return grpc.Service{}
}
b, err := bytesize.Parse(tconf.MaxInputImageFileSize)
if err != nil {
options.Logger.Error().Err(err).Msg("could not parse MaxInputImageFileSize")
return grpc.Service{}
}
var thumbnail decorators.DecoratedService
{
thumbnail = svc.NewService(
svc.Config(options.Config),
svc.Logger(options.Logger),
svc.ThumbnailSource(imgsource.NewWebDavSource(tconf)),
svc.ThumbnailSource(imgsource.NewWebDavSource(tconf, b)),
svc.ThumbnailStorage(
storage.NewFileSystemStorage(
tconf.FileSystemStorage,
options.Logger,
),
),
svc.CS3Source(imgsource.NewCS3Source(tconf, gatewaySelector)),
svc.CS3Source(imgsource.NewCS3Source(tconf, gatewaySelector, b)),
svc.GatewaySelector(gatewaySelector),
)
thumbnail = decorators.NewInstrument(thumbnail, options.Metrics)
@@ -8,6 +8,7 @@ import (
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/metrics"
"github.com/urfave/cli/v2"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
)
// Option defines a single option function.
@@ -76,7 +77,7 @@ func TraceProvider(traceProvider trace.TracerProvider) Option {
if traceProvider != nil {
o.TraceProvider = traceProvider
} else {
o.TraceProvider = trace.NewNoopTracerProvider()
o.TraceProvider = noop.NewTracerProvider()
}
}
}
@@ -39,7 +39,6 @@ func Server(opts ...Option) (http.Service, error) {
svc.Middleware(
middleware.RealIP,
middleware.RequestID,
// ocismiddleware.Secure,
ocismiddleware.Version(
options.Config.Service.Name,
version.GetString(),
@@ -6,7 +6,7 @@ import (
thumbnailssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0"
)
// Interface acting as facade, holding all the interfaces that this
// DecoratedService is an interface acting as facade, holding all the interfaces that this
// thumbnails microservice is expecting to implement.
// For now, only the thumbnailssvc.ThumbnailServiceHandler is present,
// but a future configsvc.ConfigServiceHandler is expected to be added here
@@ -17,7 +17,7 @@ type DecoratedService interface {
thumbnailssvc.ThumbnailServiceHandler
}
// Base type to implement the decorators. It will provide a basic implementation
// Decorator is the base type to implement the decorators. It will provide a basic implementation
// by delegating to the decoratedService
//
// Expected implementations will be like:
@@ -43,7 +43,7 @@ type Decorator struct {
next DecoratedService
}
// Base implementation for the GetThumbnail (for the thumbnailssvc).
// GetThumbnail is the base implementation for the thumbnailssvc.GetThumbnail.
// It will just delegate to the underlying decoratedService
//
// Your custom decorator is expected to overwrite this function,
@@ -34,11 +34,11 @@ func (l logging) GetThumbnail(ctx context.Context, req *thumbnailssvc.GetThumbna
Logger()
if err != nil {
merror := merrors.FromError(err)
switch merror.Code {
fromError := merrors.FromError(err)
switch fromError.GetCode() {
case http.StatusNotFound:
logger.Debug().
Str("error_detail", merror.Detail).
Str("error_detail", fromError.GetDetail()).
Msg("no thumbnail found")
default:
logger.Warn().
@@ -35,10 +35,10 @@ func (t tracing) GetThumbnail(ctx context.Context, req *thumbnailssvc.GetThumbna
defer span.End()
span.SetAttributes(
attribute.KeyValue{Key: "filepath", Value: attribute.StringValue(req.Filepath)},
attribute.KeyValue{Key: "thumbnail_type", Value: attribute.StringValue(req.ThumbnailType.String())},
attribute.KeyValue{Key: "width", Value: attribute.IntValue(int(req.Width))},
attribute.KeyValue{Key: "height", Value: attribute.IntValue(int(req.Height))},
attribute.KeyValue{Key: "filepath", Value: attribute.StringValue(req.GetFilepath())},
attribute.KeyValue{Key: "thumbnail_type", Value: attribute.StringValue(req.GetThumbnailType().String())},
attribute.KeyValue{Key: "width", Value: attribute.IntValue(int(req.GetWidth()))},
attribute.KeyValue{Key: "height", Value: attribute.IntValue(int(req.GetHeight()))},
)
}
@@ -50,13 +50,6 @@ func Config(val *config.Config) Option {
}
}
// Middleware provides a function to set the middleware option.
func Middleware(val ...func(http.Handler) http.Handler) Option {
return func(o *Options) {
o.Middleware = val
}
}
// ThumbnailStorage provides a function to set the thumbnail storage option.
func ThumbnailStorage(val storage.Storage) Option {
return func(o *Options) {
@@ -43,6 +43,8 @@ func NewService(opts ...Option) decorators.DecoratedService {
resolutions,
options.ThumbnailStorage,
logger,
options.Config.Thumbnail.MaxInputWidth,
options.Config.Thumbnail.MaxInputHeight,
),
webdavSource: options.ImageSource,
cs3Source: options.CS3Source,
@@ -116,7 +118,7 @@ func (g Thumbnail) GetThumbnail(ctx context.Context, req *thumbnailssvc.GetThumb
func (g Thumbnail) handleCS3Source(ctx context.Context, req *thumbnailssvc.GetThumbnailRequest) (string, error) {
src := req.GetCs3Source()
sRes, err := g.stat(src.Path, src.Authorization)
sRes, err := g.stat(src.GetPath(), src.GetAuthorization())
if err != nil {
return "", err
}
@@ -125,7 +127,7 @@ func (g Thumbnail) handleCS3Source(ctx context.Context, req *thumbnailssvc.GetTh
if tType == "" {
tType = req.GetThumbnailType().String()
}
tr, err := thumbnail.PrepareRequest(int(req.Width), int(req.Height), tType, sRes.GetInfo().GetChecksum().GetSum(), req.Processor)
tr, err := thumbnail.PrepareRequest(int(req.GetWidth()), int(req.GetHeight()), tType, sRes.GetInfo().GetChecksum().GetSum(), req.GetProcessor())
if err != nil {
return "", merrors.BadRequest(g.serviceID, err.Error())
}
@@ -134,12 +136,12 @@ func (g Thumbnail) handleCS3Source(ctx context.Context, req *thumbnailssvc.GetTh
return key, nil
}
ctx = imgsource.ContextSetAuthorization(ctx, src.Authorization)
r, err := g.cs3Source.Get(ctx, src.Path)
ctx = imgsource.ContextSetAuthorization(ctx, src.GetAuthorization())
r, err := g.cs3Source.Get(ctx, src.GetPath())
if err != nil {
return "", merrors.InternalServerError(g.serviceID, "could not get image from source: %s", err.Error())
}
defer r.Close() // nolint:errcheck
defer r.Close()
ppOpts := map[string]interface{}{
"fontFileMap": g.preprocessorOpts.TxtFontFileMap,
}
@@ -158,13 +160,13 @@ func (g Thumbnail) handleCS3Source(ctx context.Context, req *thumbnailssvc.GetTh
func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.GetThumbnailRequest) (string, error) {
src := req.GetWebdavSource()
imgURL, err := url.Parse(src.Url)
imgURL, err := url.Parse(src.GetUrl())
if err != nil {
return "", errors.Wrap(err, "source url is invalid")
}
var auth, statPath string
if src.IsPublicLink {
if src.GetIsPublicLink() {
q := imgURL.Query()
var rsp *gateway.AuthenticateResponse
client, err := g.selector.Next()
@@ -177,13 +179,13 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.Ge
exp := q.Get("expiration")
rsp, err = client.Authenticate(ctx, &gateway.AuthenticateRequest{
Type: "publicshares",
ClientId: src.PublicLinkToken,
ClientId: src.GetPublicLinkToken(),
ClientSecret: strings.Join([]string{"signature", sig, exp}, "|"),
})
} else {
rsp, err = client.Authenticate(ctx, &gateway.AuthenticateRequest{
Type: "publicshares",
ClientId: src.PublicLinkToken,
ClientId: src.GetPublicLinkToken(),
// We pass an empty password because we expect non pre-signed public links
// to not be password protected
ClientSecret: "password|",
@@ -193,11 +195,11 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.Ge
if err != nil {
return "", merrors.InternalServerError(g.serviceID, "could not authenticate: %s", err.Error())
}
auth = rsp.Token
statPath = path.Join("/public", src.PublicLinkToken, req.Filepath)
auth = rsp.GetToken()
statPath = path.Join("/public", src.GetPublicLinkToken(), req.GetFilepath())
} else {
auth = src.RevaAuthorization
statPath = req.Filepath
auth = src.GetRevaAuthorization()
statPath = req.GetFilepath()
}
sRes, err := g.stat(statPath, auth)
if err != nil {
@@ -208,7 +210,7 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.Ge
if tType == "" {
tType = req.GetThumbnailType().String()
}
tr, err := thumbnail.PrepareRequest(int(req.Width), int(req.Height), tType, sRes.GetInfo().GetChecksum().GetSum(), req.Processor)
tr, err := thumbnail.PrepareRequest(int(req.GetWidth()), int(req.GetHeight()), tType, sRes.GetInfo().GetChecksum().GetSum(), req.GetProcessor())
if err != nil {
return "", merrors.BadRequest(g.serviceID, err.Error())
}
@@ -217,8 +219,8 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.Ge
return key, nil
}
if src.WebdavAuthorization != "" {
ctx = imgsource.ContextSetAuthorization(ctx, src.WebdavAuthorization)
if src.GetWebdavAuthorization() != "" {
ctx = imgsource.ContextSetAuthorization(ctx, src.GetWebdavAuthorization())
}
// add signature and expiration to webdav url
@@ -232,7 +234,7 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *thumbnailssvc.Ge
if err != nil {
return "", merrors.InternalServerError(g.serviceID, "could not get image from source: %s", err.Error())
}
defer r.Close() // nolint:errcheck
defer r.Close()
ppOpts := map[string]interface{}{
"fontFileMap": g.preprocessorOpts.TxtFontFileMap,
}
@@ -272,16 +274,16 @@ func (g Thumbnail) stat(path, auth string) (*provider.StatResponse, error) {
return nil, merrors.InternalServerError(g.serviceID, "could not stat file: %s", err.Error())
}
if rsp.Status.Code != rpc.Code_CODE_OK {
switch rsp.Status.Code {
if rsp.GetStatus().GetCode() != rpc.Code_CODE_OK {
switch rsp.GetStatus().GetCode() {
case rpc.Code_CODE_NOT_FOUND:
return nil, merrors.NotFound(g.serviceID, "could not stat file: %s", rsp.Status.Message)
return nil, merrors.NotFound(g.serviceID, "could not stat file: %s", rsp.GetStatus().GetMessage())
default:
g.logger.Error().Str("status_message", rsp.Status.Message).Str("path", path).Msg("could not stat file")
return nil, merrors.InternalServerError(g.serviceID, "could not stat file: %s", rsp.Status.Message)
g.logger.Error().Str("status_message", rsp.GetStatus().GetMessage()).Str("path", path).Msg("could not stat file")
return nil, merrors.InternalServerError(g.serviceID, "could not stat file: %s", rsp.GetStatus().GetMessage())
}
}
if rsp.Info.Type != provider.ResourceType_RESOURCE_TYPE_FILE {
if rsp.GetInfo().GetType() != provider.ResourceType_RESOURCE_TYPE_FILE {
return nil, merrors.BadRequest(g.serviceID, "Unsupported file type")
}
if utils.ReadPlainFromOpaque(rsp.GetInfo().GetOpaque(), "status") == "processing" {
@@ -292,11 +294,11 @@ func (g Thumbnail) stat(path, auth string) (*provider.StatResponse, error) {
Status: http.StatusText(http.StatusTooEarly),
}
}
if rsp.Info.GetChecksum().GetSum() == "" {
if rsp.GetInfo().GetChecksum().GetSum() == "" {
g.logger.Error().Msg("resource info is missing checksum")
return nil, merrors.NotFound(g.serviceID, "resource info is missing a checksum")
}
if !thumbnail.IsMimeTypeSupported(rsp.Info.MimeType) {
if !thumbnail.IsMimeTypeSupported(rsp.GetInfo().GetMimeType()) {
return nil, merrors.NotFound(g.serviceID, "Unsupported file type")
}
return rsp, nil
@@ -59,14 +59,3 @@ func ThumbnailStorage(storage storage.Storage) Option {
o.ThumbnailStorage = storage
}
}
// TraceProvider provides a function to configure the trace provider
func TraceProvider(traceProvider trace.TracerProvider) Option {
return func(o *Options) {
if traceProvider != nil {
o.TraceProvider = traceProvider
} else {
o.TraceProvider = trace.NewNoopTracerProvider()
}
}
}
@@ -3,12 +3,11 @@ package svc
import (
"context"
"fmt"
"net/http"
"strconv"
"github.com/go-chi/chi/v5"
"github.com/golang-jwt/jwt/v4"
"github.com/riandyrn/otelchi"
"net/http"
"strconv"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
@@ -25,8 +24,8 @@ const (
// Service defines the service handlers.
type Service interface {
ServeHTTP(http.ResponseWriter, *http.Request)
GetThumbnail(http.ResponseWriter, *http.Request)
ServeHTTP(w http.ResponseWriter, r *http.Request)
GetThumbnail(w http.ResponseWriter, r *http.Request)
}
// NewService returns a service implementation for Service.
@@ -58,6 +57,8 @@ func NewService(opts ...Option) Service {
resolutions,
options.ThumbnailStorage,
logger,
options.Config.Thumbnail.MaxInputWidth,
options.Config.Thumbnail.MaxInputHeight,
),
}
@@ -66,7 +67,7 @@ func NewService(opts ...Option) Service {
r.Get("/data", svc.GetThumbnail)
})
_ = chi.Walk(m, func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error {
_ = chi.Walk(m, func(method string, route string, _ http.Handler, middlewares ...func(http.Handler) http.Handler) error {
options.Logger.Debug().Str("method", method).Str("route", route).Int("middlewares", len(middlewares)).Msg("serving endpoint")
return nil
})
@@ -92,7 +93,7 @@ func (s Thumbnails) GetThumbnail(w http.ResponseWriter, r *http.Request) {
logger := s.logger.SubloggerWithRequestID(r.Context())
key := r.Context().Value(keyContextKey).(string)
thumbnail, err := s.manager.GetThumbnail(key)
thumbnailBytes, err := s.manager.GetThumbnail(key)
if err != nil {
logger.Debug().
Err(err).
@@ -103,8 +104,8 @@ func (s Thumbnails) GetThumbnail(w http.ResponseWriter, r *http.Request) {
}
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Length", strconv.Itoa(len(thumbnail)))
if _, err = w.Write(thumbnail); err != nil {
w.Header().Set("Content-Length", strconv.Itoa(len(thumbnailBytes)))
if _, err = w.Write(thumbnailBytes); err != nil {
logger.Error().
Err(err).
Str("key", key).
@@ -112,6 +113,7 @@ func (s Thumbnails) GetThumbnail(w http.ResponseWriter, r *http.Request) {
}
}
// TransferTokenValidator validates a transfer token
func (s Thumbnails) TransferTokenValidator(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logger := s.logger.SubloggerWithRequestID(r.Context())
@@ -2,6 +2,7 @@ package jwt
import "github.com/golang-jwt/jwt/v4"
// ThumbnailClaims defines the claims for thumb-nailing
type ThumbnailClaims struct {
jwt.RegisteredClaims
Key string `json:"key"`
+10 -14
View File
@@ -1,13 +1,14 @@
package thumbnail
import (
"errors"
"image"
"image/gif"
"image/jpeg"
"image/png"
"io"
"strings"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
)
const (
@@ -18,17 +19,10 @@ const (
typeGgs = "ggs"
)
var (
// ErrInvalidType represents the error when a type can't be encoded.
ErrInvalidType = errors.New("can't encode this type")
// ErrNoEncoderForType represents the error when an encoder couldn't be found for a type.
ErrNoEncoderForType = errors.New("no encoder for this type found")
)
// Encoder encodes the thumbnail to a specific format.
type Encoder interface {
// Encode encodes the image to a format.
Encode(io.Writer, interface{}) error
Encode(w io.Writer, img interface{}) error
// Types returns the formats suffixes.
Types() []string
// MimeType returns the mimetype used by the encoder.
@@ -42,7 +36,7 @@ type PngEncoder struct{}
func (e PngEncoder) Encode(w io.Writer, img interface{}) error {
m, ok := img.(image.Image)
if !ok {
return ErrInvalidType
return errors.ErrInvalidType
}
return png.Encode(w, m)
}
@@ -57,14 +51,14 @@ func (e PngEncoder) MimeType() string {
return "image/png"
}
// JpegEncoder encodes to jpg.
// JpegEncoder encodes to jpg
type JpegEncoder struct{}
// Encode encodes to jpg
func (e JpegEncoder) Encode(w io.Writer, img interface{}) error {
m, ok := img.(image.Image)
if !ok {
return ErrInvalidType
return errors.ErrInvalidType
}
return jpeg.Encode(w, m, nil)
}
@@ -79,17 +73,19 @@ func (e JpegEncoder) MimeType() string {
return "image/jpeg"
}
// GifEncoder encodes to gif
type GifEncoder struct{}
// Encode encodes the image to a gif format
func (e GifEncoder) Encode(w io.Writer, img interface{}) error {
g, ok := img.(*gif.GIF)
if !ok {
return ErrInvalidType
return errors.ErrInvalidType
}
return gif.EncodeAll(w, g)
}
// Types returns the supported types of the GifEncoder
func (e GifEncoder) Types() []string {
return []string{typeGif}
}
@@ -110,7 +106,7 @@ func EncoderForType(fileType string) (Encoder, error) {
case typeGif:
return GifEncoder{}, nil
default:
return nil, ErrNoEncoderForType
return nil, errors.ErrNoEncoderForType
}
}
@@ -8,11 +8,12 @@ import (
"strings"
"github.com/kovidgoyal/imaging"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
)
// Generator generates a web friendly file version.
type Generator interface {
Generate(image.Rectangle, interface{}, Processor) (interface{}, error)
Generate(size image.Rectangle, img interface{}, processor Processor) (interface{}, error)
}
// SimpleGenerator is the default image generator and is used for all image types expect gif.
@@ -22,7 +23,7 @@ type SimpleGenerator struct{}
func (g SimpleGenerator) Generate(size image.Rectangle, img interface{}, processor Processor) (interface{}, error) {
m, ok := img.(image.Image)
if !ok {
return nil, ErrInvalidType
return nil, errors.ErrInvalidType
}
return processor.Process(m, size.Dx(), size.Dy(), imaging.Lanczos), nil
@@ -37,7 +38,7 @@ func (g GifGenerator) Generate(size image.Rectangle, img interface{}, processor
m, ok := img.(*gif.GIF)
if !ok {
return nil, ErrInvalidType
return nil, errors.ErrInvalidType
}
// Create a new RGBA image to hold the incremental frames.
srcX, srcY := m.Config.Width, m.Config.Height
@@ -80,6 +81,6 @@ func GeneratorForType(fileType string) (Generator, error) {
case typeGif:
return GifGenerator{}, nil
default:
return nil, ErrNoEncoderForType
return nil, errors.ErrNoEncoderForType
}
}
@@ -10,32 +10,35 @@ import (
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/v2/pkg/bytesize"
revactx "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
"github.com/cs3org/reva/v2/pkg/rhttp"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/config"
"github.com/pkg/errors"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
"google.golang.org/grpc/metadata"
)
const (
// "github.com/cs3org/reva/v2/internal/http/services/datagateway" is internal so we redeclare it here
// TokenTransportHeader holds the header key for the reva transfer token
// "github.com/cs3org/reva/v2/internal/http/services/datagateway" is internal so we redeclare it here
TokenTransportHeader = "X-Reva-Transfer"
)
// CS3 implements a CS3 image source
type CS3 struct {
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
insecure bool
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
insecure bool
maxImageFileSize uint64
}
// NewCS3Source configures a new CS3 image source
func NewCS3Source(cfg config.Thumbnail, gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) CS3 {
func NewCS3Source(cfg config.Thumbnail, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], b bytesize.ByteSize) CS3 {
return CS3{
gatewaySelector: gatewaySelector,
insecure: cfg.CS3AllowInsecure,
gatewaySelector: gatewaySelector,
insecure: cfg.CS3AllowInsecure,
maxImageFileSize: b.Bytes(),
}
}
@@ -44,7 +47,7 @@ func NewCS3Source(cfg config.Thumbnail, gatewaySelector pool.Selectable[gateway.
func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
auth, ok := ContextGetAuthorization(ctx)
if !ok {
return nil, errors.New("cs3source: authorization missing")
return nil, errors.ErrCS3AuthorizationMissing
}
ref, err := storagespace.ParseReference(path)
if err != nil {
@@ -56,6 +59,11 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
}
ctx = metadata.AppendToOutgoingContext(context.Background(), revactx.TokenHeader, auth)
err = s.checkImageFileSize(ctx, ref)
if err != nil {
return nil, err
}
gwc, err := s.gatewaySelector.Next()
if err != nil {
return nil, err
@@ -66,18 +74,18 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
return nil, err
}
if rsp.Status.Code != rpc.Code_CODE_OK {
return nil, fmt.Errorf("could not load image: %s", rsp.Status.Message)
if rsp.GetStatus().GetCode() != rpc.Code_CODE_OK {
return nil, fmt.Errorf("could not load image: %s", rsp.GetStatus().GetMessage())
}
var ep, tk string
for _, p := range rsp.Protocols {
if p.Protocol == "spaces" {
ep, tk = p.DownloadEndpoint, p.Token
for _, p := range rsp.GetProtocols() {
if p.GetProtocol() == "spaces" {
ep, tk = p.GetDownloadEndpoint(), p.GetToken()
break
}
}
if (ep == "" || tk == "") && len(rsp.Protocols) > 0 {
ep, tk = rsp.Protocols[0].DownloadEndpoint, rsp.Protocols[0].Token
if (ep == "" || tk == "") && len(rsp.GetProtocols()) > 0 {
ep, tk = rsp.GetProtocols()[0].GetDownloadEndpoint(), rsp.GetProtocols()[0].GetToken()
}
httpReq, err := rhttp.NewRequest(ctx, "GET", ep, nil)
@@ -93,7 +101,7 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
}
client := &http.Client{}
resp, err := client.Do(httpReq) // nolint:bodyclose
resp, err := client.Do(httpReq)
if err != nil {
return nil, err
}
@@ -104,3 +112,21 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
return resp.Body, nil
}
func (s CS3) checkImageFileSize(ctx context.Context, ref provider.Reference) error {
gwc, err := s.gatewaySelector.Next()
if err != nil {
return err
}
stat, err := gwc.Stat(ctx, &provider.StatRequest{Ref: &ref})
if err != nil {
return err
}
if stat.GetStatus().GetCode() != rpc.Code_CODE_OK {
return fmt.Errorf("could not stat image: %s", stat.GetStatus().GetMessage())
}
if stat.GetInfo().GetSize() > s.maxImageFileSize {
return errors.ErrImageTooLarge
}
return nil
}
@@ -9,21 +9,26 @@ import (
_ "image/png" // Import the png package so that image.Decode can understand pngs
"io"
"net/http"
"strconv"
"github.com/cs3org/reva/v2/pkg/bytesize"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/config"
thumbnailerErrors "github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
"github.com/pkg/errors"
)
// NewWebDavSource creates a new webdav instance.
func NewWebDavSource(cfg config.Thumbnail) WebDav {
func NewWebDavSource(cfg config.Thumbnail, b bytesize.ByteSize) WebDav {
return WebDav{
insecure: cfg.WebdavAllowInsecure,
insecure: cfg.WebdavAllowInsecure,
maxImageFileSize: b.Bytes(),
}
}
// WebDav implements the Source interface for webdav services
type WebDav struct {
insecure bool
insecure bool
maxImageFileSize uint64
}
// Get downloads the file from a webdav service
@@ -44,7 +49,7 @@ func (s WebDav) Get(ctx context.Context, url string) (io.ReadCloser, error) {
}
client := &http.Client{}
resp, err := client.Do(req) // nolint:bodyclose
resp, err := client.Do(req)
if err != nil {
return nil, errors.Wrapf(err, `could not get the image "%s"`, url)
}
@@ -53,5 +58,18 @@ func (s WebDav) Get(ctx context.Context, url string) (io.ReadCloser, error) {
return nil, fmt.Errorf("could not get the image \"%s\". Request returned with statuscode %d ", url, resp.StatusCode)
}
contentLength := resp.Header.Get("Content-Length")
if contentLength == "" {
// no size information - let's assume it is too big
return nil, thumbnailerErrors.ErrImageTooLarge
}
c, err := strconv.ParseUint(contentLength, 10, 64)
if err != nil {
return nil, errors.Wrapf(err, `could not parse content length of webdav response "%s"`, url)
}
if c > s.maxImageFileSize {
return nil, thumbnailerErrors.ErrImageTooLarge
}
return resp.Body, nil
}
Loaded 100 of 254 files, more files were not shown because too many files have changed in this diff. Show more