Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
IPFS snap testing

Build in archlinux

Install docker:

$ sudo pacman -S docker
$ sudo systemctl start docker
$ sudo gpasswd -a $USER docker
$ newgrp docker

Clone the repo:

$ sudo packman -S git
$ git clone https://github.com/elopio/ipfs-snap
$ cd ipfs-snap

Build the snap in a docker container:

$ docker run -v $(pwd):/cwd snapcore/snapcraft sh -c 'apt install software-properties-common wget -y && add-apt-repository -y ppa:gophers/archive && apt update && cd /cwd && snapcraft

Install snapd:

$ sudo pacman -S snapd
$ sudo systemctl enable --now snapd.socket

Because in archlinux the /snap/bin path is not added to $PATH, do this quick hack:

$ alias ipfs=/snap/bin/ipfs

This is reported in https://bugs.launchpad.net/snappy/+bug/1639095

Build in ubuntu

Install snapcraft:

$ sudo apt install snapcraft

Clone the repo:

$ sudo apt install git
$ git clone https://github.com/elopio/ipfs-snap
$ cd ipfs-snap

Configure the PPA with go 1.7:

$ sudo add-apt-repository ppa:gophers/archive
$ sudo apt update

Build the snap:

$ snapcraft

Smoke tests for the IPFS snap

(based on https://ipfs.io/docs/getting-started/)

First, install the snap:

$ sudo snap install ipfs --candidate

Init the repo:

$ ipfs init
initializing ipfs node at $HOME/ipfs/x1/.ipfs
generating 2048-bit RSA keypair...done
peer identity: $hash
to get started, enter:

    ipfs cat /ipfs/$hash/readme

Show the readme:

$ ipfs cat /ipfs/$hash/readme
Hello and Welcome to IPFS!

██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗  ███████╗
██║██╔═══╝ ██╔══╝  ╚════██║
██║██║     ██║     ███████║
╚═╝╚═╝     ╚═╝     ╚══════╝

If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!
[...]

Go online:

$ ipfs daemon
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

The server keeps running in this terminal, so open another one for the following tests.

Show the addresses of the peers:

$ ipfs swarm peers
/ip4/[...]/tcp/4001/ipfs/[...]
/ip4/[...]/tcp/4001/ipfs/[...]
/ip4/[...]/tcp/4001/ipfs/[...]
/ip4/[...]/tcp/4001/ipfs/[...]

Get an object from the network:

$ ipfs cat /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ/cat.jpg > cat.jpg
$ eog cat.jpg

Put an object in the network:

$ hash=`echo "I <3 IPFS -$(whoami)" | ipfs add -q`
$ curl "http://localhost:8080/ipfs/$hash"
I <3 IPFS -elopio
$ curl "https://ipfs.io/ipfs/$hash"
I <3 IPFS -elopio

Open the web ui:

$ sensible-browser http://localhost:5001/webui

View the connected peers:

1. Click the `Connections` item in the list on the left.
2. Wait for the connected peers to show up in the map.
Owner

elopio commented Sep 29, 2016

Tested in an ubuntu xenial kvm. No errors found.

freekvh commented Jan 27, 2017

It works well:
sudo snap install ipfs --candidate
Installed nicely, but what does --candidate mean?

Also, perhaps you can add a way to change the default 8080 port this port is very often already taken which leads to errors. I tried ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/9001 myself, the daemon starts and works but I have no idea where the webui is (not at localhost:9001/webui)

Perhaps instruction on how the daemon start automatically? So that your node is online after a reboot without manual actions...

Thank you.

Owner

elopio commented Jan 28, 2017

@freekert candidate is the channel in the store. We have four channels, with different levels of stability: edge, beta, candidate, stable.

This is just using the default ipfs port. If you want to suggest a different default, you should talk to upstream: ipfs.io
And autostarting the daemon on the snap would be nice. I will try it.

Thanks for your report. A new candidate version is coming soon, let me know how the update goes for you.

Everything seemed to work for me. Barry.

letozaf commented Feb 7, 2017

Everything ok also for me a part the connected peers not showing, but that has already been reported upstream. (Tested v0.4.5-rc2)

casept commented Feb 12, 2017

Works fine on debian sid.

Hi, Leo.

As per my email, I'm keen to help with testing. I have a Linux Mint xfce box, and a spare 32-bit laptop. Also just got a Raspberry Pi 3, which may help from an ARM perspective. I'll try to run the above tests, in the next 24hrs.

Thanks,

Chris
(chris_debian)

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