Skip to content

Commit

Permalink
chore: update project config
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Mar 15, 2024
1 parent c370b77 commit 00fc2cb
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 87 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 20
commit-message:
prefix: "deps"
prefix-development: "deps(dev)"
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3
23 changes: 3 additions & 20 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
MIT License
This project is dual licensed under MIT and Apache-2.0.

Copyright (c) 2023 Nishant Arora

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT: https://www.opensource.org/licenses/mit
Apache-2.0: https://www.apache.org/licenses/license-2.0
5 changes: 5 additions & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
19 changes: 19 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
91 changes: 69 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# helia-http-gateway

Docker images for Helia.
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-http-gateway.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-http-gateway)
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-http-gateway/gateway-conformance.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-http-gateway/actions/workflows/gateway-conformance.yml?query=branch%3Amain)

## Purpose
> HTTP IPFS Gateway implemented using Helia
This container image hosts helia in a node container. It implements [HTTP IPFS-gateway API](https://docs.ipfs.tech/concepts/ipfs-gateway/#gateway-types) and responds to the incoming requests using helia to fetch the content from IPFS.
# About

A Dockerized application that implements the [HTTP IPFS-gateway API](https://docs.ipfs.tech/concepts/ipfs-gateway/#gateway-types) spec and responds to the incoming requests using [Helia](https://github.com/ipfs/helia) to fetch the content from IPFS.

## Run from the github container registry

```sh
$ 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.
See <https://github.com/ipfs/helia-http-gateway/pkgs/container/helia-http-gateway> for more information.

## Run Using Docker Compose

Expand All @@ -23,6 +28,7 @@ $ docker-compose up
## Run Using Docker

### Build

```sh
$ docker build . --tag helia-http-gateway:local
```
Expand All @@ -39,23 +45,37 @@ $ docker build . --platform linux/arm64 --tag helia-http-gateway:local-arm64
$ 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

```sh
$ npm run build
```

### Running

```sh
$ 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](https://docs.ipfs.tech/how-to/gateway-best-practices/#use-subdomain-gateway-resolution-for-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](https://github.com/ipfs/helia/blob/main/packages/helia/src/block-brokers/trustless-gateway/index.ts) |
| `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` |
| 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](https://docs.ipfs.tech/how-to/gateway-best-practices/#use-subdomain-gateway-resolution-for-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](https://github.com/ipfs/helia/blob/main/packages/helia/src/block-brokers/trustless-gateway/index.ts) |
| `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` |

<!--
TODO: currently broken when used in docker, but they work when running locally (you can cache datastore and blockstore locally to speed things up if you want)
Expand All @@ -77,21 +97,25 @@ You can also see some recommended environment variable configurations at:
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

```sh
$ docker run -it -p $PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_LIBP2P="false" helia
```

#### Disable bitswap

```sh
$ docker run -it -p $PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_BITSWAP="false" helia
```

#### Disable trustless gateways

```sh
$ docker run -it -p $PORT:8080 -e DEBUG="helia-http-gateway*" -e USE_TRUSTLESS_GATEWAYS="false" helia
```

#### Customize trustless gateways

```sh
$ docker run -it -p $PORT:8080 -e DEBUG="helia-http-gateway*" -e TRUSTLESS_GATEWAYS="https://ipfs.io,https://dweb.link" helia
```
Expand Down Expand Up @@ -136,7 +160,7 @@ $ npm run test:e2e-flame # Run the dev server with clinicjs flame, execute e2e t
## Metrics

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

### prom-client version

Expand All @@ -146,6 +170,29 @@ must be used by both systems. At the time of writing `fastify-metrics` uses
to add a `overrides` section to `package.json` here to ensure they use the same
version.

## Author
> Helia in Docker Container
# Install

```console
$ npm i helia-http-gateway
```

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribute

Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-http-gateway/issues).

Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) 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](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

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.

- [whizzzkid](https://github.com/whizzzkid)
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
101 changes: 56 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
{
"name": "helia-http-gateway",
"version": "0.0.1",
"description": "Helia in Docker Container",
"main": "src/index.ts",
"description": "HTTP IPFS Gateway implemented using Helia",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/helia-http-gateway#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/helia-http-gateway.git"
},
"bugs": {
"url": "https://github.com/ipfs/helia-http-gateway/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"docker",
"helia",
"p2p",
"retrievals"
],
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"project": true,
"sourceType": "module"
}
},
"scripts": {
"clean": "aegir clean dist playwright-report test",
"lint": "aegir lint",
Expand Down Expand Up @@ -31,49 +70,6 @@
"debug:test-gateways": "./debugging/test-gateways.sh",
"postinstall": "patch-package"
},
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/helia-http-gateway.git"
},
"engines": {
"node": ">=20",
"npm": ">=10"
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"project": true,
"sourceType": "module"
}
},
"keywords": [
"helia",
"docker",
"p2p",
"retrievals"
],
"author": "Nishant Arora (me@nishantarora.in)",
"license": "Apache-2.0 OR MIT",
"bugs": {
"url": "https://github.com/ipfs/helia-http-gateway/issues"
},
"homepage": "https://github.com/ipfs/helia-http-gateway#readme",
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.11.25",
"aegir": "^42.2.5",
"clinic": "^13.0.0",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"debug": "^4.3.4",
"dotenv": "^16.3.1",
"execa": "^8.0.1",
"glob": "^10.3.10",
"patch-package": "^8.0.0",
"typescript": "5.x",
"wait-on": "^7.1.0"
},
"dependencies": {
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/libp2p-yamux": "^6.0.2",
Expand Down Expand Up @@ -112,6 +108,21 @@
"pino-pretty": "^10.3.1",
"private-ip": "^3.0.2"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.11.25",
"aegir": "^42.2.5",
"clinic": "^13.0.0",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"debug": "^4.3.4",
"dotenv": "^16.3.1",
"execa": "^8.0.1",
"glob": "^10.3.10",
"patch-package": "^8.0.0",
"typescript": "5.x",
"wait-on": "^7.1.0"
},
"overrides": {
"prom-client": "^15.1.0"
}
Expand Down

0 comments on commit 00fc2cb

Please sign in to comment.