Host a Website in a Bucket
Buckets make it simple to publish websites using IPFS. If you are using a static site builder such as Jekyll, Gatsby, Hugo, or Mkdocs you can add Buckets to your build steps for both staging and production site hosting.
Site builder tutorials¶
If you are using one of these static site builders, jump to the specific tutorials.
Automation and deployment (CI/CD)¶
Buckets are an ideal tool for persisting your website, source code, or documentation on IPFS using continuous integration. Tools like Travis CI, CircleCI, and GitHub Actions all make it possible to do very easily.
If you kepe your website source code on GitHub, we have provided a configurable GitHub Action that allows you to automatically push updates to your Bucket whenever your website changes.
View the Textile Buckets GitHub Action.
Domain Name Management¶
Your website may be one of your most important assets on IPFS. Why not pin it on multiple infrastructure providers for added network speed.
Initialize your Bucket¶
If you are building a static site with an engine such as Jekyll or Gatsyb, or even React you will want to initialize your Bucket in the root of the project, not in the build folder. Your project might look like this.
ls ./ build package.json src
In this case, we are building the raw site code in
src into the
build folder. We should initialize the Bucket at the root of the project.
hub bucket init
Push your Bucket¶
Now, pushing your Bucket is simple. After you build your project so that
build contains the latest version of your site ready to deploy you run the
bucket push command.
hub bucket push build/ .
That's it! Your site is now available on the free subdomain and over IPNS. You can easily integrate it into your own DNS using DNSLink.
You can use Buckets to host websites from your own domain using DNSLink. The easiest way to do this is using your Bucket's IPNS link. On Cloudflare for example, your updated DNS records should look like the following.
CNAME <site> www.cloudflare-ipfs.com TXT _dnslink.<site> dnslink=/ipns/<bucket ipns link>