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

Trying to setup ipfs-node in docker and remote-access to private docket-ip for WebUI #939

Closed
typoworx-de opened this issue Jan 15, 2019 · 4 comments

Comments

@typoworx-de
Copy link

typoworx-de commented Jan 15, 2019

I'm trying to setup my first test-node using Docker (Image: jbenet/go-ipfs:latest). ipfs seems to work. But the web-ui always tries to connect to 127.0.0.1. I've setup my docker to private network bride using 172.30.0.100.

I was able to fiddle around enough to make the webui connect to the correct IP. This results into the following console-trace (browser-console trying with google-chrome).

Trying IPFS Companion
index.js:8 🎛️ Customise your js-ipfs-api options by storing a `ipfsApi` object in localStorage. e.g. localStorage.setItem('ipfsApi', '/ip4/127.0.0.1/tcp/5001')
index.js:21 Failed to convert http://172.30.0.100:5001 to a multiaddr
index.js:35 Trying ipfs-api /ip4/127.0.0.1/tcp/5001
GET http://**172.30.0.100:5001**/ipfs/QmSDgpiHco5yXdyVTfhKxr3aiJ82ynz8V14QcGKicM3rVh/locales/en/translation.json 404 (Not Found)
POST http://**127.0.0.1:5001**/api/v0/get?arg=QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn&stream-channels=true net::ERR_CONNECTION_REFUSED

I don't understand why this happens as the IP (in first place) is correct now until it fails to fallback 127.0.0.1:5001 again.

I already looked over a bunch of issues and possible solutions, but none of them was working for me yet. Why can't there be any easy way to configure ipfs-api host in config?

@alx696
Copy link

alx696 commented Jan 16, 2019

@typoworx-de webui always use /ip4/127.0.0.1/tcp/5001 as the default API address, until you change it use localStorage.setItem('ipfsApi', '/ip4/172.30.0.100/tcp/5001').

I dont try docker. But its worked for me after i expose API, allow CORS, change API address with ip. Look at #940 .

@alexfisher
Copy link

I'm also having no luck getting this to work. I have docker running on a server on my LAN (192.168.30.7), ports are open to 0.0.0.0 on Docker and have configured anything and everything. Can wget on the server and see the webui, but no luck elsewhere on my network. Have tried all sorts of IPFS config changes, e.g.

docker exec ipfs_host ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

docker exec ipfs_host ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'

docker exec ipfs_host ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

docker exec ipfs_host ipfs config --json Addresses.API '["/ip4/192.168.30.7/tcp/5001"]'

Connection is refused. No firewall on Ubuntu server enabled.

@jessicaschilling
Copy link
Contributor

Hi @alexfisher -- this issue is a bit stale, may I suggest bringing it up in the forums? https://discuss.ipfs.io/
Thanks!

@lidel
Copy link
Member

lidel commented Jul 30, 2020

I am closing this because original issue (Failed to convert http://172.30.0.100:5001 to a multiaddr) is fixed in the latest webui.

Below are some additional pointers for webui and docker, if you still have problems, please fill a new issue.


On API access from browser

(iirc) go-ipfs disalows API access from a browser without Origin nor Referer headers (ipfs/go-ipfs-cmds#193) and in some cases requires hostname to be loopback device (127.0.0.1), so setting CORS may not be enough.

👉 If you need webui, the rule of thumb is to set up port forwarding, so your browser talks to a port on 127.0.0.1 – in that scenario webui should load just fine. If not, please fill a new issue describing your network topology and errors observed in the browser console.

On webui and node running in Docker

As for using webui with go-ipfs running in docker, the problem is in the bridge you've set up. You either need to expose API port on the host machine, or simply disable bridge networking and use host's interface.

Try running with --net=host and then opening https://127.0.0.1:5001:

$ docker run --rm -it --net=host ipfs/go-ipfs:v0.6.0

@lidel lidel closed this as completed Jul 30, 2020
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

No branches or pull requests

5 participants