-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add draft of S3 avatars implemented as JiraHomeSource wrapper #168
Conversation
Context: In Hadrons team during today's standup @dagguh suggested to show the suggestion as a code. I didn't manage to create complete code as I had some gaps in my knowledge about the feature:
|
ssh: SshConnection | ||
) = delegate | ||
.download(ssh) | ||
.also { jiraHomeLocation -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would we ensure that uploadToS3
runs only on the shared home (NFS) and that updateFilestoreConfig
runs only on application nodes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not ensure that? I was thinking if aws s3 sync
wouldn't resolve that problem for us. sync
executed twice shouldn't duplicate any work.
Thanks for taking a look and writing this example! In this approach, how would To answer your questions:
Target is the the target of that association. It can be either
Yep. Though I don't see any need to configure a second one for the JPT tests at this point.
It's only used to tell Jira where to look for avatars/attachments at this point. Could be extended if we store other data there in the future, though there are no projects lined up to do that at this point (nor have I heard discussion to do it).
That is possible. Not sure of the advantage of that though.
They get configured differently in filestores-config.xml (they have different targets). Also the uploading logic is different. To get reasonable performance I had to split up avatars into different directories so I can run parallel jobs with XARGS. Also note that I did try using If the issue with the Enum is that it's in API and adding new items can break backward compatibility, just brainstorming, some other approaches could be:
|
The desired advantage would be simplicity of the implementation which would also affect maintainability of the code around the feature. In the future we'd like to refactor
In the original bash script we are using 30 xarg processes and the default Not sure if 300 is allowed, as I can't find any documented boundry for that property. I think it's worth checking if setting it to some high value wouldn't be good enough, because the complexity of the code is drastically reduced and we are relying on dedicated feature for the purpose, so we can easily rely on automated tests done by AWS cli devs.
I think that doesn't need to be ugly and it may be the simple solution that we need. We could have a single object which would hold the configuration of the feature including 2 booleans. Not very OOP approach, but it should be good enough for me. |
Yes, the usage would be to wrap You can check JiraUserPasswordOverridingDatabase for similar usage pattern. We are using it like this, e.g. here The problem with this approach would be that the API discoverability is not the best. When we model |
I'll give it a try using
Ok, sounds good! |
Ok thanks for the explanation! That makes sense. I see most of the pieces to make this work with the approach you outlined. There are still a couple missing though. The main one is probably determining which node we're on. Since you mentioned the two-boolean approach looks good-enough I'll update to that for now. |
This doesn't really work without
FilestoreConfigAppender
ands3StorageProvider
implementations. It also wasn't really tested, however it's a demonstration of how the feature could be implemented using polymorphism on top ofJiraHomeSource
.FilestoreConfigAppender
interface is rather poor. Should probably be refined into something better modeled.I used
aws s3 sync
, as it should better fit our use case where we actually want to ensure all files are present in S3 storage.I used
StorageLocation
as it knows how the URI should look like and stores related AWS region.Not sure if
aws configure set default.s3.max_concurrent_requests 300
can replace the usage ofxargs
to split the processes. I think it's worth testing, as this approach may be simpler.Feel free to rebuild this code and reuse it's elements elsewhere.