Getting Started¶
Prerequisites¶
Docker with Compose, and a shell in the src directory.
1. Start the registry network¶
support/registries/deploy/scripts/up.sh
| Service | Local port |
|---|---|
registry-relay-0 to registry-relay-2 |
7820 to 7822 |
indexer-0 to indexer-2 |
7830 to 7832 |
watchdog |
7840 |
2. Start an origin¶
File bytes are stored by an origin. Start one on the registry network:
docker build -t storage-go:dev storage/go
export ORIGIN_TOKEN="$(openssl rand -hex 24)"
mkdir -p /tmp/registry-origin
docker run -d --rm --name registry-origin --network registries \
--user "$(id -u):$(id -g)" -v /tmp/registry-origin:/data \
-e ORIGIN_TOKEN storage-go:dev origin
export ORIGIN_URL=http://registry-origin:8080 ORIGIN_PUBLIC_URL=http://registry-origin:8080
3. Publish¶
Run ctl.sh in the directory that holds your files. It mounts that directory at /work.
C=/path/to/src/support/registries/deploy/scripts/ctl.sh
R="-relay ws://registry-relay-0:8080 -relay ws://registry-relay-1:8080 -relay ws://registry-relay-2:8080"
echo "hello" > hello.txt
$C whoami
$C publish -registry demo/files $R -ack 2 -file hello.txt
whoami creates registry.key on first use and prints your public key. publish writes the state file demo_files.registry.json.
4. Read¶
$C read -author <your public key> -registry demo/files $R
$C search -q hello $R
$C fetch -author <your public key> -registry demo/files -name hello.txt -out copy.txt $R
read lists the assets, the indexers that answered (sources) and whether relays had to be consulted (fallback). fetch verifies the SHA-256 digest and the Merkle root.
5. Update and withdraw¶
echo "hello again" > hello.txt
$C publish -registry demo/files $R -ack 2 -file hello.txt
$C remove -registry demo/files $R -ack 2 -name hello.txt
6. Look at the audit¶
curl -s http://127.0.0.1:7840/v1/reports
curl -s http://127.0.0.1:7840/v1/coverage
Reports appear after the grace period and one audit interval.
7. Stop¶
docker stop registry-origin
support/registries/deploy/scripts/down.sh