In a previous article we demonstrated how you could build a static website using Publii and host it on the IPFS network. Today we are going to show you how to host a similar static website on the Storj network instead. Both Storj and IPFS are similar in that they are decentralized, peer-to-peer storage networks. See the video below for a quick introduction to Storj:
Before we get started with the step-by-step tutorial on how to host a website on Storj, it’s worth noting that the process is much more manual than IPFS. Hosting a website using IPFS has been streamlined by Fleek which automatically synchronizes your website’s Github repository, deploys changes to IPFS and updates the domain names to point to the latest hash.
Storj works a little differently than IPFS in that it is object-oriented instead of hash-based. With Storj you create folders (buckets) for your website files, and simply replace the files to update them. This means there isn’t a need to point your domain name to a new hash and making changes to your website is as simple and deleting and replacing files in the bucket.
Step 1: Sign Up for a Free Storj Account
Storj offers a free tier with 50GB of storage space and monthly bandwidth, which should be more than enough to get you started. Click here to sign up.
Step 2: Create a New Bucket
In the Storj Dashboard, click on the “Objects” menu, then press the “New Bucket” button. Name the bucket whatever you want.
Step 3: Upload Your Static Website Files to the Storj Bucket
After creating the new bucket open the interface and start uploading your static website files. We recommend using a static website generator like Publii to easily generate a polished static website.
You can upload all the files manually using the browser-based file management, but you will need to create all the sub-directories (folders) manually. Depending on the file structure of your static website this may involve creating many folders and sub-folders.
The better solution is to connect to your Storj bucket using Filezilla. Filezilla recently added support for the Storj protocol and Filezilla supports simple drag-and-drop for uploading both files and sub-directories (folders). You can follow the guide here to connect to your Storj bucket using Filezilla.
Step 4: Create an Access Grant Key
Follow the guide here to create a new access grant key to use with the website bucket you created previously.
The access grant key will only be displayed once, so copy it into a txt file and save it to your computer.
Step 5: Download and Run Uplink Binary
Use the “import” command to associate the access grant key (txt file) with the Uplink binary.
Step 6: Using Uplink, Generate DNS Info
Continue following the guide here and use the “share” command to generate DNS info for the endpoint gateway.
In our case we used the command:
share --dns storj.atmovantage.com sj://atmostorj/ --base-url https://link.us1.storjshare.io
“storj.atmovantage.com” is our intended domain name.
“sj://atmostorj/” is our Storj bucket name.
“https://link.us1.storjshare.io” is our preferred satellite link since this website is located in the United States.
Step 7: Add the New DNS Records to Your Domain
Now go to wherever you manage your domain name DNS records. In our case we use Cloudflare. Cloudflare is also helpful because as a CDN (Content Delivery Network) you can secure your new Storj website using an SSL certificate.
Take the DNS info generated by the Uplink binary in Powershell and create the 3 new records: CNAME and two TXT records. Make sure the CNAME record is using the Cloudflare proxy in order to ensure it uses HTTPS (SSL certificate).
Step 8: Visit Your New Storj Website
If you’ve done all the steps correctly then when you visit your Storj domain in your browser you should see your static website. (This might take a few minutes to a few hours after configuring Cloudflare DNS due to the time it takes for DNS changes to propagate)
In our case, we built a special static website in Publii and uploaded the files to a Storj bucket, then configured the DNS records to point to the subdomain storj.atmovantage.com
When you visit that subdomain you should see the website titled “AtmoVantage Storj”!
Hosting a static website on the Storj network is just one more way to make your website more resilient and censorship-resistant. The object-oriented nature of Storj makes updates fairly easy, even though they must be done manually via Filezilla for the time being.
Overall the process to host a website on Storj was actually relatively easy. Aside from a few command lines needed in the Uplink binary most of the process can be done through the Storj DCS website interface and Filezilla. Ultimately we’d say that the process of hosting a website on Storj is simple enough that it only requires an intermediate skill level to accomplish and if done correctly, can be completed in only a few hours.