Commit 0b3bea57 authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

changed compose

parent 086cc28b
Pipeline #4121 failed with stages
# cassandra
CASSANDRA_BROADCAST_ADDRESS=host.docker.internal
CASSANDRA_SEEDS=host.docker.internal
CASSANDRA_HOSTS=elassandra
CASSANDRA_KEYSPACE=rahasak
CASSANDRA_PORT=9042
CASSANDRA_DATA_DIR=/private/var/services/informatZen/elassandra
CASSANDRA_CONSISTANCY=LOCAL_QUORUM
CASSNADRA_REPLICATION_FACTOR=1
# elasticsearch
ELASTIC_HOSTS=elassandra
ELASTIC_PORT=9300
# aplos
APLOS_NAME=aplos
APLOS_MODE=PROD
APLOS_LOGS_DIR=/private/var/services/informatZen/aplos/logs
APLOS_KEYS_DIR=/private/var/services/informatZen/aplos/keys
USE_SEND_SMS=false
ENABLE_VERIFY_SIGNATURE=false
# gateway
GATEWAY_NAME=gateway
GATEWAY_HOST=gateway
AUTH_RSA_PUB=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcHg3OLaBktUeRk8jPM7gp+ZDFxOjh6JMTTUbRhlUc4/DSeyQkblnSimaBqKJnonnM/nf3kaZCrgvKU5hO78MGI6iFnXpaDtwp6sFc037TcEkbBFwPmPnVF9rgln94ayA8qw5r8EYQNfq94Ez97za0hI7/ENpoOrEf/TA68uiYmQIDAQAB
ENABLE_VERIFY_TOKEN=no
GATEWAY_LOGS_DIR=/private/var/services/informatZen/gateway/logs
GATEWAY_KEYS_DIR=/private/var/services/informatZen/gateway/keys
GATEWAY_CERTS_DIR=/private/var/services/informatZen/gateway/certs
# service apis
ACCOUNT_API=http://aplos:8761/api/identities
PEER_API=http://aplos:8761/api/vaccines
# cassandra
CASSANDRA_BROADCAST_ADDRESS=host.docker.internal
CASSANDRA_SEEDS=host.docker.internal
CASSANDRA_HOSTS=elassandra
CASSANDRA_KEYSPACE=rahasak
CASSANDRA_PORT=9042
CASSANDRA_DATA_DIR=/private/var/services/informatZen/elassandra
CASSANDRA_CONSISTANCY=LOCAL_QUORUM
CASSNADRA_REPLICATION_FACTOR=1
# elasticsearch
ELASTIC_HOSTS=elassandra
ELASTIC_PORT=9300
# aplos
APLOS_NAME=aplos
APLOS_MODE=PROD
APLOS_LOGS_DIR=/private/var/services/informatZen/aplos/logs
APLOS_KEYS_DIR=/private/var/services/informatZen/aplos/keys
USE_SEND_SMS=false
ENABLE_VERIFY_SIGNATURE=false
# gateway
GATEWAY_NAME=gateway
GATEWAY_HOST=gateway
AUTH_RSA_PUB=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcHg3OLaBktUeRk8jPM7gp+ZDFxOjh6JMTTUbRhlUc4/DSeyQkblnSimaBqKJnonnM/nf3kaZCrgvKU5hO78MGI6iFnXpaDtwp6sFc037TcEkbBFwPmPnVF9rgln94ayA8qw5r8EYQNfq94Ez97za0hI7/ENpoOrEf/TA68uiYmQIDAQAB
ENABLE_VERIFY_TOKEN=no
GATEWAY_LOGS_DIR=/private/var/services/informatZen/gateway/logs
GATEWAY_KEYS_DIR=/private/var/services/informatZen/gateway/keys
GATEWAY_CERTS_DIR=/private/var/services/informatZen/gateway/certs
# service apis
ACCOUNT_API=http://aplos:8761/api/identities
PEER_API=http://aplos:8761/api/vaccines
# Deployment of informatZen Services
Follwoing figure discussed the architecture of the informatZen platfrom.
![Alt text](intoinfinity-architecture.png?raw=true "informatZen platfrom architecture")
## Services
There are three main servies;
```
1. elassandra
2. aplos
3. gateway
```
## Configuration
Change `host.docker.local` field in `.env` file to local machines ip. also its possible to add a host entry to `/etc/hosts` file by overriding `host.docker.local` with local machines ip. following is an example of `/etc/hosts` file.
```
10.4.1.104 host.docker.local
```
Give write permission to `/private/var/services/connect/elassandra` directory in the server. following is the way to give the permission,
```
sudo mkdir /private/var/services/connect/elassandra
sudo chmod -R 777 /private
```
## Deploy services
Start services in following order;
```
docker-compose up -d elassandra
docker-compose up -d aplos
docker-compose up -d gateway
docker-compose up -d web
```
** After hosting website, it can be reached on `<Ip address of the Vm>:4300`.
## Connect apis
gateway service will start a REST api on `7654` port. For an example if your machines ip is `10.4.1.104` the apis can be access via `10.4.1.104:7654/api/<apiname>`.Following are the available rest api end points and their specifications,
** Open `7654` and `4300` port on VM for public
#### 1. put Vaccine
```
# request
curl -XPOST "http://localhost:7654/api/vaccines" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"id": "111110",
"execer": "admin:admin",
"messageType": "addVaccine",
"userMobile": "0715422017",
"userName": "test user",
"vaccineStatus": "done"
}
'
# reply
{"code":201,"msg":"vaccine added"}
```
#### 2. get Vaccine
```
# request
curl -XPOST "http://localhost:7654/api/vaccines" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"id": "1111xx",
"execer": "admin:admin",
"messageType": "getVaccine",
"userMobile": "0715422017",
}
'
# reply
{"userMobile":"0775321290","userName":"test user","vaccineStatus": "done", "timestamp":"2021-07-12 20:55:21.308"}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment