You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Guide on how to configure custom domains and DNSLink for your IPFS deployments.
4
+
---
5
+
6
+
# Custom domains and DNSLink
7
+
8
+
By default, when you deploy a static web application to IPFS, it will be addressed with a CID. Since CIDs are long and hard to remember, they're not very user-friendly, for example, `https://bafybeifhgtpm6kmbyqszbardceszvkv5rsi3dodtuufpcfskzggekcfl2y.ipfs.inbrowser.link/` or `https://bafybeifhgtpm6kmbyqszbardceszvkv5rsi3dodtuufpcfskzggekcfl2y.ipfs.dweb.link/`.
9
+
10
+
To make your app easier to access, you can optionally configure a custom domain for your app, depending on how you want users to access your app.
11
+
12
+
This guide will walk you through the process of configuring a custom domain for your app, and how to configure DNSLink to signal the CID for your app.
13
+
14
+
### CID Signaling with DNSLink
15
+
16
+
[DNSLink](../../concepts/dnslink.md) is a standard way to map human-readable domain names (DNS) to CIDs. For example, for the IPFS Docs, `docs.ipfs.tech`, the DNSLink record is a TXT record at `_dnslink.docs.ipfs.tech` with the value `dnslink=/ipfs/bafybeicv5tbyeahgm4pyskd2nverwsqxpiqloikqrufvof7vausglw6avm` (the CID will likely be different once you read this guide).
17
+
18
+
The main benefit of DNSLink is that it allows users to determine the latest CID for a given domain name, while leaving it up to the user how to retrieve the deployment addressed by the CID. For example, a user might have a local IPFS node, and want to access the latest deployment of your app, they can do so by resolving the DNSLink record and fetching the content from their local node. `http://localhost:8080/ipns/docs.ipfs.tech` will serve the CID found in the DNSLink record.
19
+
20
+
When a DNSLink record is present, any IPFS gateway (local or public) can take the DNS name and resolve it to the CID, and serve the content, for example, both `http://inbrowser.link/ipns/docs.ipfs.tech` and `http://ipfs.io/ipns/docs.ipfs.tech` will serve the same site, albeit with different origins.
21
+
22
+
When loading the site this way, you benefit from the resilience and censorship resistance of the IPFS network, because it's content addressed (addressed by CID) rather than being tied to a canonical origin. As long as there's at least one reachable provider for the CID, you can access the site.
23
+
24
+
The disadvantage is that loading the site this way is that the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) can vary depending on where the user is accessing the site from, which can impact how your app functions, like CORS access to external APIs.
25
+
26
+
## Access via custom domain
27
+
28
+
In the previous section, we discussed how DNSLink can be used to signal the CID for a domain name, while leaving it up to the user how to retrieve the content, be it a local node, service worker gateway or any other [public recursive gateway](https://docs.ipfs.tech/concepts/ipfs-gateway/#recursive-vs-non-recursive-gateways). In this instance, the user provides the domain name as input, instead of the CID.
29
+
30
+
To provide access to the app directly via the custom domain, you have the following options:
31
+
32
+
1. Deploy an IPFS Gateway that supports DNSLink, e.g. [Rainbow](https://github.com/ipfs/rainbow/) and point the CNAME/A record for your custom domain to it. You will likely want to also configure TLS with a reverse proxy like Caddy.
33
+
2. Use a service like Fleek
34
+
3. Deploy the site to a web hosting service like Cloudflare/GitHub Pages, and point the CNAME/A record for your custom domain to it, essentially getting the benefits of both IPFS and traditional web hosting.
35
+
36
+
Access via a custom domain is useful if you want to serve your app via a domain name that you own, for example, `app.example.com`.
Copy file name to clipboardExpand all lines: docs/install/deploy-github-action.md
+87-72Lines changed: 87 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
---
2
-
title: Deploying Static Web Applications to IPFS
3
-
description: Guide on how to setup GitHub Actions to deploy static web applications to IPFS using the IPFS Deploy Action.
2
+
title: Deploy Static Apps to IPFS with GitHub Actions
3
+
description: Guide on how to setup GitHub Actions to deploy static sites/apps to IPFS using the IPFS Deploy Action.
4
4
---
5
5
6
-
# Deploying Static Web Applications to IPFS with GitHub Actions
6
+
# Deploy Static Apps to IPFS with GitHub Actions
7
7
8
-
This guide will walk you through the process of configureing a GitHub Actions workflow to deploy a repository containing a static web application to IPFS using the [IPFS Deploy Action](https://github.com/ipfs/ipfs-deploy-action).
8
+
This guide will walk you through the process of configureing a GitHub Actions workflow to deploy a repository containing a static site or app to IPFS using the [IPFS Deploy Action](https://github.com/ipfs/ipfs-deploy-action).
9
9
10
10
By the end of this guide, your app will be deployed to IPFS automatically when you push to your repository. It will also deploy pull request previews for each commit, and provide some other developer experience features, like commit status updates with the CID of the build, and a comment on pull requests with the IPFS CID and preview links.
11
11
12
12
Once deployed, each deployment of your app will be addressed by a CID and accessible via [recursive gateways](https://docs.ipfs.tech/concepts/ipfs-gateway/#recursive-vs-non-recursive-gateways), as well as the [Service Worker Gateway](https://inbrowser.link).
13
13
14
-
To see what this looks like in a real-world example, check out the [IPNS Inspector](https://github.com/ipfs-shipyard/ipfs-deploy-action-demo).
14
+
To see what this looks like in a real-world example, check out the [IPNS Inspector](https://github.com/ipshipyard/ipns-inspector).
15
15
16
16
## What is the IPFS Deploy Action?
17
17
@@ -28,52 +28,24 @@ The IPFS Deploy Action works with both self-hosted IPFS nodes (Kubo or IPFS Clus
28
28
29
29
The IPFS Deploy Action makes no assumptions about your build process. Whether you're using React, Vuepress, Astro, Next.js, or any other static site generator, this guide will help you get your web application deployed on IPFS. The only requirement is that your web application is static, meaning that once built, it is a folder containing HTML, CSS, and JavaScript files that are served as-is to the client.
30
30
31
-
## Custom domains and DNSLink
32
-
33
-
**TODO: This whole section should probably move to a separate guide that can be linked to from here**
34
-
35
-
By default, each deployment will be addressed with a CID. Since CIDs are long and hard to remember, they're not very user friendly, for example, `https://bafybeifhgtpm6kmbyqszbardceszvkv5rsi3dodtuufpcfskzggekcfl2y.ipfs.inbrowser.link/`.
36
-
37
-
To make your deployments easier to access, you can optionally configure a custom domain for your app, depending on how you want users to access your app.
38
-
39
-
### CID Signaling with DNSLink
40
-
41
-
DNSLink is a standard way to map human-readable domain names (DNS) to CIDs. For example, for the IPFS Docs, `docs.ipfs.tech`, the DNSLink record is a TXT record at `_dnslink.docs.ipfs.tech` with the value `dnslink=/ipfs/bafybeicv5tbyeahgm4pyskd2nverwsqxpiqloikqrufvof7vausglw6avm` (the CID will likely be different once you read this guide).
42
-
43
-
The main benefit of DNSLink is that it allows users to determine the latest CID for a given domain name, while leaving it up to the user how to retrieve the deployment addressed by the CID. For example, a user might have a local IPFS node, and want to access the latest deployment of your app, they can do so by resolving the DNSLink record and fetching the content from their local node. `http://localhost:8080/ipns/docs.ipfs.tech` will serve the CID found in the DNSLink record.
44
-
45
-
When a DNSLink record is present, any IPFS gateway (local or public) can take the DNS name and resolve it to the CID, and serve the content, for example, both `http://inbrowser.link/ipns/docs.ipfs.tech` and `http://ipfs.io/ipns/docs.ipfs.tech` will serve the same site, albeit with different origins.
46
-
47
-
When loading the site this way, you benefit from the resilience and censorship resistance of the IPFS network, because it's content addressed (addressed by CID) rather than being tied to a canonical origin. As long as there's at least one reachable provider for the CID, you can access the site.
48
-
49
-
The disadvantage is that loading the site this way is that the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) can vary depending on where the user is accessing the site from, which can impact how your app functions, like CORS access to external APIs.
50
-
51
-
## Access via custom domain
52
-
53
-
In the previous section, we discussed how DNSLink can be used to signal the CID for a domain name, while leaving it up to the user how to retrieve the content, be it a local node, service worker gateway or any other [public recursive gateway](https://docs.ipfs.tech/concepts/ipfs-gateway/#recursive-vs-non-recursive-gateways). In this instance, the user provides the domain name as input, instead of the CID.
54
-
55
-
To provide access to the app directly via the custom domain, you have the following options:
56
-
57
-
1. Deploy an IPFS Gateway that supports DNSLink, e.g. [Rainbow](https://github.com/ipfs/rainbow/) and point the CNAME/A record for your custom domain to it. You will likely want to also configure TLS with a reverse proxy like Caddy.
58
-
2. Use a service like Fleek
59
-
3. Deploy the site to a web hosting service like Cloudflare/GitHub Pages, and point the CNAME/A record for your custom domain to it, essentially getting the benefits of both IPFS and traditional web hosting.
60
-
61
-
Access via a custom domain is useful if you want to serve your app via a domain name that you own, for example, `app.example.com`.
62
-
63
31
## Prerequisites
64
32
65
33
Before you begin, make sure you have:
66
34
67
35
1. A GitHub repository with your static web application
68
-
2. GitHub Actions enabled on your repository
69
-
3. A Storacha account or running your own IPFS Node (Kubo or IPFS Cluster)
36
+
2. A [Storacha](https://storacha.network) account or an IPFS Node (Kubo or IPFS Cluster) with the RPC endpoint publicly reachable (see [this guide](../how-to/kubo-rpc-tls-auth.md) for instructions on how to secure the Kubo RPC endpoint with TLS and authentication)
37
+
38
+
This guide will use Storacha for simplicity. If you have an IPFS Node, you can skip the Storacha setup and use your own node instead.
39
+
40
+
## Step 1: Setting Up Storacha
41
+
42
+
If you don't have a Storacha account, you can create one at [https://storacha.network](https://storacha.network).
70
43
71
-
## Step 1: Setting Up Storacha (Easiest way to get started)
72
44
73
45
1. Install the w3cli tool:
74
46
75
47
```bash
76
-
npm install -g @storacha/w3cli
48
+
npm install -g @web3-storage/w3cli
77
49
```
78
50
79
51
2. Login to your Storacha account:
@@ -100,7 +72,8 @@ Before you begin, make sure you have:
100
72
101
73
Save the key value as a GitHub secret named `STORACHA_KEY`
102
74
103
-
5. Create a UCAN proof:
75
+
5. Create a UCAN proof. Note that the command will create a UCAN proof allowing uploads to the space created in step 3:
Modify the `path-to-deploy` input based on your build tool:
131
+
- This workflow assumes that your build command is `npm run build`. If your build command is different, you can change the `run` command in the build step.
132
+
- The `path-to-deploy` input is set to `dist` by default. If your build output directory is different, you can change the `path-to-deploy` input.
159
133
160
-
- React (Create React App): `build`
161
-
- Next.js: `out`(when using `next export`) or `.next` (for server-side rendering)
162
-
- Vue.js: `dist`
163
-
- Vite: `dist`
164
-
- Gatsby: `public`
134
+
## Step 3: Optional Configurations
165
135
166
-
## Step 4: Optional Configurations
136
+
### Uploading the CAR file to a Kubo Node
167
137
168
-
### Adding Pinata Backup
138
+
To upload the CAR file to a Kubo node instead of or in addition to Storacha:
169
139
170
-
To add redundancy with Pinata pinning:
140
+
1. Get your Kubo RPC endpoint and API token
141
+
2. Add them as GitHub secrets named `KUBO_API_URL` and `KUBO_API_AUTH`
142
+
3. Add these lines to your workflow:
143
+
144
+
```yaml
145
+
- name: Deploy to IPFS
146
+
uses: ipfs/ipfs-deploy-action@v1
147
+
with:
148
+
# ... other inputs ...
149
+
kubo-api-url: ${{ secrets.KUBO_API_URL }}
150
+
kubo-api-auth: ${{ secrets.KUBO_API_AUTH }}
151
+
```
152
+
153
+
You can also customize the Kubo version used for merkleizing your content:
154
+
155
+
```yaml
156
+
- name: Deploy to IPFS
157
+
uses: ipfs/ipfs-deploy-action@v1
158
+
with:
159
+
# ... other inputs ...
160
+
kubo-version: 'v0.33.0' # Default, change if needed
0 commit comments