Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a AWS S3 backend for article storage #1295

Closed
bschmalhofer opened this issue Oct 4, 2021 · 27 comments
Closed

Provide a AWS S3 backend for article storage #1295

bschmalhofer opened this issue Oct 4, 2021 · 27 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bschmalhofer
Copy link
Contributor

Currently articles, including attachments, can be stored in the file system and in the database. Allowing storage in S3 would be nice to have. This would also be a good option for running OTOBO in Kubernetes. See also #193 and #1148.

For local development https://hub.docker.com/r/localstack/localstack can be used. There are several S3 modules on CPAN.
Amazon::S3::Thin looks like a sane option, https://metacpan.org/release/AKIYM/Amazon-S3-Thin-0.30/view/lib/Amazon/S3/Thin.pm.

@bschmalhofer bschmalhofer added the enhancement New feature or request label Oct 4, 2021
@bschmalhofer bschmalhofer added this to the OTOBO 10.1 milestone Oct 4, 2021
@bschmalhofer bschmalhofer self-assigned this Oct 4, 2021
@bschmalhofer
Copy link
Contributor Author

Got started on a S3 backend.

The first finding is that localstack looks usable.

The second finding is that Amazon::S3::Thin has no way to specify the endpoint. The can be worked with some Sub::Override magic. The alternatives to using that module is to use modules that require Moose.

@bschmalhofer
Copy link
Contributor Author

Found an incorrect error message in Kernel/System/Ticket,pm. This can be handled in a separate issue.

@bschmalhofer
Copy link
Contributor Author

Also nice to have: Article backend using OpenStack Swift

@bschmalhofer
Copy link
Contributor Author

The article backend has the feature the the plain text and the attachments of articles are grouped by year, month, and day. This is a nice setup and should be carried over to the S3 backend. This is for consistency than for technical requirements.

bschmalhofer added a commit to RotherOSS/otobo-docker that referenced this issue Oct 8, 2021
bschmalhofer added a commit to RotherOSS/otobo-docker that referenced this issue Oct 8, 2021
…_service

Issue RotherOSS/otobo#1295: add a compose snippet for starting localstack
bschmalhofer added a commit that referenced this issue Oct 8, 2021
bschmalhofer added a commit that referenced this issue Oct 8, 2021
The prefix needs the trailing delimiter
bschmalhofer added a commit that referenced this issue Oct 8, 2021
bschmalhofer added a commit that referenced this issue Oct 8, 2021
bschmalhofer added a commit that referenced this issue Oct 8, 2021
@bschmalhofer
Copy link
Contributor Author

@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Oct 13, 2021

Additional options would be nice to have in the console command Admin::Article::StorageSwitch:

  • -- source for specifying the source irrespective of the SysConfig
  • --keep-source for specifying that articles should not be deleted in the source
  • --update-sysconfig for updating the article storage in the SysConfig

Other inconsistencies might be lurking too when switching storage. Take an attachment that is stored in the source without content disposition. During the switching ArticleAttachment() is called and a default disposition is assigned to the article. This disposition is then stored in the target. All is well as long as the rules for the defaults don't change. If they do change we might get a discrepancy.

bschmalhofer added a commit that referenced this issue Oct 13, 2021
Tentatively implement missing methods
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Nov 25, 2021

Latest run of the test suite still showed the same spurious failures:

Test Summary Report

/opt/otobo/scripts/test/Selenium/Agent/MultiAttachmentUpload/CreateScreens.t (Wstat: 256 Tests: 38 Failed: 1)
Failed test: 38
Non-zero exit status: 1
/opt/otobo/scripts/test/Selenium/TestingMethods.t (Wstat: 0 Tests: 36 Failed: 0)
TODO passed: 21, 24, 28
/opt/otobo/scripts/test/SysConfig/GlobalEffectiveValueGet.t (Wstat: 256 Tests: 3 Failed: 1)
Failed test: 2
Non-zero exit status: 1
/opt/otobo/scripts/test/WebUserAgent.t (Wstat: 1024 Tests: 121 Failed: 4)
Failed tests: 76-77, 89, 101
Non-zero exit status: 4
Files=956, Tests=81627, 7271 wallclock secs (30.34 usr 3.20 sys + 1919.49 cusr 222.26 csys = 2175.29 CPU)
Result: FAIL
ran tests for product OTOBO 10.1.x on host 60b1be1a1c42 .

Might be worthwhile to investigate a bit more. See also #1067.

@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Nov 27, 2021

TODO:

It would be nice if Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageS3.pm would not use internal attributes from the Kernel::System::Storage::S3 object. This includes the attribute S3Object. This might means that Kernel::System::Storage::S3 might need a couple of additional methods.

  • do not use the S3Object directly

@bschmalhofer bschmalhofer modified the milestones: OTOBO 10.1, OTOBO 10.1.1 Nov 28, 2021
@bschmalhofer
Copy link
Contributor Author

Some new methods have been added to Kernel::System::Storage::S3. These should be covered in scripts/test/Storage/S3.t.

@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented Nov 28, 2021

TODO:

  • fix newly occuring test failures
  • simplify ArticleAttachmentIndexRaw(), also get FilesizeRaw from the Headers

@bschmalhofer
Copy link
Contributor Author

The test suite is now back to the usual. Merging now.

Test Summary Report

/opt/otobo/scripts/test/Selenium/Agent/MultiAttachmentUpload/CreateScreens.t (Wstat: 256 Tests: 38 Failed: 1)
Failed test: 38
Non-zero exit status: 1
/opt/otobo/scripts/test/Selenium/TestingMethods.t (Wstat: 0 Tests: 36 Failed: 0)
TODO passed: 21, 24, 28
/opt/otobo/scripts/test/SysConfig/GlobalEffectiveValueGet.t (Wstat: 256 Tests: 3 Failed: 1)
Failed test: 2
Non-zero exit status: 1
/opt/otobo/scripts/test/WebUserAgent.t (Wstat: 1024 Tests: 121 Failed: 4)
Failed tests: 76-77, 89, 101
Non-zero exit status: 4
Files=956, Tests=81610, 7403 wallclock secs (30.91 usr 3.27 sys + 1957.41 cusr 229.63 csys = 2221.22 CPU)
Result: FAIL
ran tests for product OTOBO 10.1.x on host 2fbf14cbfc8d .

bschmalhofer added a commit that referenced this issue Nov 29, 2021
This still allows parallel processes of the HEAD requests.
All interactions with S3 are now wrapped in Kernel::System::Storage::S3.
Metadataprefix is now also set up in Kernel/Config.pm
bschmalhofer added a commit that referenced this issue Nov 29, 2021
at least kind of, currently only works with '/'
bschmalhofer added a commit that referenced this issue Nov 29, 2021
bschmalhofer added a commit that referenced this issue Nov 29, 2021
when constructing a S3 key
bschmalhofer added a commit that referenced this issue Nov 29, 2021
@bschmalhofer
Copy link
Contributor Author

There is still a test failure that needs to be investigated: SysConfig/GlobalEffectiveValueGet.t

@bschmalhofer
Copy link
Contributor Author

S3 article backend is working. New findings get their own issue. Closing this issue.

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

No branches or pull requests

1 participant