feat(generic_sender): add s3 transport to generic_sender
Description
feat(generic_sender): add s3 transport to generic_sender
- created new S3Transport class to generic_sender.py that supports sending data to an S3 bucket
- after the data is uploaded, an url endpoint is called if configured
- configuration of the s3 transfer, including the url endpoint, is stored in
/etc/perun/services/{service_name}/{service_name}.py
- the original send() method of Transfer class has been modularized into two extra methods
-
get_custom_config_properties()
is now used ingeneric_sender.py
as part of the S3Transfer class, and has been moved up into "active area" - The configuration setup as it is now allows for individual configuration of s3 bucket, credentials and url call for each individual service.
How to test
- Set up an S3 bucket to upload data to, or use an existing one you have access to
- Generate data using a gen script of chosen service
- Make sure its is one whose send script either already uses
generic_sender.py
or you need to change it to use it
- Make sure its is one whose send script either already uses
- Configure the s3 transfer and url call in
/etc/perun/services/{service_name}/{service_name}.py
file (https://httpstat.us/ can help with testing the url call) - Run the send script with your generated data in the format of
<path to script> FACILITY_NAME DESTINATION DESTINATION_TYPE SERVICE_NAME
with DESTINATION being the name of the s3 bucket (without thes3://
prefix) and DESTINATION_TYPE beings3
- An example can look like this:
$ ./passwd facility-name s3transfer-test s3 passwd
- An example can look like this:
- Easiest way to check the uploaded data is, in my opinion, via AWS cli
- After setting it up, you can see the contents of the bucket with
aws s3 ls s3://{bucket_name}
- The uploaded data should be uploaded as
{facility_name}/{service_name}.tar.gz
- You can download the data with
aws s3 cp s3://{bucket_name>}/{facility_name}/{service_name}.tar.gz <local path>
- After setting it up, you can see the contents of the bucket with
Author's checklist
-
I have followed the contribution guidelines -
This MR has been tested or does not change functionality -
I have added relevant merge request dependencies (if this MR has any) -
I have added the correct labels -
I have assigned reviewers (if any are relevant) -
I have edited the documentation (if the changes require it) or I have noted the need for the change if I do not have access to the documentation -
I have marked all introduced BREAKING CHANGES or necessary DEPLOYMENT NOTES in the commit message(s)
Reviewer's checklist
-
This MR has been tested or does not change functionality -
This MR has correct commit message format
Closes STR-1379
Edited by Michal Berky