Skip to content

Commit c358d5a

Browse files
authored
Merge pull request #55 from swcurran/main
Update ./manage to handle newer docker compose invocation, documentation, update version
2 parents 49ba604 + f44b9f0 commit c358d5a

File tree

3 files changed

+80
-23
lines changed

3 files changed

+80
-23
lines changed

README.md

+57-11
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ too large, the holders will have challenges in downloading and processing the
4242
tails file.
4343

4444
| Revocation Registry Size | Tail File Size | Proof Generation Time |
45-
| :---: | :---: | :---: |
46-
| 3000 | 768KB | ~4sec |
47-
| 10000 | 2.6MB | ~5sec |
48-
| 32768 | 8.4MB | ~7sec |
45+
| :----------------------: | :------------: | :-------------------: |
46+
| 3000 | 768KB | ~4sec |
47+
| 10000 | 2.6MB | ~5sec |
48+
| 32768 | 8.4MB | ~7sec |
4949

5050
- Tests of Proof Generation used the Lissi-Wallet on a iPhone 12Pro
5151
- 32768 is the Revocation Registry max-size-value set in Aries Cloud Agent Python.
5252

53+
Recent performance improvements in Tails File handling both in I/O and cryptographic
54+
processing may have resulted in decreases in proof generation times.
55+
5356
## Running in Docker (easy mode)
5457

5558
[Install Docker](https://docs.docker.com/get-docker/).
@@ -79,15 +82,38 @@ This server has two functions:
7982
- Uploading a tails file
8083
- Downloading a tails file
8184

82-
### Uploading
85+
For each of those operations, there are two endpoints, one based on the
86+
Revocation Registry ID, and the other based on the hash of the tails file to be
87+
load/retrieved.
8388

84-
To upload a tails file, make a `PUT` request to `/{revoc_reg_id}` as a multipart file upload with 2 fields. The **first** field _must_ be named `genesis` and the **second** field _must_ be named `tails`. `genesis` should be the genesis transactions file and `tails` should be the tails file. The server supports chunked encoding for streaming very large tails files.
89+
### Uploading
8590

86-
The server will lookup the relevant revocation registry definition and check the integrity of the file against `fileHash` on the ledger. If it's good, it will store the file. Otherwise it will respond with response code `400`. If `revoc_reg_id` does not exist on the ledger, the server will respond with response code `404`. If the file already exists on the server, it will respond with response code `409`.
91+
To upload a tails file using the Revocation Registry ID, make a `PUT` request to
92+
`/{revoc_reg_id}` as a multipart file upload with 2 fields. The **first** field
93+
_must_ be named `genesis` and the **second** field _must_ be named `tails`.
94+
`genesis` should be the genesis transactions file and `tails` should be the
95+
tails file. The server supports chunked encoding for streaming very large tails
96+
files. The server will lookup the relevant revocation registry definition and
97+
check the integrity of the file against `fileHash` on the ledger. If it's good,
98+
it will store the file. Otherwise it will respond with response code `400`. If
99+
`revoc_reg_id` does not exist on the ledger, the server will respond with
100+
response code `404`. If the file already exists on the server, it will respond
101+
with response code `409`.
102+
103+
To upload a tails file using the hash endpoint, use the `PUT /hash/{tails-hash}`
104+
endpoint to upload the file, validate the hash against the uploaded file, and
105+
ensure the tails file "looks" like a tails file by carrying out several checks
106+
of the contents.
87107

88108
### Downloading
89109

90-
A simple `GET` request will download a tails file. The path is `/{revoc_reg_id}` where `revoc_reg_id` is a valid id. If it doesn't exist, the server will respond with response code `404`.
110+
For downloading a file using the Revocation Registry ID, execute a `GET` request
111+
with the path `/{revoc_reg_id}` where `revoc_reg_id` is a valid id. If it
112+
doesn't exist, the server will respond with response code `404`.
113+
114+
For downloading a file using the tails file hash, execute a `GET
115+
/hash/{tails-hash}`. If a file with that hash doesn't exist, the server will
116+
respond with response code `404`.
91117

92118
## Guarantees
93119

@@ -96,20 +122,40 @@ This software is designed to support scaling to as many machines or processes as
96122
## Tests
97123

98124
There is a suite of integration tests that test some assumptions about the environment like the type of mounted file system and the ledger that is being connected to. For running these tests a local von-network needs to be running, you can spin one up by
125+
99126
```
100127
git clone https://github.com/bcgov/von-network
101128
cd von-network
102129
./manage build
103130
./manage start
104131
```
132+
105133
After the von-network is up, goto the tails-server docker directory, run the manage script as follows.
134+
106135
```
107136
cd indy-tails-server/docker
108137
./manage test
109138
```
110-
This will perform a series of tests creating revocation registries with a local tails-server.
139+
140+
This will perform a series of tests creating revocation registries with a local tails-server. Some notes:
141+
142+
- The tests can only be run once per run of VON Network (error `UnauthorizedClientRequest`). To rerun, bring down von-network (`./manage down; ./manage start` in the von-network repository clone) and rerun the tests.
143+
- Wait a bit after starting von-network (15-20 seconds) before running the indy-tails-server tests, as you will get an error (`Server disconnected...`) if you start too quickly. If you get that error, try again and it should work.
144+
145+
If you want to run a local copy for testing with other deployments, here are some things you can try:
146+
147+
- After starting your docker Tails File instance, run the [ACA-Py Alice-Faber
148+
Demo with Revocation](https://aca-py.org/main/demo/#revocation).
149+
- After starting your docker Tails File instance, run the [Aries Agent Test
150+
Harness](https://github.com/hyperledger/aries-agent-test-harness) (AATH). For
151+
example, after cloning the AATH repo, run the command `./manage runset acapy -b`
152+
to build and run the standard set of tests with ACA-Py. AATH detects that a
153+
tails file is already running locally, and so will use that instance.
111154

112155
## Additional Notes
113156

114-
Due to how revocation works in Indy, there is the expectation/requirement that the tails server public URL will be stable over time.
115-
Failing to satisfy this requirement will cause failures when issuing and/or verifying credentials for which the credential definition was created/registered on an "old" tails server url.
157+
Due to how revocation works in Hyperledger Indy, there is the expectation/requirement that
158+
the tails server public URL will be stable over time. Failing to satisfy this
159+
requirement will cause failures when issuing and/or verifying credentials for
160+
which the credential definition was created/registered on an "old" tails server
161+
url.

docker/manage

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/bin/bash
2+
3+
# ========================================================================================================
4+
# Check Docker Compose
5+
# --------------------------------------------------------------------------------------------------------
6+
7+
# Default to deprecated V1 'docker-compose'.
8+
dockerCompose="docker-compose --log-level ERROR"
9+
10+
# Prefer 'docker compose' V2 if available
11+
if [[ $(docker compose version 2> /dev/null) == 'Docker Compose'* ]]; then
12+
dockerCompose="docker --log-level error compose"
13+
fi
214
export MSYS_NO_PATHCONV=1
315
# getDockerHost; for details refer to https://github.com/bcgov/DITP-DevOps/tree/main/code/snippets#getdockerhost
416
. /dev/stdin <<<"$(cat <(curl -s --raw https://raw.githubusercontent.com/bcgov/DITP-DevOps/main/code/snippets/getDockerHost))"
@@ -46,7 +58,7 @@ exportEnvironment() {
4658
export GENESIS_URL=${GENESIS_URL:-http://$DOCKERHOST:9000/genesis}
4759
export STORAGE_PATH=${STORAGE_PATH:-/tmp/tails-files}
4860
export LOG_LEVEL=${LOG_LEVEL:-INFO}
49-
export TAILS_SERVER_URL=${TAILS_SERVER_URL:-http://host.docker.internal:6543}
61+
export TAILS_SERVER_URL=${TAILS_SERVER_URL:-http://$DOCKERHOST:6543}
5062
}
5163

5264
function logs() {
@@ -69,8 +81,7 @@ function logs() {
6981
log_args=()
7082
(( no_tail != 1 )) && log_args+=( '-f' )
7183
if [ ! -z "${TAIL_LOGS}" ] || [ ! -z "${_force}" ]; then
72-
docker-compose \
73-
--log-level ERROR logs \
84+
${dockerCompose} logs \
7485
"${log_args[@]}" "$@"
7586
fi
7687
)
@@ -84,28 +95,28 @@ shift || COMMAND=usage
8495

8596
case "${COMMAND}" in
8697
build)
87-
docker-compose build $@
98+
${dockerCompose} build $@
8899
;;
89100
start|up)
90101
exportEnvironment "$@"
91-
docker-compose up -d ngrok-tails-server tails-server
102+
${dockerCompose} up -d ngrok-tails-server tails-server
92103
logs
93104
echo "Run './manage logs' for logs"
94105
;;
95106
test)
96107
exportEnvironment "$@"
97-
docker-compose up -d ngrok-tails-server tails-server
98-
docker-compose run tester --genesis-url $GENESIS_URL --tails-server-url $TAILS_SERVER_URL
99-
# docker-compose down
108+
${dockerCompose} up -d ngrok-tails-server tails-server
109+
${dockerCompose} run tester --genesis-url $GENESIS_URL --tails-server-url $TAILS_SERVER_URL
110+
# ${dockerCompose} down
100111
;;
101112
logs)
102-
docker-compose logs -f
113+
${dockerCompose} logs -f
103114
;;
104115
stop)
105-
docker-compose stop
116+
${dockerCompose} stop
106117
;;
107118
down|rm)
108-
docker-compose down
119+
${dockerCompose} down
109120
;;
110121
*)
111122
usage

tails_server/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library version information."""
22

3-
__version__ = "0.0.0"
3+
__version__ = "1.1.0"

0 commit comments

Comments
 (0)