diff --git a/.gitignore b/.gitignore index 4c6249f9a716a1969888a084da3517b44c25ddf3..77d4633420c799e189382bea1ab669c338865703 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +.DS_Store .idea/ volumes/ +vault/vault-cluster-vault+.json \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a7eaa11fc434e38fd85fce81379c24536cd29296..699bcc27cf71b670282b183e922fd77cb8f6b352 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: - "8081:8080" depends_on: - mongo + - cache task: container_name: task @@ -28,6 +29,7 @@ services: - "8082:8080" depends_on: - mongo + - cache cache: container_name: cache @@ -43,6 +45,21 @@ services: depends_on: - redis + infohub: + container_name: infohub + build: + context: $GOPATH/src/code.vereign.com/gaiax/tsa/infohub + dockerfile: deployment/compose/Dockerfile + volumes: + - "$GOPATH/src/code.vereign.com/gaiax/tsa/infohub:/go/src/code.vereign.com/gaiax/tsa/infohub" + env_file: + - ./env/infohub.env + ports: + - "8084:8080" + depends_on: + - mongo + - vault + didresolver: image: universalresolver/uni-resolver-web:latest ports: @@ -83,3 +100,20 @@ services: start_period: 30s restart: on-failure command: "--bind_ip_all --replSet rs0" + + vault: + hostname: vault + container_name: vault + image: vault:1.10.3 + environment: + VAULT_ADDR: ":8200" + VAULT_API_ADDR: "http://0.0.0.0:8200" + VAULT_DEV_ROOT_TOKEN_ID: root + ports: + - "8200:8200" + volumes: + - ./volumes/vault/file:/vault/file:rw + - ./vault:/vault/config:rw + cap_add: + - IPC_LOCK + entrypoint: vault server -config=/vault/config/config.json diff --git a/env/infohub.env b/env/infohub.env new file mode 100644 index 0000000000000000000000000000000000000000..82eb17c8ede237e7208aac43ae34b0b686d83aa9 --- /dev/null +++ b/env/infohub.env @@ -0,0 +1,16 @@ +LOG_LEVEL="debug" +HTTP_HOST="" +HTTP_PORT="8080" +HTTP_IDLE_TIMEOUT="120s" +HTTP_READ_TIMEOUT="10s" +HTTP_WRITE_TIMEOUT="10s" +CACHE_ADDR="http://cache:8080" +POLICY_ADDR="http://policy:8080" +MONGO_ADDR="mongodb://mongo:27017/infohub?replicaSet=rs0&authSource=admin" +MONGO_USER="root" +MONGO_PASS="root" +VAULT_ADDR="http://vault:8200" +VAULT_TOKEN="hvs.SaCAgNfJk91T1Qikb3XxH3ve" +VAULT_KEYNAME="signkey1" +CRED_ISSUER_NAME="ocm-123" +CRED_KEYNAME="signkey1" \ No newline at end of file diff --git a/env/policy.env b/env/policy.env index 44feda2d2dc945e7b4256f09b89602139c335946..3e21c743375fe1473563013260f986088c4fff13 100644 --- a/env/policy.env +++ b/env/policy.env @@ -10,4 +10,5 @@ MONGO_PASS="root" MONGO_DBNAME="policy" MONGO_COLLECTION="policies" CACHE_ADDR="http://cache:8080" +TASK_ADDR="http://task:8080" DID_RESOLVER_ADDR="http://didresolver:8080" diff --git a/mongo/docker-entrypoint-initdb.d/mongo-init.js b/mongo/docker-entrypoint-initdb.d/mongo-init.js index 909e88ef8bc40500af8f321595d78079e22cd192..ed8e2a2265cb646137b4a6f3882f14262f3c2b14 100644 --- a/mongo/docker-entrypoint-initdb.d/mongo-init.js +++ b/mongo/docker-entrypoint-initdb.d/mongo-init.js @@ -17,6 +17,22 @@ db.policies.insertMany( taskID := "0123456789abcdef" ` + }, + { + filename: "example_2.0.rego", + name: "example", + group: "example", + version: "2.0", + locked: false, + lastUpdate: new Date(), + rego: `package example.example + + allow { + 1 == 2 + } + + result := input + ` } ] ); @@ -47,3 +63,18 @@ db.taskTemplates.insertMany( } ] ); + +db = db.getSiblingDB('infohub'); +db.createCollection('exports'); +db.exports.insertMany( + [ + { + "exportName":"testexport", + "contexts":["https://www.w3.org/2018/credentials/examples/v1"], + "policies":{ + "example/example/1.0":{}, + "example/example/2.0":{"hello":"world"} + } + } + ] +); diff --git a/setup.sh b/setup.sh index 7a32f33eeb19cd28cd2a4dfe6adc9f80d872c72d..f95cb90856d6c963ceb40fd3ec26c089042b2429 100755 --- a/setup.sh +++ b/setup.sh @@ -39,6 +39,7 @@ function getServices() { local services=( "cache" + "infohub" "policy" "task" ) diff --git a/vault/config.json b/vault/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7a8b0e7b3fd95c10b2ef2438a9aab80d8fc434d1 --- /dev/null +++ b/vault/config.json @@ -0,0 +1,7 @@ +{ + "backend": {"file": {"path": "/vault/file"}}, + "listener": {"tcp": {"address": "0.0.0.0:8200", "tls_disable": 1}}, + "default_lease_ttl": "168h", + "max_lease_ttl": "0h", + "ui": true +}