-
Notifications
You must be signed in to change notification settings - Fork 50
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
Adding localstack to citrineos core #295
Conversation
@@ -0,0 +1,37 @@ | |||
#!/bin/bash | |||
|
|||
echo "Waiting for LocalStack to start..." |
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.
Wondering if this is working. I ran docker compose up -d
and took a look at the local stack container logs and see
2024-11-22 14:30:50 2024-11-22T13:30:50.279 DEBUG --- [ady_monitor)] localstack.runtime.init : Running READY script /etc/localstack/init/ready.d/init-localstack.sh
2024-11-22 14:30:50 2024-11-22T13:30:50.281 ERROR --- [ady_monitor)] localstack.runtime.init : Error while running script Script(path='/etc/localstack/init/ready.d/init-localstack.sh', stage=READY, state=ERROR)
2024-11-22 14:30:50 Traceback (most recent call last):
2024-11-22 14:30:50 File "/opt/code/localstack/localstack-core/localstack/runtime/init.py", line 163, in run_stage
2024-11-22 14:30:50 runner.run(script.path)
2024-11-22 14:30:50 File "/opt/code/localstack/localstack-core/localstack/runtime/init.py", line 93, in run
2024-11-22 14:30:50 exit_code = subprocess.call(args=[], executable=path)
2024-11-22 14:30:50 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-22 14:30:50 File "/usr/local/lib/python3.11/subprocess.py", line 389, in call
2024-11-22 14:30:50 with Popen(*popenargs, **kwargs) as p:
2024-11-22 14:30:50 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-22 14:30:50 File "/usr/local/lib/python3.11/subprocess.py", line 1026, in __init__
2024-11-22 14:30:50 self._execute_child(args, executable, preexec_fn, close_fds,
2024-11-22 14:30:50 File "/usr/local/lib/python3.11/subprocess.py", line 1955, in _execute_child
2024-11-22 14:30:50 raise child_exception_type(errno_num, err_msg, err_filename)
2024-11-22 14:30:50 PermissionError: [Errno 13] Permission denied: '/etc/localstack/init/ready.d/init-localstack.sh'
Might just be my end. Do you see it run correctly?
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.
It started up fine for me:
2024-12-02 16:46:11 2024-12-02T21:46:11.571 DEBUG --- [ady_monitor)] localstack.runtime.init : Running READY script /etc/localstack/init/ready.d/init-localstack.sh
2024-12-02 16:46:11 Waiting for LocalStack to start...
2024-12-02 16:46:11 2024-12-02T21:46:11.623 DEBUG --- [et.reactor-0] l.a.p.service_router : building service catalog index cache file /var/lib/localstack/cache/service-catalog-4_0_4_dev2-1_35_71.pickle
2024-12-02 16:46:20 2024-12-02T21:46:20.558 DEBUG --- [et.reactor-1] l.aws.handlers.service : no service set in context, skipping request parsing
2024-12-02 16:46:20 2024-12-02T21:46:20.566 INFO --- [et.reactor-1] localstack.request.http : GET / => 200
2024-12-02 16:46:20 2024-12-02T21:46:20.569 DEBUG --- [et.reactor-0] l.aws.handlers.service : no service set in context, skipping request parsing
2024-12-02 16:46:20 2024-12-02T21:46:20.569 INFO --- [et.reactor-0] localstack.request.http : GET / => 200
2024-12-02 16:46:20 LocalStack is up. Initializing S3 bucket...
2024-12-02 16:46:22 2024-12-02T21:46:22.627 DEBUG --- [et.reactor-0] plux.runtime.manager : instantiating plugin PluginSpec(localstack.aws.provider.s3:default = <function s3 at 0x7f2154dfd1c0>)
2024-12-02 16:46:22 2024-12-02T21:46:22.627 DEBUG --- [et.reactor-0] plux.runtime.manager : loading plugin localstack.aws.provider:s3:default
2024-12-02 16:46:22 2024-12-02T21:46:22.950 INFO --- [et.reactor-0] localstack.request.aws : AWS s3.CreateBucket => 200
2024-12-02 16:46:22 {
2024-12-02 16:46:22 "Location": "/citrineos-s3-bucket"
2024-12-02 16:46:22 }
2024-12-02 16:46:25 2024-12-02T21:46:25.042 DEBUG --- [et.reactor-1] l.aws.handlers.service : no service set in context, skipping request parsing
2024-12-02 16:46:25 2024-12-02T21:46:25.043 INFO --- [et.reactor-1] localstack.request.http : GET / => 200
2024-12-02 16:46:28 Applying CORS configuration...
2024-12-02 16:46:30 2024-12-02T21:46:30.457 DEBUG --- [et.reactor-0] l.aws.handlers.service : no service set in context, skipping request parsing
2024-12-02 16:46:30 2024-12-02T21:46:30.457 INFO --- [et.reactor-0] localstack.request.http : GET / => 200
2024-12-02 16:46:31 2024-12-02T21:46:31.879 INFO --- [et.reactor-1] localstack.request.aws : AWS s3.PutBucketCors => 200
2024-12-02 16:46:32 CORS configuration applied successfully.
2024-12-02 16:46:32 Verifying bucket and CORS configuration...
2024-12-02 16:46:35 2024-12-02T21:46:35.994 INFO --- [et.reactor-0] localstack.request.aws : AWS s3.GetBucketCors => 200
2024-12-02 16:46:36 {
2024-12-02 16:46:36 "CORSRules": [
2024-12-02 16:46:36 {
2024-12-02 16:46:36 "AllowedHeaders": [
2024-12-02 16:46:36 "*"
2024-12-02 16:46:36 ],
2024-12-02 16:46:36 "AllowedMethods": 2024-12-02T21:46:36.025 DEBUG --- [et.reactor-1] l.aws.handlers.service : no service set in context, skipping request parsing
2024-12-02 16:46:36 2024-12-02T21:46:36.026 INFO --- [et.reactor-1] localstack.request.http : GET / => 200
2024-12-02 16:46:36 [
2024-12-02 16:46:36 "GET",
2024-12-02 16:46:36 "PUT",
2024-12-02 16:46:36 "POST",
2024-12-02 16:46:36 "DELETE"
2024-12-02 16:46:36 ],
2024-12-02 16:46:36 "AllowedOrigins": [
2024-12-02 16:46:36 "*"
2024-12-02 16:46:36 ],
2024-12-02 16:46:36 "ExposeHeaders": [
2024-12-02 16:46:36 "ETag"
2024-12-02 16:46:36 ]
2024-12-02 16:46:36 }
2024-12-02 16:46:36 ]
2024-12-02 16:46:36 }
2024-12-02 16:46:36 Ready.
The error you received sounds like a permissions issue. we should see if it can be fixed locally?
02_Util/src/fileAccess/s3Storage.ts
Outdated
}) | ||
.promise(); | ||
|
||
return result.Location; |
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.
This return value isn't equivalent to the fileId used to fetch the file in the getFile method. result.Location is the url to the file. In order to correctly implement the interface, this needs to return just the file id, so that:
iFileAccess.getFile(iFileAccess.uploadFile([...]));
would work.
To make this clearer in the future, we should add javadoc descriptions to these methods on the interface as part of this PR.
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.
mostly looks good, one correction needs to be made.
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.
approved
Adding aws sdk. Implementing localstack as an aws local for S3 usage. Set up AWS S3 locally.