Jump to content

Community Guide on Setting Up Backblaze and CloudFlare


Recommended Posts

Hello 🙂

(This is a community guide on how to setup Backblaze and Cloudflare, as a significantly cheaper replacement for Amazon S3 and Cloudfront.  The author has no affiliate arrangement with any of the companies listed in the guide and offers the guide as a free community resource.  You should consult with your hosting provider and / or server administrator before proceeding with the guide.)

The tutorial is tested with the latest version of Invision 4.5.4 !


Invision Community allows a file storage configuration with Amazon S3 and a content distribution network (CDN) of your choice:

 

WHAT IS BACKBLAZE?

 

1.png

 

Backblaze is an infinitely Scalable B2 Cloud Storage. Backblaze B2 is enterprise-grade, S3 compatible storage that companies around the world use to store and serve data. Backblaze's service works with native APIs, CLI, and GUI; you can move and manage data with minimal coding. Their service provides fast access all the time; there is no need to accept delays or pay speed surcharges. It can also support HIPAA compliant storage with their Business Associates Agreement (BAA). B2 is compatible at ¼ the cost of AWS S3 with no hidden fees or minimums.

 

Backblaze is an award winning cloud storage provider for 2020 !

 

2.jpg

 

Pricing:

 

3.png

Based on their latest pricing, it is very cheap at around 5$ per 1TB storage per month! There is a cost for direct downloads (bandwidth) at 0.01$ per GB but it will not affect us as we will use Cloudflare and all files will be served from Backblaze to Cloudflare and then to users that is totally free 🙂

Be careful if you have any custom direct downloads that bypass Cloudflare. If you link to custom downloads directly, you will be charged for bandwidth. All default Invision files should go through Cloudflare. I am using Backblaze for a few of my clients and they never charged anything extra as all Invision files are going through Cloudflare as expected. Please monitor your balance after a few days just to be sure!

 

GUIDE:

BEFORE PROCEEDING, PLEASE BACKUP YOUR DATA FIRST!

 

STEP 1: Create a bucket on Backblaze

First we need to sign up at Backblaze Cloud: https://www.backblaze.com/b2/sign-up.html

You will need a phone number to activate your account:

2.png

After the activation of the account we will need to create a bucket that will host our files.

 

On the Buckets sections we click on Create a Bucket:

4.png

 

Then we add a name for our bucket. Recommendation: avoid dots (.) in the bucket name.

 

On the next screen we type a Bucket name and we select Public and then we click at Create a Bucket.

5.png

 

 

After that under the Create a Bucket we should have our Bucket.

 

Now we must keep a note of the ENDPOINT:

endpoint.png

 

 

Now we need to get our Bucket access keys from the App Keys menu. At the bottom we click at Add a New Application Key:

7.png

 

 

At the new screen we select a anything as a key name and we keep selected the Read and Write access and wee click at Create New Key:

8.png

 

 

Then you will see there only once the KeyID and the Application Key that we must keep a note of them as we will need them later !

9.png

 

As a last step we need to go to our bucket that we just created and upload an image. From the menu on the left we click on Browse Files and then we click on our bucket:

10.png

 

Then we click on upload and we upload a simple file like an image...

11.png

 

On the right side of the uploaded image we have to click at the info icon:

13.png

 

At the pop up screen we need to keep a note for that part so copy it with the other notes that wee have already:

14.png

 

That's it ! We created our bucket and we got the access info that we will need !

 

STEP 2: Create a CNAME dns record at Cloudflare

 

Now you have to login to Cloudflare and go to your DNS tab from the top menu and then click Add record:

 

15.png

 

We use as Type the Cname and as Name the cdn and as Target the info that we got from the pop on the previous step in the tutorial above:

16.png

 

After saving that DNS record we should have that:

17.png

 

Now for security reasons we have to go to the page Rules on the top menu and create two rules:


RULE 1:

Just replace your domain and the bucket name that you create:

18.png

 

RULE 2:

Just replace your domain:

19.png

 

The final result should be like this:

20.png

 

Keep in mind the order of the rules as if you set the second rule as 1 it will not work and your forum images will not work as page rules uses priority. This is important!

That's it for the Cloudflare part!

 

STEP 3: Configure Invision to use the Backblaze Cloud

From Invision Admin Control Panel, go to System -> Files -> Storage Settings

21.png

 

Then we click on Configurations:

22.png

 

and then on Create New on the right side.

Then we select Amazon S3 and we fill the needed info as:

26.png

 

When you click Save if you get any warnings or errors then you have to check again the tutorial as you may forgot something or may have a typo somewhere...

If you save it without any issues then you are ready to use it by going to: System -> Files -> Storage Settings

and select a category with not many images for example Icons & Logos or anything else with a few images and from the drop down options the: Amazon S3:superbucket

 

29.png

 

Then wait for the automated task to transfer your files to the Cloud and check if all are ok !

If yes then you can proceed with the rest categories.

 

*Keep only at your server your theme resources:

theme.png

 

Keep in mind that if you have a lot of GB of files it may take a long time for the transfer !

 

It may help to go to the Dashboard and run manually the process to get the files transferred faster.


*Attachments and Downloads may not work out of the box (don't use them on my test forum and i don't know for sure) and you may need to use the addon S3 Compatible Downloads:

 

I hope that you will benefit from this tutorial and get better performance while saving space on your main server and a lot of money 🙂

Backblaze is much more stable than Wasabi!

It also includes up to 10GB free storage, so you can test it easily !

Credits to: @Joel R and @Martin A.

Enjoy !

Edited by ASTRAPI
Link to comment
Share on other sites

  • 1 year later...

If you're having trouble with redirection "This page has redirected too many times", check that your SSL mode for the domain is set to "FULL". Traffic to Cloudflare is always encrypted over HTTPS, and this ensures that the traffic between Cloudflare and Backblaze is also encrypted.

The alternative, flexible mode, the communication between Cloudflare and Backblaze is conducted over plain HTTP traffic. Backblaze doesn't allow unencrypted traffic and your browser gets stuck in a redirect loop.

Be aware: Changing this setting to FULL may break other proxied hostnames in your domain if they're not also capable of running over HTTPS independently. If you have any problems, make sure all your proxied hosts have certificates installed (self-signed or otherwise. Free Let's Encrypt certificates work fine). Contact your web host if you don't know what that means. Or turn the SSL mode back to "Flexible" just use the plain Backblaze URL for your offloaded media by setting the Custom URL in Invision to "https://f0002.backblazeb2.com/file/<BUCKET>/"  (Whatever your bucket's URL is). You won't get a fancy cdn.yourdomainname.com address, but it should be better supported.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...