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

Update readme #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,50 @@ go get github.com/ipfs/go-ds-leveldb-sia

![Architecture](docs/architecture.png?raw=true "Title")

## Usage

You can run the Sia backed IPFS node by either downloading the customised go-IPFS implementation from [here](https://github.com/IPFSR/kubo) or
you can use this plugin with a vanilla Kubo by replacing the `github.com/ipfs/go-ds-leveldb` with `github.com/IPFSR/go-ds-leveldb-sia` in file
`plugin/plugins/levelds/levelds.go`

Please make sure to setup your renterd() first. Once it is running, export the following variables to a terminal and initiate a new IPFS node.

| Env Var | Default | Description |
|---------------------------|----------|--------------------------------------------------------------------------|
| `IPFS_SIA_RENTERD_PASSWORD` | | Renterd Password |
|`IPFS_SIA_RENTERD_WORKER_ADDRESS`| | Renterd worker API address (ex: http://127.0.0.1:9980) |
|`IPFS_SIA_RENTERD_BUCKET`| IPFS | A private bucket with this name will be created and used |
|`IPFS_SIA_SYNC_DELETE`| False(0) | If set to True(1), the DELETE operation will be synced to Renterd bucket |


### Instructions
* Set up a renterd node and note down the password and API address.
* Open a new terminal and clone the [IPFSR Kubo (go-IPFS)](https://github.com/IPFSR/kubo)
```shell
git clone https://github.com/IPFSR/kubo
```
* Enter the directory and build the binary
```shell
cd kubo
make build
```
* Export the `IPFS_SIA_RENTERD_PASSWORD` and `IPFS_SIA_RENTERD_WORKER_ADDRESS` environment variables.
* Initiate a new IPFS node
```shell
cmd/ipfs/ipfs init
```
* Verify that a new bucket named "IPFS" was created the Renterd and it contains a directory names "leveldb" with 5 files.
* Your IPFS node is now connected to the Renterd node for backing up levelDB metadata.

### Testing
1. Setup a new IPFS node with this library and backing `renterd` node by following the above instructions
2. Install a levelDB CLI tool like `go install github.com/cions/leveldb-cli/cmd/leveldb@latest`
3. Access the levelDB and list out all the key:value pairs
4. Delete all the key:value pairs using the leveldb CLI
5. Run `ipfs files ls /`.
6. Access the levelDB and list out all the key:value pairs. You should see all the key:values restore back to the DB.
7. Please note that `IPFS_SIA_SYNC_DELETE` only works for the DELETE operations carried out by IPFS process and not an external tool. Thus even if DELETE operations are being synced, any externally deleted key using CLI will be restored.

## Contribute

PRs accepted.
Expand All @@ -35,4 +79,4 @@ Small note: If editing the README, please conform to the [standard-readme](https

## License

MIT
MIT