Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions docs/concepts/persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ legacyUrl: https://docs.ipfs.io/guides/concepts/pinning/
description: Learn about how IPFS treats persistence and permanence on the web, and how pinning can help keep data from being discarded.
---

# Persistence, permanence and pinning
# Persistence, permanence, and pinning

::: tip
If you're interested in how pinning files fits into the overall lifecycle of data in IPFS, check out this video from IPFS Camp 2019! [Core Course: The Lifecycle of Data in Dweb](https://www.youtube.com/watch?v=fLUq0RkiTBA)
If you're interested in how pinning fits into the overall lifecycle of data in IPFS, check out this video from IPFS Camp 2019! [Core Course: The Lifecycle of Data in Dweb](https://www.youtube.com/watch?v=fLUq0RkiTBA)
:::

IPFS nodes treat the data they store like a cache, meaning that there is no guarantee that the data will continue to be stored. "Pinning" a CID tells an IPFS server that the data is important and mustn't be thrown away.
When an IPFS node interacts with the network, it automatically stores copies of data that it comes across. If you load a web page through an IPFS gateway `localhost:8080/ipfs/QmXoyp...` then the node your local node will store a copy of the website for a short period of time. Part of the IPFS data lifecycle is _garbage collection_. This is when a node deletes old or unused data from disk to help save space and keep the node efficient. IPFS nodes treat the data they store like a cache, meaning that there is no guarantee that the data will continue to be stored.

You should pin any content you consider important in order to ensure that content is retained over the long term. Since data important to someone else may not be important to you, pinning enables you to have control over the disk space and data retention you need.
To ensure data stays around, you can _pin_ files to the node and stop them from throw into the _garbage collection_ cycle. _Pinning_ a CID tells an IPFS node that the data is important and should not be deleted. You should pin any content you consider important to ensure that it's retained over the long term. When garbage collection is triggered on a node, any pinned content is automatically exempt from deletion. Non-pinned data may be deleted.

## Pinning in context

Your IPFS node can store data based on different kinds of user events. For instance, you can add a file with `ipfs add ...`. It will also store data you request, such as by loading a web page through the gateway (`http://localhost:8080/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco`) or with `ipfs cat ...`. Your node will consult with other IPFS peers to find these requested data, and will store the results in the local cache. `ipfs add` will automatically pin the content, but other IPFS commands do not include automatic pinning.
## Pinning services

When garbage collection is triggered on a node, any pinned content is automatically exempt from deletion. Non-pinned data may be deleted; if you request it again later, the data can be retrieved from another node.
To ensure that your important data is retained, you may want to use a pinning service. These services run lots of IPFS nodes and allow users to pin data on those nodes for a fee. Some services offer free storage-allowance for new users. Pinning services are handy when:

## Pinning services
- You don't have a lot of disk space, but you want to ensure your data sticks around.
- Your computer is a laptop, phone, or tablet that will have intermittent connectivity to the network. Still, you want to be able to access your data on IPFS from anywhere at any time, even when the device you added it from is offline.
- You want a backup that ensures your data is always available from another computer on the network if you accidentally delete or garbage-collect your data on your own computer.

To ensure that your important data is retained, you may want to use a pinning service. Such a service normally trades money for the service of guaranteeing they'll keep your data pinned. Some cases where this might be important to you:
Some available pinning service providers are:

- You don’t have a lot of disk space, but you want to ensure some data sticks around.
- Your computer is a laptop, phone, or tablet that will have intermittent connectivity to the network, but you want to be able to access your data on IPFS from anywhere at any time, even when the device you added it from is offline.
- You want a backup that ensures your data is always available from another computer on the network in case you accidentally delete or garbage-collect on your own computer.
- [Pinata](https://pinata.cloud/)
- [Temporal](https://temporal.cloud/)
- [Infura](https://infura.io/)
- [Eternum](https://www.eternum.io/)
- [Axel](https://www.axel.org/blog/2019/07/23/qa-with-the-developers-of-axel-ipfs/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 20 additions & 11 deletions docs/how-to/websites-on-ipfs/single-page-website.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Host a single-page website on IPFS
legacyUrl: https://docs.ipfs.io/guides/examples/websites/
description: Learn how to host a simple one-page website on IPFS, and link up a domain name.
description: Learn how to host a simple one-page website on IPFS and link up a domain name.
---

# Host a single-page website on IPFS

In this tutorial, we're going to host a simple one-page website on IPFS and link up a domain name. This is the first step is a series of tutorials aimed at teaching web developers how to build websites and applications using IPFS.
In this tutorial, we will host a simple one-page website on IPFS and link up a domain name. This is the first step is a series of tutorials to teach web developers on how to build websites and applications using IPFS.

## Install IPFS desktop

Expand All @@ -24,7 +24,7 @@ IPFS desktop application is the easiest way to get up and running quickly with I
![The IPFS desktop download page.](./images/single-page-website/install-windows-download-exe-page.png)

3. Run the `.exe` file to start the installation.
4. Select whether you want to install the application for just yourself, or all users on the computer. Click **Next**:
4. Select whether you want to install the application for just yourself or all users on the computer. Click **Next**:

![The IPFS desktop install options window.](./images/single-page-website/install-windows-install-options.png)

Expand Down Expand Up @@ -144,7 +144,7 @@ The next step is to import your site into IPFS using the IPFS desktop app you ju
'It takes Venus 225 days to orbit the sun.',
'Venus was first discovered by 17th century Babylonian astronomers.',
'Venus is nearly as big as the Earth with a diameter of 12,104 km.',
'The Earths rotation is gradually slowing.',
'The Earth's rotation is gradually slowing.',
'There is only one natural satellite of the planet Earth, the moon.',
'Earth is the only planet in our solar system not named after a god.',
'The Earth is the densest planet in the solar system.',
Expand All @@ -169,8 +169,8 @@ The next step is to import your site into IPFS using the IPFS desktop app you ju
'The average temperatue of Neptune is about -201 °C.',
'There is a 1:20 million scale model of the solar system in Sweden.',
'The gap between the Earth and our moon is bigger than the diameters of all the planets combined.',
'The first accurate calculation of the speed of light was using Jupiters moons',
'Jupiters magnetic field is believed to be a result of rapidly spinning metallic hydrogen at the core, and is ~10x stronger than the Earths.',
'The first accurate calculation of the speed of light was using Jupiter's moons',
'Jupiter's magnetic field is believed to be a result of rapidly spinning metallic hydrogen at the core, and is ~10x stronger than the Earth's.',
'Venus spins backwards.',
'Uranus spins sideways, relative to the ecliptic plane of the solar system.',
'It is easier to reach Pluto or escape the solar system from Earth than being able to <i>land</i> on the Sun.'
Expand All @@ -181,6 +181,7 @@ The next step is to import your site into IPFS using the IPFS desktop app you ju
</script>
</body>
</html>
`"
```

2. Open IPFS desktop and go to the **Files** page.
Expand All @@ -200,11 +201,19 @@ Your browser should load the website in a few moments! This can take up to a few

## Pinning files

IPFS nodes treat the data they store like a cache, meaning that there is no guarantee the data will continue to be stored. _Pinning_ a file tells an IPFS node to treat the data as essential and to not throw it away. You should _pin_ any content you consider important to ensure that data is retained over the long term.
IPFS nodes treat the data they store like a cache, meaning that there is no guarantee the data will continue to be stored. _Pinning_ a file tells an IPFS node to treat the data as essential and not throw it away. You should _pin_ any content you consider important to ensure that data is retained over the long term. IPFS Desktop allows you to pin files straight from the _Files_ tab.

### Using Pinata
![IPFS Desktop application showing the pinning option.](ipfs-desktop-showing-pinning.png)

An easy way to make sure important data is retained is to use a pinning service. These services run a bunch of IPFS nodes, and will _pin_ your data for you! This way you don't have to run and maintain your own IPFS node. [Pinata](https://pinata.cloud/) is a pinning service that allows you to pin up to 1GB of data for free, and fits our purposes perfectly:
However, if you want your IPFS data to remain accessible when your local IPFS node goes offline, you might want to use another option like _collaborative clusters_ or a _pinning service_.

### Collaborative clusters

IPFS collaborative clusters are groups of IPFS nodes that collaboratively pin all content added to the IPFS Cluster by one or many trusted peers. You can learn more about collaborative clusters, including how to set up a cluster yourself, from [cluster.ipfs.io](https://cluster.ipfs.io/documentation/collaborative/setup/)

### Pinning services

An easy way to make sure important data is retained is to use a pinning service. These services run lots of IPFS nodes and will _pin_ your data for you! This way, you don't have to run and maintain your own IPFS node. Check out the [Persistence page](../../concepts/persistence) for more information on pinning services. In this tutorial, we're going to use [Pinata](https://pinata.cloud/) since it gives new users 1GB of storage for free, and has a very simple interface:

1. Go to [Pinata.cloud](https://pinata.cloud/) and sign up or log in.
2. Click **Pinata Upload**.
Expand All @@ -214,7 +223,7 @@ An easy way to make sure important data is retained is to use a pinning service.
6. Once the file has finished uploading, click **Pin Explorer** to view any files you have pinned.
7. You should be able to see your `index.html` file pinned:

![The Pinata Pin Explorer screen showing the index.html pinnded.](./images/single-page-website/pinned-index-file-in-pinata.png)
![The Pinata Pin Explorer screen showing the index.html pinned.](./images/single-page-website/pinned-index-file-in-pinata.png)

8. Click the **IPFS Hash** of your `index.html` file to open your website through the Pinata gateway.

Expand All @@ -224,7 +233,7 @@ An easy way to make sure important data is retained is to use a pinning service.

This section is completely optional.

If you have access to a domain name service like Namecheap, Google Domains, GoDaddy, or any other domain service, then you can follow along with these steps. If you don't have a domain name to assign, then you can just read along through this section. We're going to dive into using decentralized naming services like Ethereum Naming Service (ENS) in a later section.
If you have access to a domain name service like Namecheap, Google Domains, GoDaddy, or any other domain service, then you can follow along with these steps. If you don't have a domain name to assign, you can just read along this section. We will dive into using decentralized naming services like Ethereum Naming Service (ENS) in a later section.

We used Namecheap, but the process is very similar across all domain name services.

Expand Down