Skip to content

Commit 58c149e

Browse files
author
Gregory Hill
committed
ipfs integration test
Signed-off-by: Gregory Hill <[email protected]>
1 parent c793c2a commit 58c149e

File tree

3 files changed

+70
-19
lines changed

3 files changed

+70
-19
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,34 @@
22

33
Hoard is a stateless, deterministically encrypted, content-addressed object store.
44

5-
It is stateless in the sense of relying on storage backends for the actual persistence of objects. Currently supported backends are:
5+
![hoarding marmot](docs/images/hoard.jpg)
6+
7+
## Introduction
8+
9+
It convergently encrypts an object using its (SHA256) hash as the secret key (which can than be shared as a 'grant').
10+
The address is then deterministically generated from the encrypted object's (SHA256) digest and allocated to the configured storage backend:
611

12+
### Supported
713
- Memory
814
- Filesystem
9-
- [S3](https://aws.amazon.com/s3/)
10-
- [GCS](https://cloud.google.com/storage/)
15+
- [AWS](https://aws.amazon.com/s3/)
16+
- [GCP](https://cloud.google.com/storage/)
17+
- [Azure](https://azure.microsoft.com/en-gb/services/storage/)
1118
- [IPFS](https://ipfs.io/)
1219

13-
14-
Planned storage backends are:
15-
20+
### Planned
1621
- [BigchainDB](https://www.bigchaindb.com/) (and IPDB)
1722
- [Tendermint](https://tendermint.com/)
1823

19-
It encrypts deterministically (convergently) because it encrypts an object using the object's hash (SHA256) as the secret key (which can than be shared as a 'grant').
20-
21-
It is content-addressed because encrypted objects are stored at an address determined by the encrypted object's hash (SHA256 again).
22-
23-
![hoarding marmot](docs/images/hoard.jpg)
24-
2524
## Installing
2625

2726
Hoard should be go-gettable with:
2827

2928
```shell
30-
# Install the Hoar-Daemon hoard:
29+
# Install Hoard-Daemon:
3130
go get github.com/monax/hoard/cmd/hoard
3231

33-
# Install the Hoar-Control hoarctl:
32+
# Install Hoard-Control:
3433
go get github.com/monax/hoard/cmd/hoarctl
3534
```
3635
## Usage
@@ -45,7 +44,7 @@ hoard
4544
hoard --logging
4645
```
4746

48-
With no config file by default `hoard` will run a memory storage backend from which all objects will be lost when `hoard` is terminated. You can initialise a Hoard config by running one of:
47+
You can initialise a Hoard config by running one of:
4948

5049
```shell
5150
# Initialise Hoard with memory backend
@@ -55,10 +54,13 @@ hoard config --init mem
5554
hoard config --init fs
5655

5756
# Initialise Hoard with S3 backend
58-
hoard config --init s3
57+
hoard config --init aws
58+
59+
# Initialise Hoard with Azure backend
60+
hoard config --init azure
5961

6062
# Initialise Hoard with GCS backend
61-
hoard config --init gcs
63+
hoard config --init gcp
6264

6365
# Initialise Hoard with IPFS backend
6466
hoard config --init ipfs

integration/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ services:
88
- AWS_SECRET_ACCESS_KEY
99
- GCLOUD_SERVICE_KEY
1010
- HOARD_JSON_CONFIG
11+
network_mode: host
1112
ports:
1213
- "53431:53431"
1314
hoarctl:
1415
build: ..
15-
links:
16+
network_mode: host
17+
depends_on:
1618
- hoard
1719
# note: '$$' escapes '$'
18-
command: sh -c '[ $$(echo "marmottes" | hoarctl -a tcp://hoard:53431 put | hoarctl -a tcp://hoard:53431 get) = "marmottes" ]'
20+
command: sh -c '[ $$(echo "marmottes" | hoarctl -a tcp://localhost:53431 put | hoarctl -a tcp://localhost:53431 get) = "marmottes" ]'

integration/test_ipfs.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
# Requires:
4+
# - Docker compose
5+
# - jq
6+
7+
if [[ "$(which ipfs)" == "" ]]
8+
then
9+
echo "Integration test requires IPFS"
10+
exit 1
11+
fi
12+
13+
# Integration test dir
14+
cd "$(dirname "$0")"
15+
16+
read -d '' HOARD_JSON_CONFIG << CONFIG
17+
{
18+
"ListenAddress": "tcp://:53431",
19+
"Storage": {
20+
"StorageType": "ipfs",
21+
"AddressEncoding": "base64",
22+
"Protocol": "http://",
23+
"Address": "localhost",
24+
"Port": "5001"
25+
},
26+
"Logging": {
27+
"LoggingType": "json",
28+
"Channels": [
29+
"info",
30+
"trace"
31+
]
32+
},
33+
"Secrets": null
34+
}
35+
CONFIG
36+
37+
export HOARD_JSON_CONFIG
38+
echo "Running integration test with config:"
39+
echo ${HOARD_JSON_CONFIG} | jq '.'
40+
41+
# Build unless asked not to
42+
echo "Bringing up integration test containers with docker-compose..."
43+
docker run -d --name=ipfs --network=host ipfs/go-ipfs:latest
44+
# Make sure IPFS is configured
45+
sleep 5
46+
[ -z "$NOBUILD" ] && docker-compose build
47+
docker-compose up --build --exit-code-from hoarctl --abort-on-container-exit

0 commit comments

Comments
 (0)