Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.1+

Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.1+

No permission to download
You should remove or comment out the code you added to the config file to ensure it is properly disabled.

You can comment it out by adding two forward slashes // at the start of each line of code you do not want to run.
 
You should remove or comment out the code you added to the config file to ensure it is properly disabled.

You can comment it out by adding two forward slashes // at the start of each line of code you do not want to run.
Oh I see, I thought just Enable/Disable with one click like other add-ons, so this isn't a bug? So should you write a simple note in Overview add-on's page for everyone knows how to Enable/Disable properly ?
 
Any idea about how to get the images from posts to go to S3? When uploading image it stays local, adding an image by attach files it correctly goes to S3.
 
Chris, thanks for this piece of awesomness.

Has anyone an ideo, how to use DigitalOcean with a subdomain , while using cloudflare and Lets encrypt ? My setting is Host (Lets encrypt) <--> Cloudflare (Cloudflare wildcard certificate) <--> DigitalOcean, DNS is handled via Cloudflare. DigitalOcean of course is refusing the connection to cloudflare, since I can´t add the cloudflare certificate to Digitaloceans settings and so it´s complaining about an invalid certificate.
 
Chris, thanks for this piece of awesomness.

Has anyone an ideo, how to use DigitalOcean with a subdomain , while using cloudflare and Lets encrypt ? My setting is Host (Lets encrypt) <--> Cloudflare (Cloudflare wildcard certificate) <--> DigitalOcean, DNS is handled via Cloudflare. DigitalOcean of course is refusing the connection to cloudflare, since I can´t add the cloudflare certificate to Digitaloceans settings and so it´s complaining about an invalid certificate.
I'm using subdomain through DigitalOcean
You need to run CLI command to create SSL wildcard for domain, and you need to verify TXT record while doing that, after that you'll get a fullchain.pem and prikey.pem, open that 2 files and and copy it, go into DO space and go to CDN setting, edit it and add new subdomain certificate, paste 2 files you were copied, and then you're done
Don't forget to create CNAME Record in your cloudflare to point it to DO space (Example: abc.ams3cdn.digitaloceanspaces.com)
 
I'm using subdomain through DigitalOcean
You need to run CLI command to create SSL wildcard for domain, and you need to verify TXT record while doing that, after that you'll get a fullchain.pem and prikey.pem, open that 2 files and and copy it, go into DO space and go to CDN setting, edit it and add new subdomain certificate, paste 2 files you were copied, and then you're done
Don't forget to create CNAME Record in your cloudflare to point it to DO space (Example: abc.ams3cdn.digitaloceanspaces.com)
Thanks for your reply. Are you proxying your subdomain through cloudflare with a cloudflare wildcard cert or are you only pointing the subdomain in the cloudflare CNAME entry to DO, without proxying?
 
Of course it does.

The whole point of this is that XF 2.x has an abstracted file system. As long as developers use the abstracted file system (which, of course, we do in all of our products) then any file storage adapter that you enable, such as DO Spaces / S3, will work with almost all file storage operations the forum uses.
 
Thanks for your reply. Are you proxying your subdomain through cloudflare with a cloudflare wildcard cert or are you only pointing the subdomain in the cloudflare CNAME entry to DO, without proxying?
I'm using with proxying through cloudflare
 
Full size image media will be hosted on S3 but streamed via an internal URL (this is how all attachment URLs in XF work as it allows us to take care of permissions).
 
Has anyone successfully used this on XF 2.0, and then upgraded to XF 2.1?

I merged the XF 2.1 files into my install, updated to the XF 2.1 version of this add-on, removed autoloading for AWS SDK from config.php, and then went to install/index.php?upgrade/, but get a fatal error:
Code:
Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found in src/config.php at line 27
 
Please help !!!

I have a few forums that I'm setting up to 'host' videos.

I have setup 3 amazon AWS S3 hosting spaces, configured those, and with a test file, those are live and online.
I've uploaded the Add-on (For 2.1) and have setup the config file, and I just keep getting error 500 (site-wide) when I add the main 4 lines of code.

It's as if the add-on hasn't worked. It can't find the files or something. I have my server guy giving me a hand now. So hoping there's something we can do to test?

The main error we seem to get is

'XFAws\\Composor' not found in..../var/www etc etc

Proxy FCGI error it seems to be, PID 6941 (if that helps anything at all)

Any help?
 
YOU DO NOT NEED the 4 lines of "\XFAws\Composer" in your config.php if you are using XenForo 2.1! See Mike's posts quoted below!


Please help !!!

I have a few forums that I'm setting up to 'host' videos.

I have setup 3 amazon AWS S3 hosting spaces, configured those, and with a test file, those are live and online.
I've uploaded the Add-on (For 2.1) and have setup the config file, and I just keep getting error 500 (site-wide) when I add the main 4 lines of code.

It's as if the add-on hasn't worked. It can't find the files or something. I have my server guy giving me a hand now. So hoping there's something we can do to test?

The main error we seem to get is

'XFAws\\Composor' not found in..../var/www etc etc

Proxy FCGI error it seems to be, PID 6941 (if that helps anything at all)

Any help?
should we download AWS SDK and place somewhere because simply adding these lines
Code:
\XFAws\Composer::autoloadNamespaces(\XF::app());
\XFAws\Composer::autoloadPsr4(\XF::app());
\XFAws\Composer::autoloadClassmap(\XF::app());
\XFAws\Composer::autoloadFiles(\XF::app());
gives errors


The 2.1 version doesn't need those files as it uses the core composer support. The 2.1 version doesn't even come with a listener to reference those files.

Are you upgrading to the 2.1 version or is this a fresh install?
Actually, just coming back to this point, emphasis added.

If you say they're exactly the same, does that mean you still have the lines like \XFAws\Composer::autoloadNamespaces(\XF::app()); in your config.php? If so, note that those are in the 2.0.x only section of the description -- you don't do that for 2.1. You really just need the fsAdapters override (after the add-on is installed).
Ah, just seen that in the Update section for the addon
View attachment 193296

Could maybe make it a little clearer on the initial install instructions page for XF2.1, unless I missed something else on the front page :X3:
 
Hi @Chris D

Thanks for your job to extend this function to the community!

I'm trying to use this addon for my site, but with a little different. The little different here is I use another S3 service (promising similar Amazon S3 service, but faster for our members). However, I'm not lucky enough. The manual and settings are simple, but I don't know why and how to find the error. After update config.php, I could not find the error, the message shows after I changed avatar: "A server error occurred. Please try again later."

Code:
$s3 = function()
{
   return new \Aws\S3\S3Client([
      'credentials' => [
         'key' => '1234567890',
         'secret' => 'ABCDEF'
      ],
      'region' => '',
      'version' => 'latest',
      'endpoint' => 'https://s3.cloud.cmctelecom.vn'
   ]);
};

$config['fsAdapters']['data'] = function() use($s3)
{
   return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), 'BUCKET_NAME', 'data');
};

$config['externalDataUrl'] = function($externalPath, $canonical)
{
   return 'https://BUCKET_NAME.s3.cloud.cmctelecom.vn/data/' . $externalPath;
};

This is the document about CMC S3 Service, I see that there is enough for permission and operations: https://cloud.cmctelecom.vn/market-place/iaas/CMC Storage S3 API Document.pdf

So do you have any guide or hint for me to find a way to solve this issue? Thank you very much!
 
Top Bottom