Giter Site home page Giter Site logo

zababurinsergei / helia-http-gateway Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ipfs/helia-http-gateway

0.0 0.0 0.0 769 KB

Run Helia NodeJS in a Docker Container.

License: Other

Shell 15.59% JavaScript 23.15% TypeScript 59.12% Dockerfile 2.14%

helia-http-gateway's Introduction

helia-http-gateway

ipfs.tech Discuss codecov CI

HTTP IPFS Gateway implemented using Helia

About

A Dockerized application that implements the HTTP IPFS-gateway API spec and responds to the incoming requests using Helia to fetch the content from IPFS.

Run from the github container registry

$ docker run -it -p 8080:8080 ghcr.io/ipfs/helia-http-gateway:latest

See https://github.com/ipfs/helia-http-gateway/pkgs/container/helia-http-gateway for more information.

Run Using Docker Compose

$ docker-compose up

Run Using Docker

Build

$ docker build . --tag helia-http-gateway:local

Pass the explicit platform when building on a Mac.

$ docker build . --platform linux/arm64 --tag helia-http-gateway:local-arm64

Running

$ docker run -it -p 8080:8080 -e DEBUG="helia-http-gateway*" helia-http-gateway:local # or helia-http-gateway:local-arm64

Run without Docker

### Build

$ npm run build

Running

$ npm start

Supported Environment Variables

Variable Description Default
DEBUG Debug level ''
FASTIFY_DEBUG Debug level for fastify's logger ''
PORT Port to listen on 8080
HOST Host to listen on 0.0.0.0
USE_SUBDOMAINS Whether to use origin isolation true
METRICS Whether to enable prometheus metrics. Any value other than 'true' will disable metrics. true
USE_BITSWAP Use bitswap to fetch content from IPFS true
USE_TRUSTLESS_GATEWAYS Whether to fetch content from trustless-gateways or not true
TRUSTLESS_GATEWAYS Comma separated list of trusted gateways to fetch content from Defined in Helia
USE_LIBP2P Whether to use libp2p networking true
ECHO_HEADERS A debug flag to indicate whether you want to output request and response headers false
USE_DELEGATED_ROUTING Whether to use the delegated routing v1 API true
DELEGATED_ROUTING_V1_HOST Hostname to use for delegated routing v1 https://delegated-ipfs.dev
USE_DHT_ROUTING Whether to use @libp2p/kad-dht for routing when libp2p is enabled true
USE_SESSIONS If true, use a blockstore session per IPFS/IPNS path true

See the source of truth for all process.env.<name> environment variables at src/constants.ts.

You can also see some recommended environment variable configurations at:

Running with custom configurations

Note that any of the following calls to docker can be replaced with something like MY_ENV_VAR="MY_VALUE" npm run start

Disable libp2p

$ docker run -it -p $RPC_PORT:5001 -p $HTTP_PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_LIBP2P="false" helia

Disable bitswap

$ docker run -it -p $RPC_PORT:5001 -p $HTTP_PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_BITSWAP="false" helia

Disable trustless gateways

$ docker run -it -p $RPC_PORT:5001 -p $HTTP_PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_TRUSTLESS_GATEWAYS="false" helia

Customize trustless gateways

$ docker run -it -p $RPC_PORT:5001 -p $HTTP_PORT:8080 -e DEBUG="helia-http-gateway*" -e TRUSTLESS_GATEWAYS="https://ipfs.io,https://dweb.link" helia

E2E Testing

We have some tests enabled that simulate running inside of ProbeLab's Tiros, via playwright. These tests request the same paths from ipfs.io and ensure that the resulting text matches. This is not a direct replacement for gateway conformance testing, but helps us ensure the helia-http-gateway is working as expected.

By default, these tests:

  1. Run in serial
  2. Allow for up to 5 failures before failing the whole suite run.
  3. Have an individual test timeout of two minutes.

Run e2e tests locally

$ npm run test:e2e # run all tests
$ npm run test:e2e -- ${PLAYWRIGHT_OPTIONS} # run tests with custom playwright options.

Get clinicjs flamecharts and doctor reports from e2e tests

$ npm run test:e2e-doctor # Run the dev server with clinicjs doctor, execute e2e tests, and generate a report.
$ npm run test:e2e-flame # Run the dev server with clinicjs flame, execute e2e tests, and generate a report.

Metrics

Running with METRICS=true will enable collecting Fastify/libp2p metrics and will expose a prometheus collection endpoint at http://localhost:8080/metrics

js-libp2p metrics are collected by default, but can be disabled by setting USE_LIBP2P_METRICS=false. Find out more details at https://github.com/libp2p/js-libp2p/tree/main/packages/metrics-prometheus

Viewing metrics

See Metrics config for more information on how to view the generated metrics.

Install

$ npm i helia-http-gateway

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

http://bafkreid7qoywk77r7rj3slobqfekdvs57qwuwh5d2z3sqsw52iabe3mqne.ipfs.localhost:4867/ http://bafkreid7qoywk77r7rj3slobqfekdvs57qwuwh5d2z3sqsw52iabe3mqne.ipfs.localhost:8080/

helia-http-gateway's People

Contributors

sgtpooki avatar achingbrain avatar whizzzkid avatar dependabot[bot] avatar web-flow avatar aschmahmann 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.