-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add support for a helia container #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,12 @@ var RunCommand = &cli.Command{ | |
EnvVars: []string{"TIROS_RUN_TIMES"}, | ||
Value: 3, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "lookup-providers", | ||
Usage: "Whether to lookup website providers", | ||
EnvVars: []string{"TIROS_RUN_LOOKUP_PROVIDERS"}, | ||
Value: true, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "dry-run", | ||
Usage: "Whether to skip DB interactions", | ||
|
@@ -79,21 +85,21 @@ var RunCommand = &cli.Command{ | |
EnvVars: []string{"TIROS_RUN_DATABASE_SSL_MODE"}, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "kubo-host", | ||
Usage: "port to reach the Kubo Gateway", | ||
EnvVars: []string{"TIROS_RUN_KUBO_HOST"}, | ||
Name: "ipfs-host", | ||
Usage: "host at which to reach the IPFS Gateway", | ||
EnvVars: []string{"TIROS_RUN_IPFS_HOST", "TIROS_RUN_KUBO_HOST" /* <- legacy */}, | ||
Value: "localhost", | ||
}, | ||
&cli.IntFlag{ | ||
Name: "kubo-api-port", | ||
Usage: "port to reach the Kubo API", | ||
EnvVars: []string{"TIROS_RUN_KUBO_API_PORT"}, | ||
Name: "ipfs-api-port", | ||
Usage: "port to reach a Kubo-compatible RPC API", | ||
EnvVars: []string{"TIROS_RUN_IPFS_API_PORT", "TIROS_RUN_KUBO_API_PORT" /* <- legacy */}, | ||
Value: 5001, | ||
}, | ||
&cli.IntFlag{ | ||
Name: "kubo-gateway-port", | ||
Usage: "port to reach the Kubo Gateway", | ||
EnvVars: []string{"TIROS_RUN_KUBO_GATEWAY_PORT"}, | ||
Name: "ipfs-gateway-port", | ||
Usage: "port to reach the IPFS Gateway", | ||
EnvVars: []string{"TIROS_RUN_IPFS_GATEWAY_PORT", "TIROS_RUN_KUBO_GATEWAY_PORT" /* <- legacy */}, | ||
Value: 8080, | ||
}, | ||
&cli.IntFlag{ | ||
|
@@ -119,13 +125,19 @@ var RunCommand = &cli.Command{ | |
Usage: "Path to the Udger DB", | ||
EnvVars: []string{"TIROS_UDGER_DB_PATH"}, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "ipfs-implementation", | ||
Usage: "Which implementation are we testing (KUBO, HELIA)", | ||
EnvVars: []string{"TIROS_IPFS_IMPLEMENTATION"}, | ||
Value: "KUBO", | ||
}, | ||
}, | ||
Action: RunAction, | ||
} | ||
|
||
type tiros struct { | ||
dbClient IDBClient | ||
kubo *shell.Shell | ||
ipfs *shell.Shell | ||
dbRun *models.Run | ||
mmClient *maxmind.Client | ||
uClient *udger.Client | ||
|
@@ -145,8 +157,11 @@ func RunAction(c *cli.Context) error { | |
} | ||
} | ||
|
||
// Initialize kubo client | ||
kubo := shell.NewShell(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", c.Int("kubo-api-port"))) | ||
// Initialize ipfs client | ||
var ipfsClient *shell.Shell | ||
if c.Int("ipfs-api-port") != 0 { | ||
ipfsClient = shell.NewShell(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", c.Int("ipfs-api-port"))) | ||
} | ||
|
||
// Initialize maxmind client | ||
mmClient, err := maxmind.NewClient() | ||
|
@@ -163,7 +178,7 @@ func RunAction(c *cli.Context) error { | |
// configure tiros struct | ||
t := tiros{ | ||
dbClient: dbClient, | ||
kubo: kubo, | ||
ipfs: ipfsClient, | ||
mmClient: mmClient, | ||
uClient: uClient, | ||
} | ||
|
@@ -182,7 +197,7 @@ func RunAction(c *cli.Context) error { | |
}() | ||
|
||
// shuffle websites, so that we have a different order in which we request the websites. | ||
// If we didn't do this a single website would always be requested with a comparatively "cold" kubo node. | ||
// If we didn't do this a single website would always be requested with a comparatively "cold" ipfs node. | ||
websites := c.StringSlice("websites") | ||
rand.Seed(time.Now().UnixNano()) | ||
rand.Shuffle(len(websites), func(i, j int) { | ||
|
@@ -199,7 +214,12 @@ func RunAction(c *cli.Context) error { | |
probeResults := make(chan *probeResult) | ||
|
||
go t.measureWebsites(c, websites, probeResults) | ||
go t.findAllProviders(c, websites, providerResults) | ||
|
||
if c.Bool("lookup-providers") { | ||
go t.findAllProviders(c, websites, providerResults) | ||
} else { | ||
close(providerResults) | ||
} | ||
|
||
for { | ||
select { | ||
|
@@ -242,12 +262,13 @@ func RunAction(c *cli.Context) error { | |
} | ||
|
||
func (t *tiros) InitRun(c *cli.Context) (*models.Run, error) { | ||
version, sha, err := t.kubo.Version() | ||
version, sha, err := t.ipfs.Version() | ||
if err != nil { | ||
return nil, fmt.Errorf("kubo api offline: %w", err) | ||
return nil, fmt.Errorf("ipfs api offline: %w", err) | ||
} | ||
|
||
dbRun, err := t.dbClient.InsertRun(c, fmt.Sprintf("%s-%s", version, sha)) | ||
ipfsImpl := c.String("ipfs-implementation") | ||
dbRun, err := t.dbClient.InsertRun(c, ipfsImpl, fmt.Sprintf("%s-%s", version, sha)) | ||
Comment on lines
264
to
+271
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI @dennis-tra this is failing for me locally saying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not using the local Kubo binary. It's using the HTTP API exposed by Kubo. In this case, the must be an endpoint that implements this specification: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-version I thought this was already done by @whizzzkid? |
||
if err != nil { | ||
return nil, fmt.Errorf("insert run: %w", err) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,15 @@ version: "3.9" | |
name: tiros | ||
services: | ||
ipfs: | ||
image: ipfs/kubo:v0.19.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean our measurement hasn't been using the latest Kubo? Will it use the latest Kubo and Helia going forward? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea was to indeed run the latest version of kubo and the most common one based on our measurements. In the past, this has been 0.18 and 0.19. While you're correct that we weren't running the very latest version of Kubo, his docker compose file doesn't represent our deployment. The current deployment configuration is here and with the new helia version the config looks like this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the info. I can't click through to the link. Can you please give me access? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 👍 |
||
image: helia:latest | ||
restart: unless-stopped | ||
volumes: | ||
- ipfs_path:/data/ipfs | ||
- ipfs_fuse:/ipfs | ||
- ipns_fuse:/ipns | ||
environment: | ||
DEBUG: helia-server | ||
ports: | ||
- "4001:4001/tcp" | ||
- "4001:4001/udp" | ||
- "0.0.0.0:5001:5001" | ||
- "0.0.0.0:8080:8080" | ||
chrome: | ||
image: browserless/chrome:latest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE providers; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TYPE measurement_type RENAME VALUE 'IPFS' TO 'KUBO'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TYPE measurement_type RENAME VALUE 'KUBO' TO 'IPFS'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE runs | ||
DROP COLUMN ipfs_impl; | ||
|
||
COMMIT; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE runs | ||
ADD COLUMN ipfs_impl TEXT; | ||
|
||
UPDATE runs SET ipfs_impl = 'KUBO'; | ||
|
||
ALTER TABLE runs | ||
ALTER COLUMN ipfs_impl SET NOT NULL; | ||
|
||
COMMIT; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is per instance or the global name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is per instance and would point to either Kubo or Helia. That's why I renamed it. However, I can't find any usage of that config flag anyway :D