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.
The repo contains the infra deployment code and the api implementation.
To work on this codebase you need:
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
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
You can use sst
to create a custom dev deployment on aws, with a local dev console for debugging.
To do that you need
.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.
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
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
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=
Dual-licensed under MIT + Apache 2.0