Giter Site home page Giter Site logo

ipfs-testbed's Introduction

JS IPFS Testbed

A testbed for JS-IPFS built using Toxiproxy and Kubernetes. It's designed to work locally in your Minkube setup or it can be deployed in any current K8s cluster you have and scale it up as much as you like.

dashboard

discovery

Goals

The purpose of this testbed is to run tests for my M.Sc. Thesis project, Pulsarcast. What I was looking for initially was:

  • Configure and deploy a large amount of IPFS nodes in an automated and predictable way
  • Scale as much as our wallet can afford πŸ’ΈπŸ’Έ
  • Interaction with the nodes should:
    • Be simple and allow automation/scripts to be built on top of it
    • Allow to target commands to a specific node
    • Allow to target commands at a random node
  • Allow to simulate network failures, latency and other relevant issues
  • Continuously monitor and collect relevant data from the IPFS deployments and the resources used (network, disk, memory, CPU)

How it works

IPFS and Toxiproxy

We deploy using Helm and use a specific chart that deploys in a single pod an IPFS node and a Toxiproxy container as a sidecar, through where all the libp2p-swarm communication flows. Each deployment exposes the IPFS HTTP API, the Toxiproxy HTTP API and the libp2p-swarm TCP port proxied by toxiproxy.

A service of type NodePort is created for each deployment, exposing each IPFS Node in a random port at each K8s Node (in the future ingreses might be considered). This also makes each IPFS node discoverable using the DNS records created by K8s for each service.

Readiness and liveness probes are configured by default, as well as the proxy setup for libp2p-swarm default TCP port.

You can fine tune the config of both Toxiproxy and IPFS, including even the docker images used, using the available options at the Helm chart.

Test and interaction

The deployment described above gives you two HTTP APIs that allow you to run toxics (network interferance) and IPFS commands at each node.

With this in mind we've build a CLI utility to cut down the burden of interacting with any specific node, running IPFS commands, or create/delete toxics.

Monitoring and collecting data/results

The final component of the testbed is an ELK setup (Elasticsearch, Logstash and Kibana), also deployed in Kubernetes, used to monitor and collect data from your IPFS nodes. Filebeat and Metricbeat are used to read the logs and metrics from your k8s cluster, forward these to logstash for processing which finally stores it in Elasticsearch. Kibana provides an UI from where you can query your data and build visualizations with it (some are already available in this repo, but you're of course free to add more).

Requirements

In order to use and run everything in here you'll need:

  • kubernetes cluster >=v1.9
  • kubectl
  • helm
  • bash
  • jq
  • make
  • nodejs >=8 in order to use the cli

IMPORTANT: both the CLI and the Makefiles will use your current kube context, so make sure to have the right cluster selected before jumping on this.

Install

Clone the repo:

git clone [email protected]:JGAntunes/ipfs-testbed.git

All the Kubernetes setup we use is modularised and prepared to be installed using make so that you're free to setup and use what you feel fits your needs.

If you want to, you can deploy everything ofc.

Run thtough the sub dirs in ./kubernetes and run make (except for ipfs-testbed, that will be the next and final deployment step)

Finally, deploy ipfs-testbed selecting the option that best suits you:

# Deploy 10 nodes, two of which will act as bootstrap nodes
# to which every other node will connect
NODE_NUMBER=10 BOOTSTRAP_NUMBER=2 make install_bootstraped

# Deploy 10 nodes, with each node connecting by default with
# the previous one
NODE_NUMBER=10 make install_linked

In order to use the CLI run npm install in the root dir:

npm install

CLI Usage

Once installed, you can use the cli to interact with the testbed.

Check the CLI Repo for more info.

License

MIT

ipfs-testbed's People

Contributors

jgantunes avatar johnytiago avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.