Skip to content

Conversation

@whizzzkid
Copy link

@whizzzkid whizzzkid commented Oct 30, 2023

Run: docker compose -f docker-compose.helia.yml up

Fixes runs for https://github.com/ipfs/helia-http-gateway

The problem:

  • hardcoding the IP address works for kubo, but not for other implementations.
  • this fixes that.
  • makes other configs dynamic as well.

KI (mac):

Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
@whizzzkid whizzzkid marked this pull request as ready for review October 30, 2023 23:54
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Copy link
Author

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

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

self-review.

cmd_run.go Outdated
// 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")))
Copy link
Author

Choose a reason for hiding this comment

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

this right here becomes a problem as soon as you're dealing with docker networking. The containers should be allowed to bind to any IP, not the localhost always like kubo prefers.

p.browser = rod.New().
Context(p.ctx). // stop when outer ctx stops
ControlURL(fmt.Sprintf("ws://localhost:%d", p.cdpPort))
ControlURL(fmt.Sprintf("ws://%s:%d", p.chromeHost, p.cdpPort))
Copy link
Author

Choose a reason for hiding this comment

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

while we're at it, might as well.

@@ -0,0 +1,66 @@
version: "3.9"
Copy link
Author

Choose a reason for hiding this comment

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

sample of how these values can be used to host an ipfs implementation in a container.

db:
image: postgres:14
ports:
- "5432:5432"
Copy link
Author

Choose a reason for hiding this comment

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

no custom port needed.

command: bash -c "cd /tiros && go run *.go run"
networks:
tiros_net:
ipv4_address: 172.20.0.5
Copy link
Author

Choose a reason for hiding this comment

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

optional

Comment on lines +45 to +48
depends_on:
- db
- helia
- chrome
Copy link
Author

Choose a reason for hiding this comment

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

important.

@whizzzkid whizzzkid changed the title Fixed! fix(networking): For Helia and Others. Oct 31, 2023
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Comment on lines +12 to +21
dnsmasq:
image: 4km3/dnsmasq:2.85-r2
command: -A /.helia/172.20.0.2
ports:
- 53:53/udp
cap_add:
- NET_ADMIN
networks:
tiros_net:
ipv4_address: 172.20.0.10 # Static IP here makes it possible to point other containers' dns here.
Copy link
Author

Choose a reason for hiding this comment

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

custom DNS resolves all requests to helia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant