Commit 30f691bf authored by Sakuna Yashara's avatar Sakuna Yashara

first commit

parents
Pipeline #4122 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/subi/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/subi/aplos/logs
APLOS_KEYS_DIR=/private/var/services/subi/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/subi/gateway/logs
GATEWAY_KEYS_DIR=/private/var/services/subi/gateway/keys
GATEWAY_CERTS_DIR=/private/var/services/subi/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](informatzen-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"}
```
elassandra:
image: erangaeb/elassandra:6.2
container_name: elassandra
environment:
- CASSANDRA_BROADCAST_ADDRESS=${CASSANDRA_BROADCAST_ADDRESS}
- CASSANDRA_SEEDS=${CASSANDRA_SEEDS}
#volumes:
#['$CASSANDRA_DATA_DIR:/opt/elassandra/data']
ports:
- 7000:7000
- 7001:7001
- 7199:7199
- 9042:9042
- 9160:9160
- 9200:9200
- 9300:9300
aplos:
image: sakuna97/subi-aplos
container_name: aplos
environment:
- SERVICE_NAME=${APLOS_NAME}
- SERVICE_MODE=${APLOS_MODE}
- CASSANDRA_HOSTS=${CASSANDRA_HOSTS}
- CASSANDRA_PORT=${CASSANDRA_PORT}
- CASSANDRA_KEYSPACE=${CASSANDRA_KEYSPACE}
- CASSNADRA_REPLICATION_FACTOR=${CASSNADRA_REPLICATION_FACTOR}
- ELASTIC_HOSTS=${ELASTIC_HOSTS}
- ELASTIC_PORT=${ELASTIC_PORT}
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
- NOTIFICATION_API=${NOTIFICATION_API}
- USE_SEND_SMS=${USE_SEND_SMS}
- ENABLE_VERIFY_SIGNATURE=${ENABLE_VERIFY_SIGNATURE}
ports:
- 8761:8761
volumes:
['$APLOS_LOGS_DIR:/app/.logs', '$APLOS_KEYS_DIR:/app/.keys']
links:
- elassandra
- redis
gateway:
image: sakuna97/subi-gateway
container_name: gateway
ports:
- 7654:7654
environment:
- SERVICE_NAME=${GATEWAY_NAME}
- ACCOUNT_API=${ACCOUNT_API}
- PEER_API=${PEER_API}
- AUTH_RSA_PUB=${AUTH_RSA_PUB}
- ENABLE_VERIFY_TOKEN=${ENABLE_VERIFY_TOKEN}
volumes:
['$GATEWAY_LOGS_DIR:/app/.logs', '$GATEWAY_KEYS_DIR:/app/.keys']
links:
- aplos
web:
image: sakuna97/subi-web
container_name: web
ports:
- 4400:4400
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