Setting up IPFS on a chromebook

Connecting to the world

Published January 7, 2019 #howto #ipfs #chromebook

Lets look at how to run an ipfs node on a chromebook. We are using the linux container for this, and in order to get the experience right we’ll need to install some chrome extensions to make it work seamlessly.

IPFS is a distributed hypermedia protocal that is a way to access and share data using it’s cryptographic key. This way, it doesn’t matter where you get the data from, since you know that if it matches the key, then the data is what you requested. Once you request the data, you make it available to other computers on the network. As a result, the data doesn’t really live on any particular server, and the more people that access it the faster is it. Also, the data moves to where people access it, so if you publish something in New York and it becomes popular in New Zealand, the folks in New Zealand will end up downloading it from each other rather than over the underocean cables.

Here’s the outline:

  1. Download the ipfs binary
  2. Init your repository
  3. Change the config to open up the linux container to the chromebook
  4. Start the daemon
  5. Install the chrome extension that maps localhost:5001 to penguin.linux.test:5001
  6. Install the IPFS companion chrome extenstion

Lets get started.

Download IPFS

The instuctions for installing IPFS are pretty simple. First download the binary from the prebuilt repository, unpack it, and run the install script.

$ cd /tmp
$ curl -O https://dist.ipfs.io/go-ipfs/v0.4.18/go-ipfs_v0.4.18_linux-amd64.tar.gz
$ tar xzf go-ipfs_v0.4.18_linux-amd64.tar.gz
$ cd go-ipfs/
$ sudo ./install.sh
Moved ./ipfs to /usr/local/bin

Init the repository

$ ipfs init

Change the config to open up the linux container to the chromebook

We’ll need to edit the configuration so that the daemon binds to any network address, rather than being hardcoded to 127.0.0.1. Inside of .ipfs/config changes the "Addresses" stanza so that it looks like this when you run ipfs config Addreesses:

$ ipfs config Addresses
{
  "API": "/ip4/0.0.0.0/tcp/5001",
  "Announce": [],
  "Gateway": "/ip4/0.0.0.0/tcp/8080",
  "NoAnnounce": [],
  "Swarm": [
    "/ip4/0.0.0.0/tcp/4001",
    "/ip6/::/tcp/4001"
  ]
}

Start the Daemon

I’m enabling a few experimental features, but those are optional. Also, I prefer to have it run manually rather than in a start script, so I’m happy to do this by hand everytime I want to access the network but you may want to look into a writing it as a service to run whenever the container starts.

$ ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub

Install connection forwarder

Now we go to chrome and install the connection forwarder. What we want to do is to make “localhost:5001” redirect on the local box to “penguin.linux.test:5001” so that we can look at the web ui.

Once it’s installed, select “Add a Rule”. The source address is localhost:5001. For destination, select custom, and have the target address be penguin.linux.test:5001.

config screenshot

Now if you go to localhost:5001/webui you should be able to see your local node running! Note that you need to keep the Connection Forwarder window open for this to keep working, or manually turn on “run in background”

Install ipfs companion

Go to the chromestore again and install IPFS companion. Once this is running you should be able to see the number of connected peers in the tab of the browser window:

extension screenshot

And that’s it

It takes up a fair amount of ram and slows the computer down a bit, which is why I don’t have it running all the time. But its very fun to experiment with!

Read next

See also

Getting firebase and grpc working under termux

firebase depends on grpc, which isn’t set to build right on the Chromebook. This is because node-pre-gyp, which is used to download precompiled binaries, is not setup correctly. In then uses node-gyp to compile the C++ bindings directly, which is also not setup correctly. We are going to adjust the settings of node-gyp to make it compile things right under termux, and then we are going to tweak the grpc package itself in our local cache to make it build correctly.

Read more

Image Manipulation in Firebase

its all javascript

We can manipulate images using JavaScript directly, which can be run both on the server or browser environment. Lets take a look at how we’d do this using create-react-app and firebase. We will deploy a function on firebase that will download the user’s avatar, manipulate the image and overlay it with a mask, and then spit out an image. Project Setup First make sure that you have nvm installed. We’ll need a different version of node for create-react-app then we will for firebase functions.

Read more

Implementing Serverless OAuth

for JAM Stacks and static sites

Most of the serverless platforms have their own forms of authentication, but it might not support the specific service that you are looking to use. Lets go through how we can build a react single page app, hosting on firebase, that talks to the unsplash service directly. It will be hosted on firebase stoage, and with a tiny bit of firebase functions to tie it together. How oauth works Here is the overall process:

Read more