disorientations / disorientations.org

An informal archive of 100+ disorientation publications by student activists, threading counter-narratives across institutions.
https://disorientations.org
GNU General Public License v3.0
1 stars 0 forks source link

configure s3 to use CNAME #53

Open caseyg opened 4 years ago

caseyg commented 4 years ago

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/

elazar commented 4 years ago

Some initial notes:

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.