Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add s3 support for blockstore and datastore #532

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .env-all
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ USE_DELEGATED_ROUTING=true
# FILE_DATASTORE_PATH=./data/datastore
# FILE_BLOCKSTORE_PATH=./data/blockstore

# Uncomment the below to use S3 for blockstore and datastore
# S3_BUCKET=[bucket name]
# S3_ENDPOINT=[optional endpoint to use S3 compatible storage]
# S3_ACCESS_KEY_ID=[access key id]
# S3_SECRET_ACCESS_KEY=[secret access key]
# AWS_REGION=[if using AWS, set this to your region]

# If you want to run the gateway with a local trustless gateway, uncomment the below
# PORT=8090 # or whatever port you want to run helia-http-gateway on
# TRUSTLESS_GATEWAYS=http://127.0.0.1:8080
# TRUSTLESS_GATEWAYS=http://127.0.0.1:8080
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ test
test-results
*-report.json
*.log
.env
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ docker run -it -p 8080:8080 -e DEBUG="helia-http-gateway*" helia-http-gateway:

## Run without Docker

\### Build
### Build

```sh
$ npm run build
Expand Down Expand Up @@ -91,15 +91,20 @@ $ npm start
| `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` |

<!--
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)
| `FILE_DATASTORE_PATH` | Path to use with a datastore-level passed to Helia as the datastore | `null`; memory datastore is used by default. |
| `FILE_BLOCKSTORE_PATH` | Path to use with a blockstore-fs passed to Helia as the blockstore | `null`; memory blockstore is used by default. |
-->

S3 datastore and blockstore are supported.
\| `S3_BUCKET` | Bucket name to use for S3 datastore and blockstore | `null` |
\| `S3_ENDPOINT` | S3 endpoint to use for S3 datastore and blockstore if using AWS compatible storage | `null` |
\| `S3_ACCESS_KEY_ID` | S3 access key id to use for S3 datastore and blockstore | `null` |
\| `S3_SECRET_ACCESS_KEY` | S3 secret access key to use for S3 datastore and blockstore | `null` |
\| `AWS_REGION` | AWS region to use for S3 datastore and blockstore if using AWS | `us-east-1` |

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

You can also see some recommended environment variable configurations at:
Expand Down Expand Up @@ -179,12 +184,6 @@ $ npm run test:e2e-flame # Run the dev server with clinicjs flame, execute e2e t
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](./config/README.md#metrics) for more information on how to view the generated metrics.

# Install

```console
Expand Down
Loading
Loading