Skip to content

lovvtide/satellite-cdn

Repository files navigation

Satellite CDN

satellite-cdn is a blossom compatible gateway for Cloudflare R2 object storage. It accepts lightning payments from users, allowing them to prepay for data hosting. The overall goal of this project is to increase decentralization and competition among media hosts in the nostr ecosystem.

Live instance deployed at https://cdn.satellite.earth

Want to run your own Satellite CDN?

Once you've created an Cloudflare R2 bucket, clone this repo project on your server.

cd satellite-cdn

npm i

Before starting Satellite CDN, you'll need to configure it by adding a .env file that looks something like this:

DB_PATH=/path/to/db/directory
S3_BUCKET=dev
S3_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CF_ACCOUNT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
APP_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
STORAGE_RATE_USD=0.05
LIGHTNING_PROVIDER_PUBKEY=79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432
LIGHTNING_CALLBACK_URL=https://getalby.com/lnurlp/myapp/callback
CDN_ENDPOINT=http://localhost:5050
BLOB_ENDPOINT=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.r2.dev
LISTENER_RELAYS=wss://relay.damus.io,wss://nos.lol,wss://relay.snort.social,wss://relay.nostrplebs.com,wss://relay.plebstr.com,wss://relay.nostr.band,wss://nostr.wine
  • DB_PATH is the directory where the CDN's embedded SQLlite database lives
  • S3_BUCKET is the name of your R2 bucket
  • S3_ACCESS_KEY_ID is your access token id generated by Cloudflare
  • CF_ACCOUNT_ID is your public cloudflare account ID
  • APP_SECRET_KEY is your secret access token generated by Cloudflare
  • STORAGE_RATE_USD is the number of cents per gigabyte, per month, that customers will be charged to store data on the CDN
  • LIGHTNING_PROVIDER_PUBKEY is the pubkey of the lightning server your customer's will be sending payments to, and the CDN will be listening for
  • CDN_ENDPOINT is the base url endpoint of your CDN (e.g. https://cdn.satellite.earth)
  • BLOB_ENDPOINT is the base url endpoint of where the blobs are actually served from (e.g. https://blob.satellite.earth)
  • LISTENER_RELAYS are a set of relays to which your CDN will maintain a persistant connection, listening for customer payments

To start the CDN, run

npm start

If your using a reverse proxy such as Nginx, you made need to configure the request max body size to a higher value to prevent larger uploads from failing.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published