Skip to content

Commit a500469

Browse files
committed
migrate-over-ipfs: address feedback
1 parent 0fcfff1 commit a500469

File tree

1 file changed

+37
-26
lines changed

1 file changed

+37
-26
lines changed

proposals/migrate-over-ipfs.md

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,51 +42,62 @@ _How much would nailing this project improve our knowledge and ability to execut
4242
This is ones step towards our goal of updating go-ipfs itself over IPFS. In terms of knowledge, not much.
4343

4444
#### Confidence
45-
_How sure are we that this impact would be realized? Label from [this scale](https://medium.com/@nimay/inside-product-introduction-to-feature-priority-using-ice-impact-confidence-ease-and-gist-5180434e5b15)_.
45+
_How sure are we that this is the right problem to tackle? Label from [this scale](https://medium.com/@nimay/inside-product-introduction-to-feature-priority-using-ice-impact-confidence-ease-and-gist-5180434e5b15)_.
4646

47-
10? We're not shipping a new release to brave until we have _a_ way to ship repo migrations to users in China.
47+
3?
48+
49+
- It's a frequent source of upgrade problems: https://github.com/ipfs/ipfs-desktop/issues?q=is%3Aissue+fs-repo-migrations
50+
- It's preventing us from shipping new go-ipfs releases (with important fixes) to brave users.
51+
- It hurts adoption in China.
4852

4953
## Project definition
5054

5155
#### Brief plan of attack
5256

5357
**Design sketch:**
5458

55-
When migrating a repo:
56-
57-
1. Create a new _temporary_ repo (go-ipfs can't read the current repo because it's an older version).
58-
a. If the local go-ipfs node uses a swarm key, skip to step 3.a (download over HTTPs).
59-
2. Start a new _temporary_ go-ipfs node in the temporary repo.
60-
a. This node should not listen for inbound connections as it has no way to know which ports/transports should be configured (can't read the config).
61-
b. This node should not expose an API/gateway.
62-
3. Download the required migration binaries using the temporary go-ipfs node.
63-
a. If this fails, download over HTTPs.
64-
4. Migrate the main go-ipfs node's repo.
65-
5. Start the main go-ipfs node and _transfer_ (but don't pin) the downloaded migrations into the main repo so that others can download it from this node.
66-
6. Shut down the temporary node and delete the temporary repo.
67-
68-
Provide the following configuration section:
59+
Given a config section like:
6960

7061
```js
7162
{
7263
"Migration": {
73-
// When true, always use IPFS. When false, never use IPFS. When unset, pick the default
74-
// behavior.
75-
"UseIPFS": true|false,
76-
// When true or unset, use the default gateway. When false, don't use a gateway. When a
77-
// string, use the specified gateway.
78-
"UseGateway": true|false|"my-gateway",
64+
// Sources in order of preference where "HTTPS" means our gateways and "IPFS" means over IPFS.
65+
// (an empty list means "do the default thing")
66+
"DownloadPolicy": ["HTTPS", "custom-gateway.io", "IPFS"],
7967
// Whether or not to keep the migration after downloading it.
8068
"Keep": "pin"|"cache"|"discard"
8169
}
8270
}
8371
```
8472

73+
For the initial version, the default download policy should be `["HTTPS", "IPFS"]` unless the local
74+
node uses private networks (has a swarm key) in which case it should just be `["HTTPS"]` for safety.
75+
As we gain confidence in our ability to reliably download migrations over IPFS, we should make it
76+
the default.
77+
78+
When migrating a repo, until we succeed.
79+
80+
1. If the next source is HTTPS, download from `ipfs.io`.
81+
2. If the source is IPFS:
82+
1. Create a new _temporary_ repo (go-ipfs can't read the current repo because it's an older version).
83+
2. Start a new _temporary_ go-ipfs node in the temporary repo.
84+
a. This node should not listen for inbound connections as it has no way to know which ports/transports should be configured (can't read the config).
85+
b. This node should not expose an API/gateway.
86+
3. Download the required migration binaries using the temporary go-ipfs node.
87+
4. Migrate the main go-ipfs node's repo.
88+
5. Start the main go-ipfs node.
89+
6. Maybe store a copy of the migration:
90+
1. If `Keep` is not "discard", import the migration binary into the main go-ipfs node's repo.
91+
2. If `Keep` is "pin", pin the migration binary.
92+
7. If running, shutdown any temporary nodes and delete the temporary repo.
93+
8594
**Implementation steps:**
8695

87-
1. Implement everything but steps 3.a and 5.
88-
2. Implement step 3.a. We'd need this at a minimum before enabling this feature by default.
89-
3. Implement step 5. Unless nodes keep around a copy of the migration, this feature isn't going to be all that useful.
96+
1. Implement everything but step 6.
97+
2. Implement step 6. Unless nodes keep around a copy of the migration, this feature isn't going to be all that useful.
98+
3. Eventually, switch over to using IPFS by default instead of the gateway as the first option.
99+
100+
NOTE: the only reason we're proposing using the gateway first is that the migration blocks startup so it needs to be fast and reliable.
90101

91102
#### What does done look like?
92103
_What specific deliverables should completed to consider this project done?_
@@ -102,7 +113,7 @@ Users can start a new version of go-ipfs that switches to a new repo version wit
102113
#### Counterpoints & pre-mortem
103114
_Why might this project be lower impact than expected? How could this project fail to complete, or fail to be successful?_
104115

105-
1. Downloading migrations over IPFS could be too slow/unreliable. Falling back on a gateway should mitigate.
116+
1. We may not be able to download/find the migration on IPFS. Trying the gateway first (or racing) should help mitigate this.
106117
2. The "temporary" node may be missing important parts of the configuration. For example, it may need alternative bootstrap nodes as our nodes may not be reachable. We'll need to think about this carefully and may need to "reach" into the old repo's config file a bit.
107118

108119
#### Alternatives

0 commit comments

Comments
 (0)