ipfs / fs-repo-migrations

Migrations for the filesystem repository of ipfs clients
MIT License
57 stars 42 forks source link

test: does IPFS fallback work properly for downloading repo migrations? #184

Open SgtPooki opened 1 year ago

SgtPooki commented 1 year ago
╰─ ✔ ❯ export IPFS_PATH="$(mktemp -d)"
╰─ ✔ ❯ npx go-ipfs@v0.18.1 init
╰─ ✔ ❯ sudo vim /etc/hosts # add `0.0.0.0 ipfs.io`

╰─ ✔ ❯ npx kubo@latest daemon
Need to install the following packages:
  kubo@0.22.0
Ok to proceed? (y) y
Initializing daemon...
Kubo version: 0.22.0
Repo version: 14
System version: arm64/darwin
Golang version: go1.19.12
Found outdated fs-repo, migrations need to be run.
Run migrations now? [y/N] y
Looking for suitable migration binaries.
Need 1 migrations, downloading.
Downloading migration: fs-repo-13-to-14...
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/versions"
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/versions"
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/versions"
Error fetching: exceeded number of retries. last error was http.DefaultClient.Do error: Get "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/versions": x509: certificate signed by unknown authority
Fetching with IPFS: "fs-repo-13-to-14/versions"
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/v1.0.0/fs-repo-13-to-14_v1.0.0_darwin-arm64.tar.gz"
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/v1.0.0/fs-repo-13-to-14_v1.0.0_darwin-arm64.tar.gz"
Fetching with HTTP: "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/v1.0.0/fs-repo-13-to-14_v1.0.0_darwin-arm64.tar.gz"
Error fetching: exceeded number of retries. last error was http.DefaultClient.Do error: Get "https://ipfs.io/ipfs/QmYerugGRCZWA8yQMKDsd9daEVXUR3C5nuw3VXuX1mggHa/fs-repo-13-to-14/v1.0.0/fs-repo-13-to-14_v1.0.0_darwin-arm64.tar.gz": x509: certificate signed by unknown authority
Fetching with IPFS: "fs-repo-13-to-14/v1.0.0/fs-repo-13-to-14_v1.0.0_darwin-arm64.tar.gz"
Downloaded and unpacked migration: /var/folders/bl/_gl5_59s11v7qz5ysd6bfgb00000gn/T/migrations2937207082/fs-repo-13-to-14 (v1.0.0)
Running migration fs-repo-13-to-14 ...
  => Running: /var/folders/bl/_gl5_59s11v7qz5ysd6bfgb00000gn/T/migrations2937207082/fs-repo-13-to-14 -path=/var/folders/bl/_gl5_59s11v7qz5ysd6bfgb00000gn/T/tmp.piBFLtG3 -verbose=true
applying 13-to-14 repo migration
locking repo at "/var/folders/bl/_gl5_59s11v7qz5ysd6bfgb00000gn/T/tmp.piBFLtG3"
  - verifying version is '13'
> Upgrading config to new format
updated version file
Migration 13 to 14 succeeded
Success: fs-repo migrated to version 14.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.1.227/tcp/4001
Swarm listening on /ip6/2607:fb90:d7ff:3366:8cfb:17b2:d85e:b993/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /ip6/fd52:f4cb:d580:44c1:c5d:34ba:60ea:4c67/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.1.227/tcp/4001
Swarm announcing /ip4/97.113.90.66/tcp/13986
Swarm announcing /ip6/::1/tcp/4001

Error: serveHTTPApi: manet.Listen(/ip4/127.0.0.1/tcp/5001) failed: listen tcp4 127.0.0.1:5001: bind: address already in use

One thing to callout is that HTTP still attempts even after failing.

SgtPooki commented 1 year ago

Can close, but I wonder if we should be re-trying HTTP if we already decided to move to try IPFS?

also note: Error: serveHTTPApi: manet.Listen(/ip4/127.0.0.1/tcp/5001) failed: listen tcp4 127.0.0.1:5001: bind: address already in use because I was running ipfs-desktop. This proves that another port is used in order to fetch from IPFS, which is a good thing.

SgtPooki commented 1 year ago

also related to https://github.com/ipfs/kubo/pull/10133 and https://github.com/protocol/bifrost-infra/issues/2765