This is an automated email from the ASF dual-hosted git repository.
smihaylov pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git
The following commit(s) were added to refs/heads/develop by this push:
new 312b715 Readme (#29)
312b715 is described below
commit 312b7153112634d7db3988ac5dffdb0b127f95f3
Author: John McCane-Whitney <[email protected]>
AuthorDate: Thu Sep 5 07:35:09 2019 +0100
Readme (#29)
* README install instructions updated
* MacOS guide updated
* Modify the build script output binary to be milagro
* Pass the API URL as command line param of e2e_test.sh
* Update the build instructions
---
README.md | 62 ++++++++++++++++++++++++++-----------------
build.sh | 4 +--
cmd/servicetester/e2e_test.sh | 24 +++++++++--------
3 files changed, 53 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index b9f07cd..03d34d2 100644
--- a/README.md
+++ b/README.md
@@ -31,8 +31,17 @@ Milagro D-TA provides a basic set of services for creating
identities for actors
2. **SafeGuardSecret** Encrypts a string and decrypts it again
## Installation
-To see Milagro D-TA in action you can run Milagro D-TA in a docker container
+Below are instructions on how to build and run the Milagro D-TA either using
Docker, or static or dynamic builds for Linux.
+These instructions will build the service with default settings including an
embeded IPFS node connected to a Public IPFS network. This will get you up and
running quickly but will turn your D-TA into a public IPFS relay. **Not
recommended for production use!**
+
+### Docker
+To see Milagro D-TA in action you can run Milagro D-TA in a docker container.
This is currently the preferred method to build and run the D-TA. Tested on
Ubuntu 19.04 and MacOS but should run in any Docker environment.
+
+#### Prerequisites
+[Docker](https://www.docker.com/)
+
+#### Build & Run on Docker
```
git clone https://github.com/apache/incubator-milagro-dta.git
@@ -43,13 +52,12 @@ docker build -t mydta .
docker run -p5556:5556 mydta
```
-## Dependencies
-
-To correctly build the software on Ubuntu 18.04 you need to install the
following packages;
+### Build and run on development machine
+#### Install development Tools on Ubuntu/Debian
```
sudo apt-get update
-sudo apt-get install -y --no-install-recommends \
+sudo apt-get install \
ca-certificates \
cmake \
g++ \
@@ -61,10 +69,22 @@ sudo apt-get install -y --no-install-recommends \
libssl-dev \
jq \
curl
-sudo apt-get clean
```
-### liboqs
+#### Install development Tools on MacOS
+```
+brew install \
+ cmake \
+ autoconf \
+ automake \
+ libtool
+```
+
+#### golang
+
+Download and install [Golang](https://golang.org/dl/)
+
+#### liboqs
[liboqs](https://github.com/open-quantum-safe/liboqs) is a C library for
quantum-resistant cryptographic algorithms. It is a API level on top of the
@@ -81,7 +101,7 @@ make -j
sudo make install
```
-### AMCL
+#### AMCL
[AMCL](https://github.com/apache/incubator-milagro-crypto-c) is required
@@ -98,46 +118,40 @@ make test
sudo make install
```
-### Install pqnist
+#### pqnist
```
+git clone https://github.com/apache/incubator-milagro-dta.git
cd incubator-milagro-dta/libs/crypto/libpqnist
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=ON ..
make
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
make test
sudo make install
```
-### golang
-
-Download and install [Golang](https://golang.org/dl/)
-
-
-## Run service
-
-Set the library paths
+#### Set the library path
```
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/lib
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
```
-## Run Service
-
-This script will build the service with default settings including an embeded
IPFS node connected to a Public IPFS network. This will get you up and running
quickly but will turn your D-TA into a public IPFS relay. **Not recommended for
production use!**
-
+#### Build & Run Instructions
```
./build.sh
```
-To run the service with default settings
+To run the service with default settings:
```
-./target/service
+./target/milagro init
+./target/milagro daemon
```
+
## Documentation
You can find documentation for Milagro D-TA in the main [Milagro docs
site](https://milagro.apache.org/)
diff --git a/build.sh b/build.sh
index 4b2a513..cf4e7a3 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,5 @@
set -e
-GO111MODULE=on go build -o target/service
github.com/apache/incubator-milagro-dta/cmd/service
+GO111MODULE=on go build -o target/milagro
github.com/apache/incubator-milagro-dta/cmd/service
-target/service $@
+target/milagro $@
diff --git a/cmd/servicetester/e2e_test.sh b/cmd/servicetester/e2e_test.sh
index c5c2608..8ed21f3 100755
--- a/cmd/servicetester/e2e_test.sh
+++ b/cmd/servicetester/e2e_test.sh
@@ -2,11 +2,13 @@
#End to End Test of Services using curl/bash
apiVersion="v1"
+defaultURL="http://localhost:5556"
+apiURL="${1:-$defaultURL}"
status () {
#Determine if an extension is running
- statusOutput=$(curl -s -X GET "http://localhost:5556/$apiVersion/status" -H
"accept: */*" -H "Content-Type: application/json")
+ statusOutput=$(curl -s -X GET "$apiURL/$apiVersion/status" -H "accept: */*"
-H "Content-Type: application/json")
identity=$(echo $statusOutput | jq .nodeCID)
extensionVendor=$(echo $statusOutput | jq -r .extensionVendor)
plugin=$(echo $statusOutput | jq -r .plugin)
@@ -23,12 +25,12 @@ status () {
execute_bitcoin () {
# #Run 4 Tests against the Bitcoin Extension
echo "Bitcoin Plugin Tests [4 Tests]"
- output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H
"accept: */*" -H "Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}")
+ output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H
"Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}")
#echo $output1
op1=$(echo $output1 | jq .orderReference)
commitment1=$(echo $output1 | jq .commitment)
address1=$(echo $output1 | jq .extension.address)
- output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"
-H "accept: */*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
+ output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept:
*/*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
address2=$(echo $output2 | jq .extension.address)
commitment2=$(echo $output2 | jq .commitment)
@@ -47,12 +49,12 @@ execute_bitcoin () {
exit 1
fi
- output3=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H
"accept: */*" -H "Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"coin\":\"0\"}}")
+ output3=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H
"Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"coin\":\"0\"}}")
op3=$(echo $output3 | jq .orderReference)
commitment3=$(echo $output3 | jq .commitment)
address3=$(echo $output3 | jq .extension.address)
- output4=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"
-H "accept: */*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op3}")
+ output4=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept:
*/*" -H "Content-Type: application/json" -d "{\"orderReference\":$op3}")
commitment4=$(echo $output4 | jq .commitment)
address4=$(echo $output4 | jq .extension.address)
orderReference=$(echo $output4 | jq .orderReference)
@@ -142,14 +144,14 @@ execute_safeguardsecret () {
inputString="This is some random test text 1234567890!"
echo "Encrypt a String [1 Test]"
echo $output1
- output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H
"accept: */*" -H "Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"plainText\":\"$inputString\"}}")
+ output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H
"Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"plainText\":\"$inputString\"}}")
echo $output1
op1=$(echo $output1 | jq .orderReference)
cipherText=$(echo $output1 | jq .extension.cypherText)
tvalue=$(echo $output1 | jq .extension.t)
vvalue=$(echo $output1 | jq .extension.v)
commitment1=$(echo $output1 | jq .commitment)
- output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"
-H "accept: */*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"cypherText\":$cipherText,\"t\":$tvalue,\"v\":$vvalue}}")
+ output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept:
*/*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"cypherText\":$cipherText,\"t\":$tvalue,\"v\":$vvalue}}")
result=$(echo $output2 | jq -r .extension.plainText)
orderReference=$(echo $output2 | jq .orderReference)
@@ -169,13 +171,13 @@ execute_safeguardsecret () {
execute_milagro () {
echo "Milagro Tests [1 Test]"
- output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H
"accept: */*" -H "Content-Type: application/json" -d
"{\"beneficiaryIDDocumentCID\":$identity}")
+ output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H
"Content-Type: application/json" -d "{\"beneficiaryIDDocumentCID\":$identity}")
echo $output1
op1=$(echo $output1 | jq .orderReference)
commitment1=$(echo $output1 | jq .commitment)
- output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"
-H "accept: */*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
+ output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept:
*/*" -H "Content-Type: application/json" -d
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
commitment2=$(echo $output2 | jq .commitment)
orderReference=$(echo $output2 | jq .orderReference)
@@ -208,9 +210,9 @@ execute_milagro () {
execute_orderlist () {
echo "Milagro Tests [1 Test]"
commitment2=$(echo $output2 | jq .commitment)
- outputList=$(curl -s -X GET
"http://localhost:5556/$apiVersion/order?page=0&perPage=2&sortBy=dateCreatedDsc"
-H "accept: */*")
+ outputList=$(curl -s -X GET
"$apiURL/$apiVersion/order?page=0&perPage=2&sortBy=dateCreatedDsc" -H "accept:
*/*")
orderReference=$(echo $outputList | jq -r ".orderReference | .[$orderIndex]")
- outputOrder=$(curl -s -X GET
"http://localhost:5556/$apiVersion/order/$orderReference" -H "accept: */*")
+ outputOrder=$(curl -s -X GET "$apiURL/$apiVersion/order/$orderReference" -H
"accept: */*")
#A simple smoke test to ensure some sort of order is returned
hasSecret=`echo $outputOrder | grep "Secret"`