Code Monkey home page Code Monkey logo

eyepfs's Introduction

Hosted IPFS Gateway & HTTP Proxy

Purpose

Overcome public IPFS gateway limitations, such as 429 Too Many Requests, by hosting your own IPFS Gateway and HTTP Proxy.

429 Example

Usage

git clone https://github.com/o-az/eyepfs.git

Build Dockerfile

docker buildx build . \
  --progress 'plain' \
  --file 'Dockerfile' \
  --platform 'linux/amd64' \
  --tag 'ipfs_gateway_proxy'

# or `make docker-build`

Run the image you just built

docker run \
  --rm \
  -it \
  --name 'ipfs_gateway_proxy' \
  --env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' \
  --env ALLOW_ORIGINS='*' \
  --publish '3031:3031' \
  --platform 'linux/amd64' \
  'ipfs_gateway_proxy'

# or `make docker-run`

Run a quick test

note: btw it may need a few seconds if it's your first time, no more than 6. So if request fail, just retry

Open this in browser: http://127.0.0.1:3031/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi

or run this:

curl --location --request GET \
  --url 'http://127.0.0.1:3031/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi' \
  --output '/tmp/ipfs_proxy_image.jpeg' && \
  stat '/tmp/ipfs_proxy_image.jpeg'

Restricting access to your gateway is as simple as setting ALLOW_ORIGINS to a comma separated list of allowed origins. Example:

docker run \
  --rm \
  -it \
  --name 'ipfs_gateway_proxy' \
  --env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' \
  --env ALLOW_ORIGINS='http://example.com,http://example.org' \
  --publish '3031:3031' \
  'ipfs_gateway_proxy'

Deployment

anywhere that can run a Dockerfile ๐Ÿณ

Railway.app

RAILWAY_DOCKERFILE_PATH=Dockerfile railway up --service 'api' --detach --environment 'production'

fly.io

fly deploy --app='ipfs_gateway' --dockerfile Dockerfile --remote-only --detach --build-arg PORT=3031 --env IPFS_PROFILE='server' --env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' --env ALLOW_ORIGINS='*'

Upcoming Features

  • ๐Ÿ”จ (CORS) configuration,
  • (Kubo) disable all methods but GET and HEAD, and OPTIONS for CORS,
  • (Kubo) set Swarm#ConnMgr#Type to "none" (disable all swarm connections),
  • (CI) workflow publish image to Docker Hub & GitHub Container Registry,
  • (CI) Generate a simple performance report on push,
  • Got any ideas? Let's chat

If an item has ๐Ÿ”จ it means it's configurable through env variables

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.