Skip to content
Snippets Groups Projects
Commit 48c39113 authored by Lyuben Penkovski's avatar Lyuben Penkovski
Browse files

Policy service definition

parent ddbcb278
Branches policy-service
No related tags found
1 merge request!5Policy service definition
......@@ -12,44 +12,74 @@ with environment variables which will be injected in its container.
* [Install Go](https://golang.org/doc/install) and set the
[`$GOPATH` variable](https://github.com/golang/go/wiki/SettingGOPATH).
## Setup Workspace
* create directory:
```
mkdir -p $GOPATH/src/code.vereign.com/gaiax/tsa/
```
* move in the previously created directory:
```
cd $GOPATH/src/code.vereign.com/gaiax/tsa/
```
* clone the repository:
```
git clone git@code.vereign.com:gaiax/tsa/workspace.git
```
* run the setup.sh script:
```
./setup.sh
```
* set the services you would like to use in the docker-compose.yml file, defaults is **infohub**
* run docker compose:
```
docker-compose up
```
## Setup
Clone the workspace repository into `$GOPATH/src/code.vereign.com/gaiax/tsa/workspace`. Using GOPATH is important
because it's the way the workspace will know where to find you Go source code.
```sh
# create the backend directory where the workspace will be checked out
mkdir -p $GOPATH/src/code.vereign.com/gaiax/tsa/workspace
# change to the created directory
cd $GOPATH/src/code.vereign.com/gaiax/tsa/workspace
# clone the workspace repo
git clone git@code.vereign.com:gaiax/tsa/workspace.git .
```
### Checkout services repos
This step is optional because you may already have the repos checked out
or you may want to do this step manually. But the workspace provides you
with a `setup.sh` script which will go and checkout the TSA backend
services at their correct locations, ready for use with `docker-compose`.
```shell
./setup.sh
```
> Note: If you have already checked out a repository, and it's not on the main branch or
> is not in a clean state, the script will give you a warning and won't override the
> state of your repo. You will have to checkout/update it manually.
### Usage
Now you're ready to start using the workspace environment.
```shell
# start all services
docker-compose up -d
# see the state of the containers and their exposed ports
docker-compose ps
# follow the logs of all services in the workspace
docker-compose logs -f
# follow the logs of specified services only
docker-compose logs -f gateway infohub
# restart a service
docker-compose restart gateway
# restart a service and reload its environment variables
docker-compose up -d gateway
# rebuild the docker image of a service
docker-compose build gateway
```
## 3rd Party Services
### DID Resolver service
#### DID Resolver
The DID Resolver service can be reached at `localhost:9090` from your
local machine.
The DID Resolver service can be reached at `localhost:9090` from your local machine.
Example usage:
```
curl -X GET http://localhost:9090/1.0/identifiers/did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE
curl -X GET http://localhost:9090/1.0/identifiers/did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6
curl -X GET http://localhost:9090/1.0/identifiers/did:schema:public-ipfs:json-schema:Qma2beXKwZeiUXcaRaQKwbBV1TqyiJnsMTYExUTdQue43J
curl -X GET http://localhost:9090/1.0/identifiers/did:web:did.actor:alice
curl -X GET http://localhost:9090/1.0/identifiers/did:sov:WRfXPg8dantKVubE3HX8pw
```
In order to support more DID methods refer to currently supported ones here:
```
......
version: '3.4'
services:
infohub:
container_name: infohub
policy:
container_name: policy
build:
context: $GOPATH/src/code.vereign.com/gaiax/tsa/infohub
context: $GOPATH/src/code.vereign.com/gaiax/tsa/policy
dockerfile: deployment/compose/Dockerfile
volumes:
- "$GOPATH/src/code.vereign.com/gaiax/tsa/infohub:/go/src/code.vereign.com/gaiax/tsa/infohub"
- "$GOPATH/src/code.vereign.com/gaiax/tsa/policy:/go/src/code.vereign.com/gaiax/tsa/policy"
env_file:
./env/infohub.env
- ./env/policy.env
ports:
- "8080:8080"
- "8081:8080"
redis:
image: "redis:alpine"
container_name: redis
ports:
- "6379:6379"
uni-resolver-web:
didresolver:
image: universalresolver/uni-resolver-web:latest
ports:
- "9090:8080"
uni-resolver-driver-did-uport:
image: uport/uni-resolver-driver-did-uport:2.3.0
ports:
- "9091:8081"
driver-did-sov:
image: universalresolver/driver-did-sov:latest
env_file:
./env/resolver.env
ports:
- "9092:8080"
driver-did-key:
didresolver-driver-did-key:
image: universalresolver/driver-did-key:latest
ports:
- "9093:8080"
schema-registry-did-resolver:
image: 51nodes/schema-registry-did-resolver:0.1.1
ports:
- "9094:8080"
- "9091:8080"
indy-did-driver:
image: ghcr.io/idunion/indy-did-resolver/indy-did-driver:latest
ports:
- "9095:8080"
\ No newline at end of file
- "9092:8080"
redis:
image: "redis:alpine"
container_name: redis
ports:
- "6379:6379"
HTTP_HOST=""
HTTP_PORT="8080"
HTTP_IDLE_TIMEOUT="60s"
HTTP_IDLE_TIMEOUT="120s"
HTTP_READ_TIMEOUT="10s"
HTTP_WRITE_TIMEOUT="10s"
HTTP_MAX_REQUEST_SIZE="1000000"
REDIS_HOST="redis"
\ No newline at end of file
REDIS_ADDR="redis:6379"
REDIS_USER=""
REDIS_PASS=""
REDIS_DB=1
REDIS_EXPIRATION="1h"
\ No newline at end of file
uniresolver_driver_did_sov_libIndyPath=
uniresolver_driver_did_sov_poolConfigs=_;./sovrin/_.txn;staging;./sovrin/staging.txn;builder;./sovrin/builder.txn;danube;./sovrin/danube.txn;idu;./sovrin/idu.txn;eesdi;./sovrin/eesdi.txn;indicio;./sovrin/indicio.txn;indicio:test;./sovrin/indicio-test.txn;indicio:demo;./sovrin/indicio-demo.txn;bbu;./sovrin/bbu.txn
uniresolver_driver_did_sov_poolVersions=_;2;staging;2;builder;2;danube;2;idu;2;eesdi;2;indicio;2;indicio:test;2;indicio:demo;2;bbu;2
uniresolver_driver_did_sov_walletName=default
......@@ -11,7 +11,7 @@
# export email="lyuben.penkovski@vereign.com"
# ------------
# pull the master branch of a given git repository.
# pull the main branch of a given git repository.
# User will be prompted for manual action if another branch is checked out or a problem occurs.
# $1 - name of the repo to pull.
function pull() {
......@@ -20,9 +20,9 @@ function pull() {
pushd "${repo}"
local branch=`git rev-parse --abbrev-ref HEAD`
if [ $branch == "master" ]; then
echo "Pulling ${repo}/master..."
git pull origin master || read -p "Could not pull ${repo}/master. Fix the issue and press ENTER to continue:"
if [ $branch == "main" ]; then
echo "Pulling ${repo}/main..."
git pull origin main || read -p "Could not pull ${repo}/main. Fix the issue and press ENTER to continue:"
else
echo "${repo}/${branch} is checked out"
read -p "Pull ${repo} manually now or press ENTER to skip:"
......@@ -38,7 +38,8 @@ function getServices() {
mkdir -p "${GAIAX_TSA_DIR}" && cd "$_"
local services=(
"infohub"
"policy"
"task"
)
for repo in ${services[@]}; do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment