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

🙌 IPFS Weekly Call + Contributor Office Hours 📡 💫 2019-05-06 #408

Closed
olizilla opened this issue Apr 29, 2019 · 3 comments
Closed

Comments

@olizilla
Copy link
Member

olizilla commented Apr 29, 2019

Next up on the IPFS weekly call:

Piotr Dyraga - Libp2p in Keep

Monday, 06 May 2019 17:00 UTC


Are you keen to contribute to IPFS but don't know where to start? Come and ask! We're hosting a weekly office hours session for 1 hour before the IPFS weekly call, Monday, 29 Apr 2019 - 16:00-17:00 UTC, via Zoom https://protocol.zoom.us/j/443621844

Add a +1 on this issue if you are going to attend, and feel free to add questions on this issue as you think of them.

If you just want to lurk on the call and learn, thats fine. It's a safe space to ask questions about IPFS and how best to contribute. If you'd like to come help answer questions that's good too.

🧪This is an experiement 🧪 Please do join in if you're interested, and give feedback along the way.

@olizilla olizilla changed the title 🙌 IPFS Weekly Call +Contributor Office Hours 🙌 IPFS Weekly Call + Contributor Office Hours 📡 💫 Apr 29, 2019
@olizilla olizilla changed the title 🙌 IPFS Weekly Call + Contributor Office Hours 📡 💫 🙌 IPFS Weekly Call + Contributor Office Hours 📡 💫 2019-05-06 Apr 29, 2019
@olizilla
Copy link
Member Author

olizilla commented May 6, 2019

It's happening! Right now!
https://protocol.zoom.us/j/443621844

Background: #407

@olizilla
Copy link
Member Author

olizilla commented May 6, 2019

That's a wrap. Thanks for your time! We talked about:

  • No such thing as a magic IPFS block store. Some node on the network has to store the blocks you need, or else they're gone. For developers hoping to go fully serverless, you still need to host a cluster to keep your content online, or pay for a pinning service (e.g. https://pinata.cloud/ or https://infura.io/ and others) or, hold on for the decentralized digital storage market place
  • A guest had an issue with running go-ipfs on a laptop, and with 2 custom remote boostrap nodes configured, where it would not deal with the situation where you close the lid and move to a new network and open up again. Content added to the local node would not be discoverable via the 2 custom peers after a network change.
    • Need to try and recreate, may be an issue we need to fix
    • @lidel can you write up your local docker-based ipfs set up that auto-restarts the containers when the network changes?
  • https://xyo.network/ proving where things are meeting up in the world. Using IPFS to store the data on thousands of "bound witness interactions"
    • we should see if xyo want to do a presentation on the IPFS weekly call
    • I need to follow up with them about an issue around seeing the data dir balloon in size.

we also shared some links:

@lidel
Copy link
Member

lidel commented May 7, 2019

On running IPFS on a laptop and moving between networks

	"Addresses": {
		"Swarm": [
			"/ip4/0.0.0.0/tcp/4001",
			"/ip4/0.0.0.0/tcp/4042/ws",
			"/ip4/0.0.0.0/udp/4001/quic"
		],

Right now go-ipfs is oblivious to network changes. IIUC setting Swarm multiaddrs to 0.0.0.0 makes go-ipfs discover network interfaces during the boot and announce itself on all of them, but there is no logic responsible for detecting and acting upon any changes at runtime.

We have most of the necessary pieces already in place (e.g. ambient NAT autodiscovery check) to detect IP changes, so it will happen automatically at some point.

Relevant issues to follow are at libp2p/go-libp2p#1541 and ipfs/kubo#4993

Daemon restart is a quick workaround until libp2p learns to automagically deal with changing networks.

Prior Art: Tor

The Tor daemon automatically detects network changes. When I move my laptop between networks it detects connections to tor network were lost, and re-connects itself to the swarm from the new IP.

Running go-ipfs in Docker

I often need to switch between go-ipfs versions or start an emphemeral node with empty cache, so running it in Docker is quite handy and saved me a lot of time.

Below are some notes if someone wants to start playing with it.

Container with persistent storage

Create

Below command creates and starts a named (ipfs-node) container with go-ipfs that:

  • runs in background (as a daemon)
  • runs a specific version (v0.4.20) from https://hub.docker.com/r/ipfs/go-ipfs/tags/
  • runs under a dedicated user (ipfs)
  • mounts persistent storage (/home/ipfs/data, needs to be owned by ipfs user)
  • lets me import data via fs (/home/ipfs/staging, for rare cases when I can't use HTTP API)
  • uses hosts network interfaces (listening on default ports, no additional NAT, no need to forward ports, local discovery works)
  • will automatically restart go-ipfs if Docker restarts, unless manually stopped (--restart unless-stopped)
    • this turned out to be quite useful on my travel laptop when I move between different networks. I've set it up to restart docker daemon every time machine wakes up from hibernation. When I move from one network to another, my go-ipfs will reboot and effectively re-discover and re-announce new network address (thanks to --net=host)
    • if you are using Linux with systemd depending on sleep.target should do the trick
$ docker run -d --name ipfs-node --user ipfs --group-add ipfs --restart unless-stopped --net=host -v /home/ipfs/staging:/export -v /home/ipfs/data:/data/ipfs ipfs/go-ipfs:v0.4.20

Start / Stop

Once created, container can be started stopped using its name (ipfs-node)

$ docker stop ipfs-node
$ docker start ipfs-node

Execute arbitrary command in running container

$ docker exec ipfs-node ipfs version --all
go-ipfs version: 0.4.20-
Repo version: 7
System version: amd64/linux
Golang version: go1.12.4

Set up your host to use API from container

$ echo -n "/ip4/127.0.0.1/tcp/5001" > ~/.ipfs/api

Having this, ipfs command on host will connect and use the node in docker. It also works with ipfs-desktop, it runs fine with go-ipfs running in docker.

Ephemeral container

If you want to run go-ipfs without persisting its configuration and data (e.g for testing):

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

It will run in interactive mode (-it) blocking the terminal and will remove the container (--rm) after Ctrl+C, so no additional cleanup is necessary.

Running ipfs-cluster in Docker

IPFS Cluster runs in docker too: https://hub.docker.com/r/ipfs/ipfs-cluster/tags/

$ docker run -it --rm --net=host ipfs/ipfs-cluster:v0.10.1

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

No branches or pull requests

2 participants