Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

web3-storage/dealer

Folders and files

NameName
Last commit message
Last commit date
Jul 11, 2023
Sep 18, 2023
Sep 18, 2023
Sep 13, 2023
Sep 18, 2023
Sep 7, 2023
Jul 11, 2023
May 17, 2023
Sep 7, 2023
Sep 13, 2023
Sep 13, 2023
May 17, 2023
Jul 11, 2023
Sep 7, 2023
Jul 11, 2023

Repository files navigation

dealer

Implementation of w3filecoin dealer service which will provide the UCAN server for receiving dealer/* invocations and other resources for Spade to scrape - a way to retrieve the list of aggregates ready for a deal.

Getting Started

The repo contains the infra deployment code and the api implementation.

To work on this codebase you need:

  • Node.js >= 18 (prod env is node 18)
  • Install the deps with pnpm i

You can then run the tests locally with pnpm test.

To try out a change submit a PR and you'll get temporary infra rolled out for you automatically at https://<pr#>.spade-proxy.web3.storage.

sst is the framework we use to define what to deploy. Read the docs! https://sst.dev

Deployment

Deployments are managed by [seed.run].

The main branch is deployed to https://staging.spade-proxy.web3.storage and staging builds are promoted to prod manually via the UI at https://console.seed.run

Local dev

You can use sst to create a custom dev deployment on aws, with a local dev console for debugging.

To do that you need

  • An AWS account with the AWS CLI configured locally
  • Copy .env.tpl to .env.local

Then run npm start to deploy dev services to your aws account and start dev console

pnpm run start

See: https://docs.sst.dev for more info on how things get deployed.

Package Tests

To run per-package tests, first install Docker Desktop (https://www.docker.com/) and ensure it is running.

Next, ensure the AWS_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables are set in your terminal. They do not need to be set to real values - the following works in bash-like shells:

export AWS_REGION='us-west-2'; export AWS_ACCESS_KEY_ID='NOSUCH'; export AWS_SECRET_ACCESS_KEY='NOSUCH'

Finally, to run the tests for all packages, run:

pnpm test

Or to run the tests for a single package, run:

pnpm --filter <package-name> test

Environment Variables

Ensure the following variables are set in the env when deploying

HOSTED_ZONE

The root domain to deploy the API to. e.g dealer.web3.storage. The value should match a hosted zone configured in route53 that your aws account has access to.

DID

DID of the ucanto server. e.g. did:web:dealer.web3.storage. Optional: if omitted, a did:key will be derrived from PRIVATE_KEY

Secrets

Set production secrets in aws SSM via sst secrets. The region must be set to the one you deploy that stage to

# set `PRIVATE_KEY` for prod
$ npx sst secrets set --region us-west-2 --stage prod PRIVATE_KEY "MgCblCY...="

To set a fallback value for staging or an ephmeral PR build use sst secrets set-fallback

# set `PRIVATE_KEY` for any stage in us-east-2
$ npx sst secrets set --fallback --region us-east-2 PRIVATE_KEY "MgCZG7...="

note The fallback value can only be inherited by stages deployed in the same AWS account and region.

Confirm the secret value using sst secrets list

$ npx sst secrets list --region us-east-2
PRIVATE_KEY MgCZG7...= (fallback)

$ npx sst secrets list --region us-west-2 --stage prod
PRIVATE_KEY M...=

PRIVATE_KEY

The multibase encoded ED25519 keypair used as the signing key for the upload-api.

Generated by @ucanto/principal EdSigner via ucan-key

Example: MgCZG7EvaA...1pX9as=

UCAN_LOG_BASIC_AUTH

The HTTP Basic auth token for the UCAN Invocation entrypoint, where UCAN invocations can be stored and proxied to the UCAN Stream.

Example: MgCZG7EvaA...1pX9as=

License

Dual-licensed under MIT + Apache 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published