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

Connect to a remote IPFS server with multiaddr /dns4/name — required for docker-compose v3+ usage #462

Closed
14 of 25 tasks
larskluge opened this issue Jun 11, 2018 · 7 comments
Assignees
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up

Comments

@larskluge
Copy link

Pre-check

  • This is not a IPFS Cluster website content issue (file those here)
  • I read the troubleshooting section of the website and it did not help
  • I searched for similar issues in the repo without luck
  • All my peers are running the same cluster version
  • All my peers are configured using the same cluster secret

Basic information

  • Version information (mark as appropiate):
    • Master
    • Release candidate for next version
    • Latest stable version
    • An older version I should not be using
  • Type (mark as appropiate):
    • Bug
    • Feature request
    • Enhancement
  • Operating system (mark as appropiate):
    • Linux
    • macOS
    • Windows
    • Other: which?
  • Installation method (mark as appropiate):
    • Binaries from dist.ipfs.io
    • Built from sources
    • Docker
    • Snap
    • Other: which?

Description

I'm trying to get ipfs-cluster connect to a remote ipfs server instance via IPFS_API environment var & a docker compose setup v3+ and I'm running into this error:

error creating IPFS Connector component: /dns4/ipfs/tcp/5001 is not a 'thin waist' address

my docker-compose.yml:

version: '3'
services:
  ipfs:
    image: jbenet/go-ipfs
  ipfs-cluster:
    image: ipfs/ipfs-cluster:v0.4.0
    environment:
      IPFS_API: "/dns4/ipfs/tcp/5001"
      # od  -vN 32 -An -tx1 /dev/urandom | tr -d ' \n'
      CLUSTER_SECRET: ac8acc267a3556c6cde27c881e4a311db210b7242abb36ad14f77e6827a690c6

Note: I'd like to use the recent docker compose v3+ format, meaning its not allowed to specify ip4 addresses for services/containers anymore.

A proposed version with fixed IPs does not work for me due to the docker-compose v2 vs. v3 #376 and https://docs.docker.com/compose/compose-file/#ipv4_address-ipv6_address

Is there a way to run ipfs-cluster with docker-compose v3+ ? Thanks!

@lanzafame
Copy link
Contributor

@larskluge Just confirming you got the following error from running docker-compose up:

ipfs-cluster_1  | Using $IPFS_API as value for ipfs_connector.ipfshttp.node_multiaddress in configuration
ipfs-cluster_1  | Warning: By default, the API and Proxy endpoints will listen on 0.0.0.0!
ipfs-cluster_1  | 00:23:51.096  INFO    service: Initializing. For verbose output run with "-l debug". Please wait... daemon.go:42
ipfs-cluster_1  | error creating IPFS Connector component: /dns4/ipfs/tcp/5001 is not a 'thin waist' address

@larskluge
Copy link
Author

Yes, that's it. Thank you @lanzafame

@hsanjuan hsanjuan added kind/bug A bug in existing code (including security flaws) exp/novice Someone with a little familiarity can pick up status/in-progress In progress P1 High: Likely tackled by core team if no one steps up labels Jun 12, 2018
@hsanjuan hsanjuan self-assigned this Jun 12, 2018
hsanjuan added a commit that referenced this issue Jun 12, 2018
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
@hsanjuan
Copy link
Collaborator

Hey @larskluge , can you test with docker image ipfs/ipfs-cluster:fix462 and let me know if things are working better for you?

(also mind you pasted your secret publicly)

@larskluge
Copy link
Author

Beautiful, that fixes it—thanks for addressing and fixing it (well, adding this feature :) so quickly, much appreciated!

PS: And thanks for the hint, but don't worry, the posted 'secret' was modified to be more a 'public secret'.. ;-)

@ghost ghost removed the status/in-progress In progress label Jun 12, 2018
hsanjuan added a commit that referenced this issue Jun 12, 2018
Fix #462: Support DNS multiaddresses for node_multiaddress
@hsanjuan hsanjuan mentioned this issue Jun 12, 2018
@hsanjuan
Copy link
Collaborator

@larskluge it's a bug that this feature was not there yet :)

@dill0wn
Copy link

dill0wn commented Aug 1, 2018

I know this isn't quite the same issue, but I'm unable to get my cluster to recognize the $IPFS_API environment variable.

version: '3'

networks:
  ipfs_net:

services:
  ipfs:
    image: ipfs/go-ipfs
    command: 
      - daemon
      - --writable
      - --enable-pubsub-experiment
    # expose:
    #   - 4001
    #   - 5001
    #   - 8080
    ports:
      - "4001:4001"
      - "5001:5001"
      - "8080:8080"
    networks:
      - ipfs_net

  ipfs-cluster:
    image: ipfs/ipfs-cluster
    networks:
      - ipfs_net
    depends_on:
      - ipfs
    ports:
      - 9095:9095
      - 9096:9096
    environment:
      IPFS_API: "/dns4/ipfs/tcp/5001"
ipfs_1          | Changing user to ipfs
ipfs-cluster_1  | Changing user to ipfs
ipfs_1          | ipfs version 0.4.15
ipfs_1          | Found IPFS fs-repo at /data/ipfs
ipfs_1          | Initializing daemon...
ipfs-cluster_1  | ipfs-cluster-service version 0.4.0
ipfs-cluster_1  | Found IPFS cluster configuration at /data/ipfs-cluster
ipfs-cluster_1  | 20:53:36.726  INFO    service: Initializing. For verbose output run with "-l debug". Please wait... daemon.go:42
ipfs-cluster_1  | 20:53:36.729 ERROR     config: error parsing ipfs_node_multiaddress: no protocol with name ipv4 config.go:288
ipfs-cluster_1  | 20:53:36.737 ERROR     config: error parsing ipfs_node_multiaddress: no protocol with name ipv4 config.go:288
ipfs-cluster_1  | 20:53:36.752  INFO    cluster: IPFS Cluster v0.4.0-ac082929 listening on:
ipfs-cluster_1  |         /ip4/127.0.0.1/tcp/9096/ipfs/SOMEHASH
ipfs-cluster_1  |         /ip4/192.168.96.3/tcp/9096/ipfs/SOMEHASH
ipfs-cluster_1  | 
ipfs-cluster_1  |  cluster.go:95
ipfs-cluster_1  | 20:53:36.753  INFO  consensus: existing Raft state found! raft.InitPeerset will be ignored raft.go:203
ipfs-cluster_1  | 20:53:36.753  INFO    restapi: REST API (HTTP): /ip4/0.0.0.0/tcp/9094 restapi.go:386
ipfs-cluster_1  | 20:53:36.753  INFO   ipfshttp: IPFS Proxy: /ip4/127.0.0.1/tcp/9095 -> /ip4/127.0.0.1/tcp/5001 ipfshttp.go:201
ipfs-cluster_1  | 20:53:36.753  INFO    restapi: REST API (libp2p-http): ENABLED. Listening on:
ipfs-cluster_1  |         /ip4/127.0.0.1/tcp/9096/ipfs/SOMEHASH
ipfs-cluster_1  |         /ip4/192.168.96.3/tcp/9096/ipfs/SOMEHASH
ipfs-cluster_1  | 
ipfs-cluster_1  |  restapi.go:403
ipfs_1          | Swarm listening on /ip4/127.0.0.1/tcp/4001
ipfs_1          | Swarm listening on /ip4/192.168.96.2/tcp/4001
ipfs_1          | Swarm listening on /p2p-circuit/ipfs/SOMEOTHERHASH
ipfs_1          | Swarm announcing /ip4/127.0.0.1/tcp/4001
ipfs_1          | Swarm announcing /ip4/192.168.96.2/tcp/4001
ipfs_1          | API server listening on /ip4/0.0.0.0/tcp/5001
ipfs_1          | Gateway (writable) server listening on /ip4/0.0.0.0/tcp/8080
ipfs_1          | Daemon is ready
ipfs-cluster_1  | 20:53:38.754  INFO  consensus: Current Raft Leader: SOMEHASH raft.go:293
ipfs-cluster_1  | 20:53:38.755  INFO    cluster: Cluster Peers (without including ourselves): cluster.go:388
ipfs-cluster_1  | 20:53:38.755  INFO    cluster:     - No other peers cluster.go:390
ipfs-cluster_1  | 20:53:38.755  INFO    cluster: ** IPFS Cluster is READY ** cluster.go:401
ipfs-cluster_1  | 20:53:38.757 ERROR   ipfshttp: error posting to IPFS:Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: connect: connection refused ipfshttp.go:750
ipfs-cluster_1  | 20:53:38.757 ERROR   ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: connect: connection refused ipfshttp.go:900
ipfs-cluster_1  | 20:53:38.757 ERROR  p2p-gorpc: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: connect: connection refused call.go:64
ipfs-cluster_1  | 20:53:38.757 ERROR   diskinfo: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: connect: connection refused disk.go:87

Most notably, i'm not seeing the line mentioned above:

ipfs-cluster_1  | Using $IPFS_API as value for ipfs_connector.ipfshttp.node_multiaddress in configuration

@hsanjuan
Copy link
Collaborator

hsanjuan commented Aug 2, 2018

@dill0wn this is because there is already a service.json in place:

Found IPFS cluster configuration at /data/ipfs-cluster

The node_multiaddress in it will apply. $IPFS_API is only used when no service.json exists and the entrypoint initializes a default one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up
Projects
None yet
Development

No branches or pull requests

4 participants