From f89bcb496b587bcdd7ab6c5f843f96f00af28d71 Mon Sep 17 00:00:00 2001 From: haad Date: Fri, 29 Nov 2024 07:29:50 +0100 Subject: [PATCH 1/4] Add node engine version to package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 5a7e9d3..d165ed0 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,9 @@ "bin": { "voyager": "./src/bin/cli.js" }, + "engines": { + "node": ">=20.0.0" + }, "repository": { "type": "git", "url": "https://github.com/orbitdb/voyager" From ebe27b70036db6d425ecc2faeeddb4780d46221e Mon Sep 17 00:00:00 2001 From: haad Date: Fri, 29 Nov 2024 07:30:36 +0100 Subject: [PATCH 2/4] Add badges to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 215ad14..cbe379b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Voyager +[![Matrix](https://img.shields.io/matrix/orbit-db%3Amatrix.org)](https://app.element.io/#/room/#orbit-db:matrix.org) [![npm (scoped)](https://img.shields.io/npm/v/%40orbitdb/voyager)](https://www.npmjs.com/package/@orbitdb/voyager) [![node-current (scoped)](https://img.shields.io/node/v/%40orbitdb/voyager)](https://www.npmjs.com/package/@orbitdb/voyager) + **Storage service** for [OrbitDB](https://github.com/orbitdb/orbitdb) peer-to-peer databases. Voyager replicates and stores OrbitDB databases and makes them available to others when the database's originating peer is offline. From 435d2808b894a1a48a32f74fbe4656ba3601b51c Mon Sep 17 00:00:00 2001 From: haad Date: Fri, 29 Nov 2024 08:00:07 +0100 Subject: [PATCH 3/4] Revise readme --- README.md | 58 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cbe379b..23ec781 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,50 @@ [![Matrix](https://img.shields.io/matrix/orbit-db%3Amatrix.org)](https://app.element.io/#/room/#orbit-db:matrix.org) [![npm (scoped)](https://img.shields.io/npm/v/%40orbitdb/voyager)](https://www.npmjs.com/package/@orbitdb/voyager) [![node-current (scoped)](https://img.shields.io/node/v/%40orbitdb/voyager)](https://www.npmjs.com/package/@orbitdb/voyager) -**Storage service** for [OrbitDB](https://github.com/orbitdb/orbitdb) peer-to-peer databases. +A **storage service** for [OrbitDB](https://github.com/orbitdb/orbitdb) peer-to-peer databases. Voyager replicates and stores OrbitDB databases and makes them available to others when the database's originating peer is offline. -It is designed to run on systems with guaranteed uptime and public availability and can be seen as a "data availability node" for OrbitDB. For example, a browser-based app running a OrbitDB database may rely on one or more Voyager peers to ensure the database is available when the browser peer goes offline. - -Voyager, like OrbitDB, is peer-to-peer and does not have a traditional server/client architecture and so terms "server" and "client" do not apply. Therefore, in keeping with OrbitDB's "celestial" naming convention, the storage service peer is called ***"Orbiter"*** and the interface which the developer or user uses to communicate with the storage service peer is called ***"Lander"***. +It is designed to run on systems with guaranteed uptime and public availability and can be seen as a "data availability node" for OrbitDB. For example, a browser-based app running a OrbitDB database may rely on one or more Voyager peers to ensure the database is available when the browser peer is unreachable. ***Note!*** *This software is currently in alpha version status and thus may change, break backwards compatibility or contain major issues. It has not been security audited. Use it accordingly.* ## Installation +To use Voyager as a module: + ```sh npm i @orbitdb/voyager ``` -### Running "Orbiter" - -Voyager's Orbiter (the storage service) can be run as a daemon process. You can install the package globally and run it using the "voyager" binary: +To use Voyager from the CLI: ```sh npm i -g @orbitdb/voyager +``` + +## Usage + +Voyager, like OrbitDB, is peer-to-peer and does not have a traditional server/client architecture and so terms "server" and "client" do not apply. Therefore, in keeping with OrbitDB's "celestial" naming convention, the storage service peer is called ***"Orbiter"*** and the interface which the developer or user uses to communicate with the storage service peer is called ***"Lander"***. + +### CLI + +The `voyager` CLI tool can be used to manage a Voyager instance. Run `voyager` on the command line to get started. + +Currently the following commands are available: + +``` +voyager daemon Launch Voyager +voyager id Show the voyager's id +voyager address Show the voyager's network addresses +voyager auth Add or remove authorized user +``` + +### Orbiter Daemon + +Voyager's **Orbiter**, the storage service, can be run as a daemon process. You can install the package globally and run it using the `voyager` CLI binary: + +```sh voyager daemon ``` @@ -50,7 +72,7 @@ docker run --rm -d -p 8000:8000 orbitdb-voyager Adjust the port if required. -## Managing "Orbiter" access +## Managing Orbiter Access Orbiter will deny all requests by default. To allow a user to interact with Orbiter, the (requesting) user's `id` must be added to Orbiter's "allow" list. @@ -128,11 +150,11 @@ And to remove an authorization: await rpc.authDel() ``` -## Adding databases using "Lander" +## Adding databases using Lander -To make databases accessible from Voyager, the database needs to be added to an Orbiter storage service instance. This can be achieved programmatically by using the "Lander" module. +To make databases accessible from Voyager, the database needs to be added to an Orbiter storage service instance. This can be achieved programmatically by using the **Lander** module. -To use Lander, first install the [@orbitdb/voyager](todo: link) package: +To use Lander, first install the [@orbitdb/voyager](https://www.npmjs.com/package/@orbitdb/voyager) package: ```sh npm i @orbitdb/voyager @@ -144,15 +166,13 @@ Next, instantiate Lander: import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' import { createOrbitDB } from '@orbitdb/core' +import { Lander } from '@orbitdb/voyager' -// set up configuration for libp2p and helia +// set up libp2p, helia and orbitdb -const libp2p = await createLibp2p({ ...options }) +const libp2p = await createLibp2p() const ipfs = await createHelia({ libp2p }) - -directory = directory || './lander' - -const orbitdb = await createOrbitDB({ ipfs, directory }) +const orbitdb = await createOrbitDB({ ipfs }) // deployed orbiter peer id or listening address, it looks like this: // /ip4/127.0.0.1/tcp/54322/p2p/16Uiu2HAmATMovCwY46yyJib7bGZF2f2XLRar7d7R3NJCSJtuyQLt @@ -161,7 +181,7 @@ const orbiterAddressOrId = '...' const lander = await Lander({ orbitdb, orbiterAddressOrId }) ``` -To add a db to voyager: +To add a database to voyager: ```js // create a db to be added to voyager @@ -171,7 +191,7 @@ const db = await orbitdb.open('my-db') await lander.add(db.address) ``` -To remove a db from voyager: +To remove a database from voyager: ```js // open an instance of the db you want to remove from voyager From 68911c4958d9376cd5b69de5522add80dd7bbd20 Mon Sep 17 00:00:00 2001 From: haad Date: Fri, 29 Nov 2024 08:06:57 +0100 Subject: [PATCH 4/4] Update CI workflow configuration --- .github/workflows/npm-publish-next.yml | 2 +- .github/workflows/npm-publish.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/npm-publish-next.yml b/.github/workflows/npm-publish-next.yml index 6817f75..124ff59 100644 --- a/.github/workflows/npm-publish-next.yml +++ b/.github/workflows/npm-publish-next.yml @@ -20,7 +20,7 @@ jobs: - name: Run an Orbiter 1 instance in the background run: npm run start:orbiter1:background - name: Run an Orbiter 2 instance in the background - run: npm run start:orbiter2:background + run: npm run start:orbiter2:background - run: npm test - run: | npm version prerelease --no-git-tag-version \ diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 1dd50b2..decc8c0 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -10,8 +10,8 @@ jobs: publish-npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 'lts/*' registry-url: https://registry.npmjs.org/ @@ -19,7 +19,7 @@ jobs: - name: Run an Orbiter 1 instance in the background run: npm run start:orbiter1:background - name: Run an Orbiter 2 instance in the background - run: npm run start:orbiter2:background + run: npm run start:orbiter2:background - run: npm test - run: npm publish env: