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

configure s3 to use CNAME #53

Open
caseyg opened this issue Jun 6, 2020 · 1 comment
Open

configure s3 to use CNAME #53

caseyg opened this issue Jun 6, 2020 · 1 comment
Assignees
Labels

Comments

@caseyg
Copy link
Member

caseyg commented Jun 6, 2020

I set up a CNAME for our s3 bucket: files.disorientations.org

instead of loading:

https://s3.amazonaws.com/files.disorientations.org/original/Barnard_Columbia_University/2017/Barnard_20Columbia_20Disorientation_20Guide_202017.pdf

we should load:

https://files.disorientations.org/original/Barnard_Columbia_University/2017/Barnard_20Columbia_20Disorientation_20Guide_202017.pdf

The CNAME already works, but the module still points to the s3 url. We might need to modify the S3 module to make this happen?

I might also have to setup HTTPS for the S3 bucket.

https://thenewstack.io/how-to-set-up-your-s3-bucket-with-https-in-an-hour/

@caseyg caseyg added the omeka label Jun 6, 2020
@elazar
Copy link
Contributor

elazar commented Jun 6, 2020

Some initial notes:

bucket_endpoint: (bool) Set to true to send requests to a hardcoded bucket endpoint rather than create an endpoint as a result of injecting the bucket into the URL. This option is useful for interacting with CNAME endpoints.

endpoint: (string) The full URI of the webservice. This is only required when connecting to a custom endpoint (e.g., a local version of S3).

I tested this by making the modification below in my local development environment, and it appears to work.

diff --git a/modules/AmazonS3/src/File/Store/AwsS3.php b/modules/AmazonS3/src/File/Store/AwsS3.php
index b3b3eead..4f5d9836 100644
--- a/modules/AmazonS3/src/File/Store/AwsS3.php
+++ b/modules/AmazonS3/src/File/Store/AwsS3.php
@@ -56,6 +56,8 @@ class AwsS3 implements StoreInterface
             'version' => 'latest',
             'region' => $awsRegion,
             'credentials' => new Credentials($awsKey, $awsSecretKey),
+            'bucket_endpoint' => true,
+            'endpoint' => 'https://files.disorientations.org',
         ]);
 
         $this->client->registerStreamWrapper();

However, this change is specific to our installation and as such can't be contributed upstream. This is a concern because we want our local instance of the module to diverge as little as possible from upstream to avoid making any future module upgrades more difficult.

It would be preferable to work around this without modifying module code, but I'm not sure that's possible because the module isn't configured to autoload external code. So, this will likely require a change to the module itself.

@elazar elazar self-assigned this Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants