application-research / barge

Barge - CLI tool to stream/upload files/cars/dirs to Estuary
Other
5 stars 2 forks source link

Estuary Barge

Barge is a CLI tool that directly uses estuary api to stream/upload files to the filecoin network.

image

This project is based on the a sub module on Estuary under /cmd/barge.

Installation

Pre-requisites

Clone this repo and run the following

make all

This will generate a barge binary on the root folder that you can test.

Usage

Grab your API key from Estuary and run the following:

./barge login <API KEY>

Initialize

Initialize barge with the following command. This will create a configuration file which holds the estuary connection information.

./barge init 

Local configuration file

{
  "estuary": {
    "host": "http://localhost:3004",
    "primaryshuttle": "http://localhost:3005",
    "token": "<local API token>"
  }
}

Remote Estuary configuration

{
  "estuary": {
    "host": "https://api.estuary.tech",
    "primaryshuttle": "https://upload.estuary.tech",
    "token": "<Estuary API token>"
  }
}

Usage

Upload a file

./barge plumb put-file <file path>

Upload a CAR file

./barge plumb put-car <CAR file path>

WebUI

Run Web

./barge web

http://localhost:3000

REST API Endpoints

Run Web and use the following endpoints to interact with the barge.

./barge web

Upload file

curl --location --request POST 'http://localhost:3000/api/v0/plumb/file' \
--form 'file=@"website.png"'

Upload CAR

curl --location --request POST 'http://localhost:3000/api/v0/plumb/car' \
--form 'file=@"file.car"'