Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blogpost: Migrating From Brave to IPFS Desktop #693

Merged
merged 22 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

169 changes: 169 additions & 0 deletions src/_blog/2024-brave-migration-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
title: 'Migrating from Brave to IPFS Desktop'
description: 'Complete Guide to Migrating Your IPFS Data'
date: 2024-08-22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: update to actual publishing date

header_image: '/blog-post-placeholder.png'
tags:
- brave
- browsers
- IPFS Desktop
---


Brave browser users who have been relying on the built-in IPFS node functionality will soon need to find an alternative solution. We could not find a mutually agreeable set of terms, and Brave has [announced](https://github.com/brave/brave-browser/issues/37735) the removal of support for running IPFS nodes on behalf of users. This change was implemented in the latest stable release ([v1.69.153](https://github.com/brave/brave-browser/blob/56f6418ac301a4b015c1188786f6f4497b6ac393/CHANGELOG_DESKTOP.md#169153)) which shipped on Aug 22nd. While this change may be disappointing for some, it presents an opportunity to adopt a more robust and flexible IPFS setup.
lidel marked this conversation as resolved.
Show resolved Hide resolved

This guide will walk you through the process of moving your IPFS data from Brave to IPFS Desktop, ensuring you don't lose any of your important files, and keep access to IPFS resources in your browser.
lidel marked this conversation as resolved.
Show resolved Hide resolved

## Why Migrate?

- **Imminent Removal:** The IPFS node feature in Brave is being [phased out](https://github.com/brave/brave-browser/issues/37735#issuecomment-2247764368) and will happen once you update to v1.69.153 or later. To ensure uninterrupted access to your IPFS data, migration is necessary, especially if you pinned something, or published with IPNS.
lidel marked this conversation as resolved.
Show resolved Hide resolved
- **Improved Functionality:** Migrating to a standalone IPFS solution like IPFS Desktop offers several advantages:
1. Automatic security and performance updates without relying on browser updates.
2. Ability to customize your IPFS node configuration, no vendor-specific overrides.
3. Browser-agnostic background service, allowing your node to run independently of any specific browser.
4. Easy access to your files in WebUI via system status bar icon, and right-click file manager integration (on Windows).

### Time Investment

Migrating your IPFS node is a relatively quick process. Most users can complete the transition in 5 to 15 minutes, depending on their familiarity with IPFS and their system configuration.

## Prerequisites

Before we begin, you'll need to install two key components that will replace the functionality that was in Brave with an IPFS stack that will still work in Brave, but also in most other browsers.

- [IPFS Desktop](https://docs.ipfs.tech/install/ipfs-desktop/) is a full node application that runs [Kubo](https://github.com/ipfs/kubo/) on your computer, managing your IPFS repository and providing a graphical interface for IPFS operations. Download IPFS Desktop by following the [install guide here](https://docs.ipfs.tech/install/ipfs-desktop/#install-instructions). Choose the appropriate version for your operating system ([Windows](https://docs.ipfs.tech/install/ipfs-desktop/#windows), [macOS](https://docs.ipfs.tech/install/ipfs-desktop/#macos), or [Linux](https://docs.ipfs.tech/install/ipfs-desktop/#ubuntu)) and follow the installation instructions.
- [IPFS Companion](https://docs.ipfs.tech/install/ipfs-companion/) is a browser extension that allows you to interact with IPFS content directly from your web browser, load it from your local IPFS node, and keep provisional support for `ipfs://` and `ipns://` in address bar. The easiest way to install IPFS Companion is through your browser's specific [extensions and add-ons store](https://docs.ipfs.tech/install/ipfs-companion/#install).

## Moving the Brave IPFS Repository

The IPFS repository, often referred to as `$IPFS_PATH` (aka `~/.ipfs`), contains all your IPFS data, IPNS keys, and PeerID identify of your IPFS node. Brave's IPFS Node used the same repository format as Kubo, making migration to IPFS Desktop relatively easy.

If you did not use IPFS Desktop before, you can simply swap `.ipfs` created by IPFS Desktop with the one from your Brave node. This is the simplest way of migrating your node, all data, pins, IPNS keys, addresses and PeerID will remain the same and IPNS publishing will continue working.

First, we need to locate your Brave IPFS repository. The configuration directory for the Brave managed IPFS node can be found in the browser’s profile directory in a subfolder named `brave_ipfs`. You can find your IPFS directory by opening `brave://version/`, finding "Profile Path", and replacing `/Default` with `/brave_ipfs`:

<!-- TODO: confirm these paths are valid -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this part confirmed? output for mac for any file/dir with "ipfs" in the name is:

❯ rg -g '*ipfs*' --files ~/Library/Application\ Support/BraveSoftware
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/lejaflgbgglfaomemffoaappaihfligf/1.0.29/go-ipfs_v0.29.0_darwin-arm64
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/ipfs-logo-on.svg
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/brave-ipfs-logo-off.svg
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/brave-ipfs-logo-on.svg
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/ipfs-logo-off.svg
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-on_19.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-off_19.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-off_38.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-on_128.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-on_38.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/icons/png/ipfs-logo-off_128.png
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/dist/bundles/ipfs.bundle.js
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/dist/popup/browser-action/ipfs-version.js
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/nibjojkomfdiaoajekhjakgkdhaomnch/3.1.0_0/dist/options/forms/ipfs-node-form.js
/Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/Default/Extensions/fpeoodllldobpkbkabpblcfaogecpndd/0.12.7_0/brave-ipfs.json

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI it looks to be at /Users/sgtpooki/Library/Application Support/BraveSoftware/Brave-Browser/brave_ipfs/config on mac

Copy link
Member Author

@lidel lidel Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I looked at Windows and it also does not use /Default.
I've updated blogpost with updated paths + added examples of fully resolved ones.

- Windows: `%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data\brave_ipfs`
- example: `C:\Users\YOURUSERNAME\AppData\Local\BraveSoftware\Brave-Browser\User Data\brave_ipfs`
- macOS: `~/Library/Application Support/BraveSoftware/Brave-Browser/brave_ipfs`
lidel marked this conversation as resolved.
Show resolved Hide resolved
- example: `/Users/YOURUSERNAME/Library/Application Support/BraveSoftware/Brave-Browser/brave_ipfs`
- Linux: `~/.config/BraveSoftware/Brave-Browser/brave_ipfs`
- example: `/home/YOURUSERNAME/.config/BraveSoftware/Brave-Browser/brave_ipfs`

To confirm you've found the right directory, open `brave_ipfs/config` and write down the value of `PeerID`, it will act as unique identifier of your Brave repository.

Now, we'll move this repository to the default location for IPFS Desktop:

- Windows: `%USERPROFILE%/.ipfs`
- example: `C:\Users\YOURUSERNAME\.ipfs`
- macOS: `~/.ipfs`
- example: `/Users/YOURUSERNAME/.ipfs`
- Linux: `~/.ipfs`
- example: `/home/YOURUSERNAME/.ipfs`

Before proceeding, make sure the `.ipfs` directory does not exist at the destination. If you already had `.ipfs`, shut down IPFS Desktop and rename `.ipfs` to `.ipfs.old` as a precaution to avoid data loss.

Now, move the `brave_ipfs` directory from Brave profile, to the location expected by IPFS Desktop.

You can use the following commands in your terminal or command prompt:

For Windows:

```
IF NOT EXIST "%USERPROFILE%\.ipfs" MOVE "%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data\brave_ipfs" "%USERPROFILE%\.ipfs"
```

For macOS:
```
test ! -d ~/.ipfs && mv ~/Library/Application\ Support/BraveSoftware/Brave-Browser/brave_ipfs ~/.ipfs
```

Linux:
```
test ! -d ~/.ipfs && mv ~/.config/BraveSoftware/Brave-Browser/brave_ipfs ~/.ipfs
```

## Starting IPFS Desktop with Migrated IPFS Repository

Once move is completed, you can confirm it was successful if `.ipfs/config` exists in your home directory, and includes `PeerID` of your Brave node.

If `.ipfs/config` exists, you can now start IPFS Desktop. If everything went as expected, your IPFS node should start and run without Brave.

## Optional: Adjusting Configuration

Brave-integrated IPFS node had some drawbacks. The access to WebUI was hidden behind `brave://ipfs-internal`. DNSLink detection was based on HTTP header rather than DNS TXT lookup. Running IPFS node required the Brave browser to be open for content and IPNS announcements to function, and in early days did not even start `ipfs daemon` before `ipfs://` was used for the first time, leading to content from local repository not being provided to IPFS Mainnet peers. Repository cache was artificaially limited to 1GiB in size, and evicted along with browser cache, degrading the utility of peers cohosting casually browsed data.

Switching to IPFS Desktop+Companion solves most of these shortcomings, however you may need to adjust some settings to get full benefit of a standalone IPFS node.

### Updating Cache Size

[`Datastore.StorageMax`](https://github.com/ipfs/kubo/blob/master/docs/config.md#datastorestoragemax) controls how much space is allocated to data that is not pinned, such as visited IPFS websites, or other content you've viewed but do not want to pin forever. Having a bigger cache improves the data availability on the network, making websites more resilient.

To increase IPFS block cache size ([`Datastore.StorageMax`](https://github.com/ipfs/kubo/blob/master/docs/config.md#datastorestoragemax)) from 1GB to at least 100GB (the current default in Kubo):
```
$ ipfs config Datastore.StorageMax
1GB
$ ipfs config Datastore.StorageMax 100GB ~
```

### Updating RPC URL in IPFS Companion

Brave used custom ports: `45001` for RPC and `48080` for Gateway.

If IPFS Companion browser extension does not detect your node after migrating repository from Brave, you need to update RPC and Gateway URLs in Companion preferences.

- Change the **Kubo RPC URL** from `http://127.0.0.1:5001` to `http://127.0.0.1:45001`
- Change the **Local Gateway** from `http://127.0.0.1:8080` to `http://127.0.0.1:48080`

Alternative is to update `.ipfs/config` and replace all occurences of `45001` with `5001` and `48080` with `8080`. Make sure you do not have anything listening on these ports before you make the change.

## Conclusion

Congratulations! You've successfully migrated your IPFS data from Brave to IPFS Desktop.

If you encountered any challenges during the migration process or need further assistance, please don't hesitate to leave a comment in the thread below. The community is here to help, and your feedback can also assist others who might be going through the same process.

## FAQ

### Is it possible to move `brave_ipfs` to a different location than `.ipfs`?

Yes, but one needs to set `IPFS_PATH` environment variable before running IPFS Desktop to point at the new location.
lidel marked this conversation as resolved.
Show resolved Hide resolved

See [How does IPFS Desktop select the IPFS repo location?](https://github.com/ipfs/ipfs-desktop/?tab=readme-ov-file#how-does-ipfs-desktop-select-the-ipfs-repo-location)

### Where can I find FAQ/Troubleshooting for IPFS Desktop?

See [github.com/ipfs/ipfs-desktop/#faq--troubleshooting](https://github.com/ipfs/ipfs-desktop/?tab=readme-ov-file#faq--troubleshooting)

### Can Kubo be used instead?

Yes, advanced users who are comfortable with command-line can use [Kubo](https://docs.ipfs.tech/install/command-line/) instead of IPFS Desktop, and run it against a custom `IPFS_PATH` to run a headless daemon, or perform selective manual migration via CLI.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could benefit to mention this also comes with ipfs-webui built in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters for the migration. WebUI does not support CAR import, nor IPNS key import/export, only CLI tools can be used for such low level migration.


### How to export my Files (MFS) with Kubo CLI?

To export contents of MFS to a CAR, one could:
lidel marked this conversation as resolved.
Show resolved Hide resolved
```
$ export IPFS_PATH=/path/to/brave_ipfs
$ export MFS_ROOT="$(ipfs files stat / | head -1)"
$ ipfs dag export $MFS_ROOT > mfs-backup.car
```

Then, it can be imported on another node and added to MFS there:

```
$ export IPFS_PATH=/path/to/some/other/.ipfs
$ ipfs dag import ./mfs-backup.car
$ ipfs files cp /ipfs/$MFS_ROOT /brave_mfs_backup
$ ipfs pin rm $MFS_ROOT
```

Note: low-level pin (created by `dag import`) can be removed (`pin rm`) after import because presence in MFS is enough to protect data from garbage-collection.

### How to manually migrate my IPNS names with Kubo CLI?

To export IPNS keys, and re-publish with them, see `ipfs key --help` and `ipfs name --help`.

### How to fix `Error: ipfs repo needs migration, please run migration tool.` ?

IPFS Desktop should run migrations the first time you start, but if you use Kubo CLI
you may need to run `ipfs daemon --migrate=true` once, to upgrade to latest version.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ permalink: brave-new-wallet
translationKey: ''
header_image: "/ipfs-blog-brave-2021-07-23.jpg"
tags:
- brave
- browsers
- API

Expand Down Expand Up @@ -72,4 +73,4 @@ Introducing (a sneak peek of) the Brave Wallet. The Brave Wallet will launch wit

**NFT Support.** Users can view their complete NFT collections directly in the wallet.

Keep an eye out for more updates about the Brave Wallet, coming to the Brave browser this year!
Keep an eye out for more updates about the Brave Wallet, coming to the Brave browser this year!
1 change: 1 addition & 0 deletions src/_blog/how-we-put-ipfs-in-brave.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ permalink: '/2021-01-21-how-we-put-ipfs-in-brave/'
translationKey: ''
tags:
- browsers
- brave
header_image: '/2021-01-21-how-we-put-ipfs-in-brave.jpg'
title: How we put IPFS in Brave
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ date: 2021-01-19
permalink: '/2021-01-19-ipfs-in-brave/'
translationKey: ''
tags:
- brave
- browsers
header_image: '/2021-01-19-ipfs-in-brave.png'
title: IPFS in Brave - Native Access to the Distributed Web
Expand Down