Skip to content

Latest commit

 

History

History

SureRepute-Server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

CROSS Logo

SureRepute Server

(Server REST API + PSQL DB)


Table of Contents

Build and Run form source locally

Source Prerequisites

Add CA as a Trusted Certificate

Add CA Certificate to Java Trusted Certificates. (You will need the password. (Default=changeit))

keytool -importcert -trustcacerts -cacerts -file SureReputeCA.crt -alias SureReputeCA -storepass changeit

Note: If you had previously done this step, then you need to delete first the LedgerCA certificate.

keytool -delete -alias SureReputeCA -trustcacerts -cacerts -storepass changeit

Resolve the Dependencies and Build the Server

From the root of the module go to resources and initialize de database:

cd src/main/resouces
./newDb.sh

From the root of the module execute:

mvn clean install

Define the following environment variables:

export ID=SureReputeServer1
export CLIENT_SERVER_URL=https://localhost:9092
export SERVER_SERVER_URL=https://localhost:9093
export IP_SERVER_URL=https://localhost:9094
export DB_CONNECTION=localhost
export DB_PORT=5432
export DB_NAME=sure_repute1
export DB_USER=sure_repute1
export DB_PWD=sure_repute1

Run SureRepute-Server

From the root of the module execute:

mvn exec:java

Build the SureRepute-Server Docker Image

Image Prerequisites

Build Image

From the root of the module go to docker folder:

cd docker

Build the image:

./buildDockerImage.sh

Note: When running more than one server, the urls of the servers need to be added to url.properties before we set up the image. This can be done manually, or using setupServerUrls, see modules readme for more details.

Run Locally with Docker Compose

Docker Compose Prerequisites

Run Docker Compose

From the root of the module go to docker folder:

cd docker

Run docker-compose containing both the SureRepute Server and SureRepute PSQL services (Use the -d parameter to detach):

docker-compose up

Note: You can change the following environment variables in file docker-compose.yml:

  - ID=SureReputeServer1
  - CLIENT_SERVER_URL=https://localhost:9092
  - SERVER_SERVER_URL=>https://localhost:9093
  - IP_SERVER_URL=https://localhost:9094
  - DB_CONNECTION=sure_repute-psql
  - DB_PORT=5432
  - DB_NAME=sure_repute1
  - DB_USER=sure_repute1
  - DB_PWD=sure_repute1

Whenever you want to stop the services execute:

docker-compose down

Deploy to Google Cloud

Google Cloud Prerequisites

Push the SureRepute Server Docker Image to the GCloud Registry

Tag the image, with version 1.0.0:

docker tag sure-repute-server gcr.io/gsdsupport/sure-repute-server:v1.0.0

Push to the registry:

gcloud docker -- push gcr.io/gsdsupport/sure-repute-server:v1.0.0

Note: This setup should be done by a kubernetes admin.

Set up the Cluster and the Namespace

From the root of the project, change directory to k8s/sure-repute-namespace

cd k8s/sure-repute-namespace

If the cluster is not created then we run deploy-namespace.sh with create as argument to create the cluster and the namespace

./deploy-namespace.sh create

If the cluster is already created we can just run deploy-namespace.sh which only creates the namespace

./deploy-namespace.sh

To delete the cluster we run deploy-namespace.sh with delete as argument

./deploy-namespace.sh delete

Note: This setup should be done by a kubernetes admin.

Automatic Deployment

From the root of the project, change directory to k8s:

cd k8s

Deploy the surerepute chart:

 helm install surerepute ./sure-repute-chart

This command installs surerepute with the default values present in values.yaml. If you want to run more than one server you can do this command multiple times, and you just need to change the values you want.

The mandatory values you need to change are:

  • K8S_ID: The id used on the deployment of the k8s, which is unique
  • ID: The id used to identify this server, which is unique
  • CS_HOST_NAME: The dns name for client communication with this server
  • SS_HOST_NAME: The dns name for server communication with this server
  • SIP_HOST_NAME: The dns name for identity-provider communication with this server

The command would be:

 helm install surerepute-<K8S_ID> ./sure-repute-chart --set K8S_ID=<K8S_ID>,ID=<ID>,SS_HOST_NAME:<SS_HOST_NAME>,CS_HOST_NAME=<CS_HOST_NAME>,SIP_HOST_NAME=<SIP_HOST_NAME>

Note: You can change other values like the username and password of the database.

To delete the surerepute chart we do:

 helm uninstall surerepute

Authors

Name University More info
Rafael Figueiredo Instituto Superior Técnico